Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/unsupported/tests/mbed/timeout/main.cpp
- Committer:
- group-onsemi
- Date:
- 2017-01-25
- Revision:
- 0:098463de4c5d
File content as of revision 0:098463de4c5d:
#include "mbed.h"
#include "test_env.h"
Timeout timer;
DigitalOut led(LED1);
namespace {
const int MS_INTERVALS = 1000;
}
void print_char(char c = '*') {
printf("%c", c);
fflush(stdout);
}
void toggleOff(void);
void toggleOn(void) {
static int toggle_counter = 0;
if (toggle_counter == MS_INTERVALS) {
led = !led;
print_char();
toggle_counter = 0;
}
toggle_counter++;
timer.attach_us(toggleOff, 500);
}
void toggleOff(void) {
timer.attach_us(toggleOn, 500);
}
int main() {
MBED_HOSTTEST_TIMEOUT(15);
MBED_HOSTTEST_SELECT(wait_us_auto);
MBED_HOSTTEST_DESCRIPTION(Timeout Int us);
MBED_HOSTTEST_START("MBED_24");
toggleOn();
while (1);
}