diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-07-31 12:11:35 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-07-31 12:11:35 +0000 |
commit | 76d2dd6f453326237db32c06525444a3ba5f40ce (patch) | |
tree | e615cc86ff6d8d348484668dc42767c3d325e89a /testhal/STM32/UART/main.c | |
parent | 1f7b57f57590844b044c93113fc0d20e195a2e24 (diff) | |
download | ChibiOS-76d2dd6f453326237db32c06525444a3ba5f40ce.tar.gz ChibiOS-76d2dd6f453326237db32c06525444a3ba5f40ce.tar.bz2 ChibiOS-76d2dd6f453326237db32c06525444a3ba5f40ce.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2105 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/UART/main.c')
-rw-r--r-- | testhal/STM32/UART/main.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/testhal/STM32/UART/main.c b/testhal/STM32/UART/main.c index a3e74a9a1..214cf35db 100644 --- a/testhal/STM32/UART/main.c +++ b/testhal/STM32/UART/main.c @@ -20,12 +20,23 @@ #include "ch.h"
#include "hal.h"
+static VirtualTimer vt;
+
+static void restart(void *p) {
+
+ (void)p;
+ uartStartSend(&UARTD2, 14, "Hello World!\r\n");
+}
+
static void txend1(void) {
}
static void txend2(void) {
+ chSysLockFromIsr();
+ chVTSetI(&vt, MS2ST(1000), restart, NULL);
+ chSysUnlockFromIsr();
}
static void rxerr(uartflags_t e) {
@@ -90,11 +101,15 @@ int main(int argc, char **argv) { chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
+ * Starts the transmission, it will be handled entirely in background. + */
+ uartStartSend(&UARTD2, 13, "Starting...\r\n");
+
+ /*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (TRUE) {
- uartStartSend(&UARTD2, 14, "Hello World!\r\n");
chThdSleepMilliseconds(500);
}
return 0;
|