From fbac4d253d67cc5b1ec39166ce1abb8124b1e3a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 13 Sep 2011 12:40:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3314 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F1xx/EXT/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'testhal/STM32F1xx/EXT') diff --git a/testhal/STM32F1xx/EXT/main.c b/testhal/STM32F1xx/EXT/main.c index a438c3035..fc82a7786 100644 --- a/testhal/STM32F1xx/EXT/main.c +++ b/testhal/STM32F1xx/EXT/main.c @@ -51,7 +51,7 @@ static void extcb2(EXTDriver *extp, expchannel_t channel) { static const EXTConfig extcfg = { { - {EXT_CH_MODE_BOTH_EDGES, extcb1}, + {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART, extcb1}, {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, @@ -63,7 +63,7 @@ static const EXTConfig extcfg = { {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, - {EXT_CH_MODE_RISING_EDGE, extcb2}, + {EXT_CH_MODE_RISING_EDGE | EXT_CH_MODE_AUTOSTART, extcb2}, {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, {EXT_CH_MODE_DISABLED, NULL}, @@ -107,10 +107,13 @@ int main(void) { extStart(&EXTD1, &extcfg); /* - * Normal main() thread activity, in this demo it does nothing except - * sleeping in a loop and check the button state. + * Normal main() thread activity, in this demo it enables and disables the + * button EXT channel using 5 seconds intervals. */ while (TRUE) { - chThdSleepMilliseconds(500); + chThdSleepMilliseconds(5000); + extChannelDisable(&EXTD1, 0); + chThdSleepMilliseconds(5000); + extChannelEnable(&EXTD1, 0); } } -- cgit v1.2.3