mirror of https://github.com/ARMmbed/mbed-os.git
Added RTOS_7 timer automated test to host test suite
parent
3690bdd40f
commit
88fa03a1af
|
@ -5,8 +5,20 @@ DigitalOut LEDs[4] = {
|
||||||
DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4)
|
DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void print_char(char c = '*')
|
||||||
|
{
|
||||||
|
printf("%c", c);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
void blink(void const *n) {
|
void blink(void const *n) {
|
||||||
LEDs[(int)n] = !LEDs[(int)n];
|
static int counter = 0;
|
||||||
|
const int led_id = int(n);
|
||||||
|
LEDs[led_id] = !LEDs[led_id];
|
||||||
|
if (++counter == 75) {
|
||||||
|
print_char();
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
@ -14,11 +26,11 @@ int main(void) {
|
||||||
RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1);
|
RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1);
|
||||||
RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2);
|
RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2);
|
||||||
RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3);
|
RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3);
|
||||||
|
|
||||||
led_1_timer.start(2000);
|
led_1_timer.start(200);
|
||||||
led_2_timer.start(1000);
|
led_2_timer.start(100);
|
||||||
led_3_timer.start(500);
|
led_3_timer.start(50);
|
||||||
led_4_timer.start(250);
|
led_4_timer.start(25);
|
||||||
|
|
||||||
Thread::wait(osWaitForever);
|
Thread::wait(osWaitForever);
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,6 +536,9 @@ TESTS = [
|
||||||
"id": "RTOS_7", "description": "Timer",
|
"id": "RTOS_7", "description": "Timer",
|
||||||
"source_dir": join(TEST_DIR, "rtos", "mbed", "timer"),
|
"source_dir": join(TEST_DIR, "rtos", "mbed", "timer"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],
|
||||||
|
"duration": 15,
|
||||||
|
"automated": True,
|
||||||
|
"host_test": "wait_us_auto"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "RTOS_8", "description": "ISR",
|
"id": "RTOS_8", "description": "ISR",
|
||||||
|
|
Loading…
Reference in New Issue