aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32F1xx
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-20 20:11:04 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-20 20:11:04 +0000
commit1c7c4673d2cbd6f4ef0f9198ddc7edbfea56332f (patch)
tree74dcb3b6f5a455e2b5a6c20d5521ae4b1b2e7c2c /testhal/STM32F1xx
parentf90273557f060f07b87c1c9e3765f74491910533 (diff)
downloadChibiOS-1c7c4673d2cbd6f4ef0f9198ddc7edbfea56332f.tar.gz
ChibiOS-1c7c4673d2cbd6f4ef0f9198ddc7edbfea56332f.tar.bz2
ChibiOS-1c7c4673d2cbd6f4ef0f9198ddc7edbfea56332f.zip
EXT_WAKEUP test minor improvements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3374 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F1xx')
-rw-r--r--testhal/STM32F1xx/EXT_WAKEUP/main.c21
1 files changed, 12 insertions, 9 deletions
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 <http://www.gnu.org/licenses/>.
*/
+
+/**
+ * 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);
}
}