From 1c7c4673d2cbd6f4ef0f9198ddc7edbfea56332f Mon Sep 17 00:00:00 2001 From: barthess Date: Tue, 20 Sep 2011 20:11:04 +0000 Subject: EXT_WAKEUP test minor improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3374 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F1xx/EXT_WAKEUP/main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'testhal/STM32F1xx') diff --git a/testhal/STM32F1xx/EXT_WAKEUP/main.c b/testhal/STM32F1xx/EXT_WAKEUP/main.c index 522edde72..986721fc9 100644 --- a/testhal/STM32F1xx/EXT_WAKEUP/main.c +++ b/testhal/STM32F1xx/EXT_WAKEUP/main.c @@ -17,6 +17,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +/** + * This program demonstrate how to use interrupt from EXTI line for waking + * up MCU from stop mode. EXTI line connected to UART RX pin and generate + * interrupt on falling edge of start bit. + */ + #include "ch.h" #include "hal.h" @@ -32,7 +39,7 @@ static void extcb2(EXTDriver *extp, expchannel_t channel) { (void)channel; chSysLockFromIsr(); - /* we MUST reinit clocks after waking up if use HSE or HSI+PLL */ + /* we must reinit clocks after waking up ESPECIALLY if use HSE or HSI+PLL */ stm32_clock_init(); extChannelDisableI(&EXTD1, 10); @@ -142,23 +149,19 @@ int main(void) { /* Activates the serial driver using the driver default configuration. */ sdStart(&SD1, NULL); - /* Shell manager initialization. */ - shellInit(); + /* Setting up ports. */ palSetPadMode(IOPORT1, 9, PAL_MODE_STM32_ALTERNATE_PUSHPULL); palSetPadMode(IOPORT1, 10, PAL_MODE_INPUT); + /* Shell manager initialization. */ + shellInit(); static WORKING_AREA(waShell, 512); shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO); - /* - * Normal main() thread activity, in this demo it enables and disables the - * button EXT channel using 5 seconds intervals. - */ - + /* Start blink indicating. */ chThdSleepMilliseconds(2000); // timeuot to differ reboot and wake up from sleep while (TRUE) { chThdSleepMilliseconds(100); palTogglePad(IOPORT3, GPIOC_LED); - chThdExit(0); } } -- cgit v1.2.3