Skip to content

Commit f88fefc

Browse files
committed
templates: semihosting argv[1] loops
1 parent 40e5f20 commit f88fefc

File tree

31 files changed

+281
-36
lines changed

31 files changed

+281
-36
lines changed

ilg.gnuarmeclipse.templates.core/templates/common/src/main/main-100-include.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
// ----------------------------------------------------------------------------
77

88
#include <stdio.h>
9+
#include <stdlib.h>
910
#include "diag/Trace.h"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
timer_start();
3+
4+
blink_led_init();
5+
6+
uint32_t seconds = 0;
7+
8+
// Infinite loop
9+
while (1)
10+
{
11+
blink_led_on();
12+
timer_sleep(BLINK_ON_TICKS);
13+
14+
blink_led_off();
15+
timer_sleep(BLINK_OFF_TICKS);
16+
17+
++seconds;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Timer timer;
3+
timer.start();
4+
5+
BlinkLed blinkLed;
6+
7+
// Perform all necessary initialisations for the LED.
8+
blinkLed.powerUp();
9+
10+
uint32_t seconds = 0;
11+
12+
// Infinite loop
13+
while (1)
14+
{
15+
blinkLed.turnOn();
16+
timer.sleep(BLINK_ON_TICKS);
17+
18+
blinkLed.turnOff();
19+
timer.sleep(BLINK_OFF_TICKS);
20+
21+
++seconds;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
// Infinite loop
3+
while (1)
4+
{
5+
// Add your code here.
6+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
timer_start();
3+
4+
blink_led_init();
5+
6+
uint32_t seconds = 0;
7+
8+
// Infinite loop
9+
while (1)
10+
{
11+
blink_led_on();
12+
timer_sleep(BLINK_ON_TICKS);
13+
14+
blink_led_off();
15+
timer_sleep(BLINK_OFF_TICKS);
16+
17+
++seconds;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Timer timer;
3+
timer.start();
4+
5+
BlinkLed blinkLed;
6+
7+
// Perform all necessary initialisations for the LED.
8+
blinkLed.powerUp();
9+
10+
uint32_t seconds = 0;
11+
12+
// Infinite loop
13+
while (1)
14+
{
15+
blinkLed.turnOn();
16+
timer.sleep(BLINK_ON_TICKS);
17+
18+
blinkLed.turnOff();
19+
timer.sleep(BLINK_OFF_TICKS);
20+
21+
++seconds;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
// Infinite loop
3+
while (1)
4+
{
5+
// Add your code here.
6+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
timer_start();
3+
4+
blink_led_init();
5+
6+
uint32_t seconds = 0;
7+
8+
#define LOOP_COUNT (5)
9+
int loops = LOOP_COUNT;
10+
if (argc > 1)
11+
{
12+
// If defined, get the number of loops from the command line,
13+
// configurable via semihosting.
14+
loops = atoi (argv[1]);
15+
}
16+
17+
// Short loop.
18+
for (int i = 0; i < loops; i++)
19+
{
20+
blink_led_on();
21+
timer_sleep(BLINK_ON_TICKS);
22+
23+
blink_led_off();
24+
timer_sleep(BLINK_OFF_TICKS);
25+
26+
++seconds;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Timer timer;
3+
timer.start();
4+
5+
BlinkLed blinkLed;
6+
7+
// Perform all necessary initialisations for the LED.
8+
blinkLed.powerUp();
9+
10+
uint32_t seconds = 0;
11+
12+
#define LOOP_COUNT (5)
13+
int loops = LOOP_COUNT;
14+
if (argc > 1)
15+
{
16+
// If defined, get the number of loops from the command line,
17+
// configurable via semihosting.
18+
loops = atoi (argv[1]);
19+
}
20+
21+
// Short loop.
22+
for (int i = 0; i < loops; i++)
23+
{
24+
blinkLed.turnOn();
25+
timer.sleep(BLINK_ON_TICKS);
26+
27+
blinkLed.turnOff();
28+
timer.sleep(BLINK_OFF_TICKS);
29+
30+
++seconds;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
#define LOOP_COUNT (5)
3+
int loops = LOOP_COUNT;
4+
if (argc > 1)
5+
{
6+
// If defined, get the number of loops from the command line,
7+
// configurable via semihosting.
8+
loops = atoi (argv[1]);
9+
}
10+
11+
// Short loop.
12+
for (int i = 0; i < loops; i++)
13+
{
14+
// Add your code here.
15+
}

0 commit comments

Comments
 (0)