diff options
author | Guillaume Knispel <gknispel@avencall.com> | 2012-09-18 11:54:51 +0200 |
---|---|---|
committer | Guillaume Knispel <gknispel@avencall.com> | 2012-09-18 11:54:51 +0200 |
commit | 9bace567f72be6171b0f215589d79b79de89c224 (patch) | |
tree | b0b10079d5f0d9c48fe6b441c681f9f98f5d6787 | |
parent | ea2e2e3f245a5e52d28873683553616e213806b7 (diff) |
add the infinite reboot feature (LOOP_REBOOT), for tests
-rw-r--r-- | main.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -36,6 +36,11 @@ * to see exactly what that does in this particular version */ #define TRACE_SERIAL +/* define LOOP_REBOOT if you want that the board reboot forever + * define it to the number of ms to spend in the WAIT_STOP state. + */ +#define LOOP_REBOOT 5000 + #ifdef TRACE_SERIAL #include <stdio.h> #endif /* TRACE_SERIAL */ @@ -292,6 +297,9 @@ int main(void) //////////////////////////////////////////////////////////////////// switch (state) { case WAIT_START: +#ifdef LOOP_REBOOT + change_state(WAIT_START + 1); +#endif if (SW1State > 30) change_state(WAIT_START + 1); break; @@ -388,18 +396,29 @@ int main(void) change_state(STOP); if (Timer1 == 0) { ClrBit(P2DIR, IMCH_PWRBTN_N); +#ifdef LOOP_REBOOT + Timer1 = LOOP_REBOOT; +#endif change_state(WAIT_STOP); } break; case WAIT_STOP: +#ifdef LOOP_REBOOT + if (Timer1 == 0) + change_state(STOP); +#endif if (SW1State >= 4000) // Sw1 button pressed for more than 4 seconds change_state(STOP); break; case STOP: InitPorts(); +#ifndef LOOP_REBOOT Timer1 = 1000; // Disable any other Power up for 1 s. +#else + Timer1 = 3000; +#endif ClrBit(P2OUT, RED_LED_N); // To show no restart is possible for now change_state(STOP + 1); break; |