diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-09-30 13:04:10 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-09-30 13:04:10 +0000 |
commit | 8c1fc9af2b96a9a3ccae3d8810c21bd7afae97ab (patch) | |
tree | 27ab79db6ed83a893b78ee8d878a0ff416cca7b8 /testhal/STM32L1xx/UART/main.c | |
parent | 984148e9dbda3053aec71ea7da545bc75cd33e94 (diff) | |
download | ChibiOS-8c1fc9af2b96a9a3ccae3d8810c21bd7afae97ab.tar.gz ChibiOS-8c1fc9af2b96a9a3ccae3d8810c21bd7afae97ab.tar.bz2 ChibiOS-8c1fc9af2b96a9a3ccae3d8810c21bd7afae97ab.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6337 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32L1xx/UART/main.c')
-rw-r--r-- | testhal/STM32L1xx/UART/main.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/testhal/STM32L1xx/UART/main.c b/testhal/STM32L1xx/UART/main.c index 01a8c8cd9..f8b19014c 100644 --- a/testhal/STM32L1xx/UART/main.c +++ b/testhal/STM32L1xx/UART/main.c @@ -17,15 +17,15 @@ #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(&UARTD1, 14, "Hello World!\r\n");
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
static void ledoff(void *p) {
@@ -51,11 +51,10 @@ static void txend2(UARTDriver *uartp) { (void)uartp;
palClearPad(GPIOB, GPIOB_LED4);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt1))
- chVTResetI(&vt1);
- chVTSetI(&vt1, MS2ST(5000), restart, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt1);
+ chVTDoSetI(&vt1, MS2ST(5000), restart, NULL);
+ chSysUnlockFromISR();
}
/*
@@ -78,11 +77,10 @@ static void rxchar(UARTDriver *uartp, uint16_t c) { (void)c;
/* Flashing the LED each time a character is received.*/
palSetPad(GPIOB, GPIOB_LED4);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt2))
- chVTResetI(&vt2);
- chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt2);
+ chVTDoSetI(&vt2, MS2ST(200), ledoff, NULL);
+ chSysUnlockFromISR();
}
/*
|