diff options
| author | hathach <[email protected]> | 2012-12-10 16:10:24 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-12-10 16:10:24 +0700 |
| commit | e4a69a6f71948ee79bb501cab37eec02f5a01002 (patch) | |
| tree | 6563317ead252af3d74571c2b965d382b18d70c6 /demos/host | |
| parent | 4ec23ea786117b338dd8c070df1da15b27e98f3c (diff) | |
running blinking example
Diffstat (limited to 'demos/host')
| -rw-r--r-- | demos/host/main.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/demos/host/main.c b/demos/host/main.c new file mode 100644 index 000000000..384e4cfc3 --- /dev/null +++ b/demos/host/main.c @@ -0,0 +1,34 @@ +#include "boards/board.h" +#include "tusb.h" + +#if defined(__CODE_RED) + #include <cr_section_macros.h> + #include <NXP/crp.h> + // Variable to store CRP value in. Will be placed automatically + // by the linker when "Enable Code Read Protect" selected. + // See crp.h header for more information + __CRP const unsigned int CRP_WORD = CRP_NO_CRP ; +#endif + +volatile uint32_t system_tick = 0; +void SysTick_Handler (void) +{ + system_tick++; +} + +int main(void) +{ + uint32_t current_tick = system_tick; + + board_init(); + tusb_init(0); + + while (1) + { + if (current_tick + 1000 < system_tick) + { + current_tick += 1000; + board_leds(0x03, (current_tick/1000)%2); /* Toggle LED once per second */ + } + } +} |
