diff --git a/uart.c b/uart.c index 1578968..e6e7638 100644 --- a/uart.c +++ b/uart.c @@ -366,13 +366,11 @@ Date Description #define UART1_CONTROL UCSR1B #define UART1_DATA UDR1 #define UART1_UDRIE UDRIE1 -#elif defined(__AVR_ATtiny814__) - /* AVR-1 with USART */ - #define AVR1_USART0 +#elif defined(AVR1_USART0) + /* AVR-1 with USART */ #define UART0_RECEIVE_INTERRUPT USART0_RXC_vect #define UART0_TRANSMIT_INTERRUPT USART0_DRE_vect - #define USART0_BAUD_RATE(_br_) (uint16_t)((float)(F_CPU * 64 / (16 * (float)(_br_)) + 0.5)) - // #error "AVR ATtiny814 currently not supported by this libaray !" + #define USART0_BAUD_RATE(_br_) (uint16_t)((float)(F_CPU * 64 / (16 * (float)(_br_)) + 0.5)) #else #error "no UART definition for MCU available" #endif diff --git a/uart.h b/uart.h index d27ee3e..c996a6b 100644 --- a/uart.h +++ b/uart.h @@ -226,10 +226,21 @@ were adapted from the Arduino HardwareSerial.h library by Tim Sharpe on /** @brief Macro to flush bytes waiting in receive buffer of USART0 @see uart0_flush */ #define uart_flush() uart0_flush() + +#if defined(__AVR_ATtiny814__) || defined(__AVR_ATtiny1616__) +# define AVR1_USART0 +#endif + + /* ** function prototypes */ +#ifdef __cplusplus +extern "C" { +#endif + + /** @brief Initialize UART and set baudrate @param baudrate Specify baudrate using macro UART_BAUD_SELECT() @@ -433,6 +444,11 @@ extern uint16_t uart3_available(void); /** @brief Flush bytes waiting in receive buffer of USART3 */ extern void uart3_flush(void); +#ifdef __cplusplus +} +#endif + + /**@}*/ #endif // UART_H