aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/multi/PAL/main.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-08-31 14:17:35 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-08-31 14:17:35 +0000
commita093ad6f13b6eb46075c179ade93bf07fb0d93a0 (patch)
tree150851ba5c7b92d8361f660787f1dcb82ffc0f94 /testhal/STM32/multi/PAL/main.c
parent424f88606831bf8645716b9cfce831b468cfca75 (diff)
downloadChibiOS-a093ad6f13b6eb46075c179ade93bf07fb0d93a0.tar.gz
ChibiOS-a093ad6f13b6eb46075c179ade93bf07fb0d93a0.tar.bz2
ChibiOS-a093ad6f13b6eb46075c179ade93bf07fb0d93a0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10515 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/multi/PAL/main.c')
-rw-r--r--testhal/STM32/multi/PAL/main.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/testhal/STM32/multi/PAL/main.c b/testhal/STM32/multi/PAL/main.c
index 81d520cc5..5c1660c50 100644
--- a/testhal/STM32/multi/PAL/main.c
+++ b/testhal/STM32/multi/PAL/main.c
@@ -31,28 +31,26 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
while (true) {
- systime_t time = palReadLine(PORTAB_LINE_BUTTON) == PAL_LOW ? 500 : 250;
- palClearLine(PORTAB_LINE_LED2);
- chThdSleepMilliseconds(time);
- palSetLine(PORTAB_LINE_LED2);
+ systime_t time = palReadLine(PORTAB_LINE_BUTTON) == PORTAB_BUTTON_PRESSED ? 250 : 500;
+ palToggleLine(PORTAB_LINE_LED2);
chThdSleepMilliseconds(time);
}
}
#endif
-event_source_t button_pressed_event;
-event_source_t button_released_event;
+static event_source_t button_pressed_event;
+static event_source_t button_released_event;
static void button_cb(void *arg) {
(void)arg;
chSysLockFromISR();
- if (palReadLine(PORTAB_LINE_BUTTON) == PAL_LOW) {
- chEvtBroadcastI(&button_released_event);
+ if (palReadLine(PORTAB_LINE_BUTTON) == PORTAB_BUTTON_PRESSED) {
+ chEvtBroadcastI(&button_pressed_event);
}
else {
- chEvtBroadcastI(&button_pressed_event);
+ chEvtBroadcastI(&button_released_event);
}
chSysUnlockFromISR();
}