mbed-os/libraries/tests/mbed/time_us/main.cpp

57 lines
1.0 KiB
C++

#include "mbed.h"
#ifdef TARGET_KL25Z
DigitalOut out(PTD4);
#elif defined(TARGET_KL05Z)
DigitalOut out(PTB1);
#elif defined(TARGET_KL46Z)
DigitalOut out(PTA1);
#elif defined(TARGET_K64F)
DigitalOut out(PTA1);
#elif defined(TARGET_LPC812)
DigitalOut out(D10);
#elif defined(TARGET_NUCLEO_F103RB) || \
defined(TARGET_NUCLEO_L152RE) || \
defined(TARGET_NUCLEO_F302R8) || \
defined(TARGET_NUCLEO_F030R8) || \
defined(TARGET_NUCLEO_F401RE) || \
defined(TARGET_NUCLEO_F411RE) || \
defined(TARGET_NUCLEO_F072RB) || \
defined(TARGET_NUCLEO_F334R8) || \
defined(TARGET_NUCLEO_L053R8)
DigitalOut out(LED2);
#elif defined(TARGET_LPC11U68)
DigitalOut out(LED2);
#else
DigitalOut out(LED1);
#endif
DigitalOut led(LED1);
#define MS_INTERVALS 1000
void print_char(char c = '*')
{
printf("%c", c);
fflush(stdout);
}
int main()
{
while (true) {
for (int i = 0; i < MS_INTERVALS; i++) {
wait_us(1000);
out = !out;
}
led = !led;
print_char();
}
}