Added RTOS_7 timer automated test to host test suite

pull/230/head
Przemek Wirkus 2014-03-24 18:22:33 +00:00
parent 3690bdd40f
commit 88fa03a1af
2 changed files with 22 additions and 7 deletions

View File

@ -5,8 +5,20 @@ DigitalOut LEDs[4] = {
DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4)
};
void print_char(char c = '*')
{
printf("%c", c);
fflush(stdout);
}
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) {
@ -14,11 +26,11 @@ int main(void) {
RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1);
RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2);
RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3);
led_1_timer.start(2000);
led_2_timer.start(1000);
led_3_timer.start(500);
led_4_timer.start(250);
led_1_timer.start(200);
led_2_timer.start(100);
led_3_timer.start(50);
led_4_timer.start(25);
Thread::wait(osWaitForever);
}

View File

@ -536,6 +536,9 @@ TESTS = [
"id": "RTOS_7", "description": "Timer",
"source_dir": join(TEST_DIR, "rtos", "mbed", "timer"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],
"duration": 15,
"automated": True,
"host_test": "wait_us_auto"
},
{
"id": "RTOS_8", "description": "ISR",