From 76d2dd6f453326237db32c06525444a3ba5f40ce Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 31 Jul 2010 12:11:35 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2105 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/UART/main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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) { @@ -89,12 +100,16 @@ 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;