blob: 2509f4e4db55389e827f7fea060eedb056395ea6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "mbed.h"
#include "test_env.h"
Ticker tick;
DigitalOut led(LED1);
namespace {
const int MS_INTERVALS = 1000;
}
void print_char(char c = '*')
{
printf("%c", c);
fflush(stdout);
}
void togglePin(void)
{
static int ticker_count = 0;
if (ticker_count >= MS_INTERVALS) {
print_char();
ticker_count = 0;
led = !led; // Blink
}
ticker_count++;
}
int main()
{
MBED_HOSTTEST_TIMEOUT(15);
MBED_HOSTTEST_SELECT(wait_us_auto);
MBED_HOSTTEST_DESCRIPTION(Ticker Int us);
MBED_HOSTTEST_START("MBED_23");
tick.attach_us(togglePin, 1000);
while (1);
}
|