aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/usart.c
diff options
context:
space:
mode:
authoriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-01-10 14:06:15 +0000
committeriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-01-10 14:06:15 +0000
commita597f3f3ce79c38e0d41acb9591ed7ab2e22bb6a (patch)
tree6f90320a9c77507255104ed2f13da4ae5878015b /src/lib/usart.c
parentf1598e62ac2cdd4a6077aed6ca200743a4de59e5 (diff)
downloadlibrambutan-a597f3f3ce79c38e0d41acb9591ed7ab2e22bb6a.tar.gz
librambutan-a597f3f3ce79c38e0d41acb9591ed7ab2e22bb6a.zip
forgot to turn on the interrupt for usar3
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@110 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/lib/usart.c')
-rw-r--r--src/lib/usart.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/usart.c b/src/lib/usart.c
index 76685fd..96e920c 100644
--- a/src/lib/usart.c
+++ b/src/lib/usart.c
@@ -86,7 +86,7 @@ void USART2_IRQHandler(void) {
/* Don't overrun your buffer, seriously */
void USART3_IRQHandler(void) {
/* Read the data */
- ring_buf3.buf[ring_buf2.tail++] = (uint8_t)(((usart_port*)(USART3_BASE))->DR);
+ ring_buf3.buf[ring_buf3.tail++] = (uint8_t)(((usart_port*)(USART3_BASE))->DR);
ring_buf3.tail %= USART_RECV_BUF_SIZE;
}
@@ -124,12 +124,14 @@ void usart_init(uint8 usart_num, uint32 baud) {
ring_buf = &ring_buf2;
clk_speed = USART2_CLK;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
+ REG_SET(NVIC_ISER1, BIT(6));
break;
case 3:
port = (usart_port*)USART3_BASE;
ring_buf = &ring_buf3;
clk_speed = USART3_CLK;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
+ REG_SET(NVIC_ISER1, BIT(7));
break;
default:
/* should never get here */
@@ -153,8 +155,6 @@ void usart_init(uint8 usart_num, uint32 baud) {
USART_RE | // receiver enable
USART_RXNEIE; // receive interrupt enable
- /* Turn it on in the nvic */
- REG_SET(NVIC_ISER1, BIT(6));
/* Enable the USART and set mode to 8n1 */
port->CR1 |= USART_UE;