From e9f8369ce8b464f178c778ff8bcc3f54fe70b30c Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 3 Sep 2011 18:19:57 +0200 Subject: Added context switching and yield for cooperative multithreading. --- usart.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usart.h') diff --git a/usart.h b/usart.h index 6c145c6..ab7fb3f 100644 --- a/usart.h +++ b/usart.h @@ -4,7 +4,7 @@ template<> void interrupt() { USART1.DR; - GPIOA.ODR ^= 1 << 5; + //GPIOB.ODR ^= 1 << 1; } void usart_enable() { @@ -16,7 +16,9 @@ void usart_enable() { } void usart_send(uint8_t data) { - while(!(USART1.SR & 0x80)); // Wait for TXE. + while(!(USART1.SR & 0x80)) { + Thread::yield(); + } // Wait for TXE. USART1.DR = data; } -- cgit v1.2.3