EXT_WAKEUP test minor improvements.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3340 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
barthess 2011-09-18 11:50:31 +00:00
parent 94edbcb6cb
commit 373735d529
1 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ch.h" #include "ch.h"
#include "hal.h" #include "hal.h"
@ -87,7 +86,7 @@ static void cmd_reboot(BaseChannel *chp, int argc, char *argv[]){
return; return;
} }
chprintf(chp, "rebooting...\r\n"); chprintf(chp, "rebooting...\r\n");
SCB->SCR |= SCB_AIRCR_SYSRESETREQ_Msk; NVIC_SystemReset();
} }
static void cmd_sleep(BaseChannel *chp, int argc, char *argv[]){ static void cmd_sleep(BaseChannel *chp, int argc, char *argv[]){
@ -96,9 +95,9 @@ static void cmd_sleep(BaseChannel *chp, int argc, char *argv[]){
chprintf(chp, "Usage: sleep\r\n"); chprintf(chp, "Usage: sleep\r\n");
return; return;
} }
chprintf(chp, "going to sleep...\r\ntype any character to wake up..."); chprintf(chp, "Going to sleep. Type any character to wake up.\r\n");
chThdSleepMilliseconds(200); // timeout to print message in terminal chThdSleepMilliseconds(200); // time to print out message in terminal
extChannelEnable(&EXTD1, 10); extChannelEnable(&EXTD1, 10);
chThdSleepMilliseconds(5); chThdSleepMilliseconds(5);
@ -154,8 +153,10 @@ int main(void) {
* Normal main() thread activity, in this demo it enables and disables the * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals. * button EXT channel using 5 seconds intervals.
*/ */
chThdSleepMilliseconds(2000); // timeuot to differ reboot and wake up from sleep
while (TRUE) { while (TRUE) {
chThdSleepMilliseconds(250); chThdSleepMilliseconds(100);
palTogglePad(IOPORT3, GPIOC_LED); palTogglePad(IOPORT3, GPIOC_LED);
} }
} }