summaryrefslogtreecommitdiff
path: root/usart.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-09-03 18:19:57 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-09-03 18:19:57 +0200
commite9f8369ce8b464f178c778ff8bcc3f54fe70b30c (patch)
tree3f0edf5ca6b23c4f32827b3243b85c1a662e4bb0 /usart.h
parent28284d92087d8915f0032a6edb76a622d9d07966 (diff)
Added context switching and yield for cooperative multithreading.
Diffstat (limited to 'usart.h')
-rw-r--r--usart.h6
1 files changed, 4 insertions, 2 deletions
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<Interrupt::USART1>() {
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;
}