diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-10-03 14:18:56 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-10-03 14:18:56 +0000 |
commit | 4b049c1f175144f8583df5eb9e3a620ac306ee98 (patch) | |
tree | d20a3ec4de726fbfb746c6062061e24b7ac3d3be /testhal/STM32F1xx/UART/main.c | |
parent | fe65d988275f509d3e7b71014c19c1d1aefac035 (diff) | |
download | ChibiOS-4b049c1f175144f8583df5eb9e3a620ac306ee98.tar.gz ChibiOS-4b049c1f175144f8583df5eb9e3a620ac306ee98.tar.bz2 ChibiOS-4b049c1f175144f8583df5eb9e3a620ac306ee98.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6353 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F1xx/UART/main.c')
-rw-r--r-- | testhal/STM32F1xx/UART/main.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/testhal/STM32F1xx/UART/main.c b/testhal/STM32F1xx/UART/main.c index 5682b8029..526125df2 100644 --- a/testhal/STM32F1xx/UART/main.c +++ b/testhal/STM32F1xx/UART/main.c @@ -17,20 +17,21 @@ #include "ch.h"
#include "hal.h"
-static VirtualTimer vt1, vt2;
+static virtual_timer_t vt1, vt2;
static void restart(void *p) {
(void)p;
- chSysLockFromIsr();
+ chSysLockFromISR();
uartStartSendI(&UARTD2, 14, "Hello World!\r\n");
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
static void ledoff(void *p) {
(void)p;
+
palSetPad(IOPORT3, GPIOC_LED);
}
@@ -41,6 +42,7 @@ static void ledoff(void *p) { static void txend1(UARTDriver *uartp) {
(void)uartp;
+
palClearPad(IOPORT3, GPIOC_LED);
}
@@ -50,12 +52,12 @@ static void txend1(UARTDriver *uartp) { static void txend2(UARTDriver *uartp) {
(void)uartp;
+
palSetPad(IOPORT3, GPIOC_LED);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt1))
- chVTResetI(&vt1);
- chVTSetI(&vt1, MS2ST(5000), restart, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt1);
+ chVTDoSetI(&vt1, MS2ST(5000), restart, NULL);
+ chSysUnlockFromISR();
}
/*
@@ -76,13 +78,13 @@ static void rxchar(UARTDriver *uartp, uint16_t c) { (void)uartp;
(void)c;
+
/* Flashing the LED each time a character is received.*/
palClearPad(IOPORT3, GPIOC_LED);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt2))
- chVTResetI(&vt2);
- chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt2);
+ chVTDoSetI(&vt2, MS2ST(200), ledoff, NULL);
+ chSysUnlockFromISR();
}
/*
|