diff options
author | Camil Staps | 2017-01-31 23:15:28 +0100 |
---|---|---|
committer | Camil Staps | 2017-01-31 23:15:28 +0100 |
commit | 631204a1feffa8cf3795060370b14dfb9f53f533 (patch) | |
tree | 001d32e0157127607f7c088881f098c2eca841a1 /uart.h |
Diffstat (limited to 'uart.h')
-rw-r--r-- | uart.h | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -0,0 +1,39 @@ +#ifndef _H_UART +#define _H_UART + +#include "uart_config.h" + +#ifdef UART_EUSART1 + #define TXSTA TX1STA + #define RCSTA RC1STA + #define BAUDCON BAUD1CON + #define SPBRGH SP1BRGH + #define SPBRGL SP1BRGL + #define TXREG TX1REG +# ifdef P16F1778 + #define TXIF PIR1bits.TXIF +# else + #define TXIF PIR3bits.TX1IF +# endif +#else +#ifdef UART_EUSART2 + #define TXSTA TX2STA + #define RCSTA RCRXTA + #define BAUDCON BAUD2CON + #define SPBRGH SP2BRGH + #define SPBRGL SP2BRGL + #define TXREG TX2REG +# ifdef P16F1778 + #define TXIF PIR1bits.TXIF +# else + #define TXIF PIR3bits.TX2IF +# endif +#else + #error Define either UART_EUSART1 or UART_EUSART2 +#endif +#endif + +void uart_init(void); +void uart_putch(unsigned char data); + +#endif |