EXT_WAKEUP test minor improvements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3374 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
f90273557f
commit
1c7c4673d2
|
@ -17,6 +17,13 @@
|
||||||
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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
|
@ -32,7 +39,7 @@ static void extcb2(EXTDriver *extp, expchannel_t channel) {
|
||||||
(void)channel;
|
(void)channel;
|
||||||
|
|
||||||
chSysLockFromIsr();
|
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();
|
stm32_clock_init();
|
||||||
|
|
||||||
extChannelDisableI(&EXTD1, 10);
|
extChannelDisableI(&EXTD1, 10);
|
||||||
|
@ -142,23 +149,19 @@ int main(void) {
|
||||||
/* Activates the serial driver using the driver default configuration. */
|
/* Activates the serial driver using the driver default configuration. */
|
||||||
sdStart(&SD1, NULL);
|
sdStart(&SD1, NULL);
|
||||||
|
|
||||||
/* Shell manager initialization. */
|
/* Setting up ports. */
|
||||||
shellInit();
|
|
||||||
palSetPadMode(IOPORT1, 9, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
palSetPadMode(IOPORT1, 9, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||||
palSetPadMode(IOPORT1, 10, PAL_MODE_INPUT);
|
palSetPadMode(IOPORT1, 10, PAL_MODE_INPUT);
|
||||||
|
|
||||||
|
/* Shell manager initialization. */
|
||||||
|
shellInit();
|
||||||
static WORKING_AREA(waShell, 512);
|
static WORKING_AREA(waShell, 512);
|
||||||
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
|
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
|
||||||
|
|
||||||
/*
|
/* Start blink indicating. */
|
||||||
* Normal main() thread activity, in this demo it enables and disables the
|
|
||||||
* button EXT channel using 5 seconds intervals.
|
|
||||||
*/
|
|
||||||
|
|
||||||
chThdSleepMilliseconds(2000); // timeuot to differ reboot and wake up from sleep
|
chThdSleepMilliseconds(2000); // timeuot to differ reboot and wake up from sleep
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
chThdSleepMilliseconds(100);
|
chThdSleepMilliseconds(100);
|
||||||
palTogglePad(IOPORT3, GPIOC_LED);
|
palTogglePad(IOPORT3, GPIOC_LED);
|
||||||
chThdExit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue