diff options
| author | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2010-01-13 20:25:45 +0000 | 
|---|---|---|
| committer | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2010-01-13 20:25:45 +0000 | 
| commit | d468ccac449968009cbbd2eabd8cfa7d7f3a35e5 (patch) | |
| tree | e3b8f20c4222c27f045f60c3871e7bbf5c74e927 /src/lib/usart.c | |
| parent | a597f3f3ce79c38e0d41acb9591ed7ab2e22bb6a (diff) | |
| download | librambutan-d468ccac449968009cbbd2eabd8cfa7d7f3a35e5.tar.gz librambutan-d468ccac449968009cbbd2eabd8cfa7d7f3a35e5.zip | |
added serial1 support
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@113 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/lib/usart.c')
| -rw-r--r-- | src/lib/usart.c | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/src/lib/usart.c b/src/lib/usart.c index 96e920c..0fd4e05 100644 --- a/src/lib/usart.c +++ b/src/lib/usart.c @@ -76,6 +76,11 @@ typedef struct usart_port {      volatile uint32 GTPR;     // Guard time and prescaler register  } usart_port; +void USART1_IRQHandler(void) { +    /* Read the data  */ +    ring_buf1.buf[ring_buf1.tail++] = (uint8_t)(((usart_port*)(USART1_BASE))->DR); +    ring_buf1.tail %= USART_RECV_BUF_SIZE; +}  /* Don't overrun your buffer, seriously  */  void USART2_IRQHandler(void) { @@ -118,6 +123,8 @@ void usart_init(uint8 usart_num, uint32 baud) {          port = (usart_port*)USART1_BASE;          ring_buf = &ring_buf1;          clk_speed = USART1_CLK; +        RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); +        REG_SET(NVIC_ISER1, BIT(5));          break;      case 2:          port = (usart_port*)USART2_BASE; | 
