diff options
author | Karel Kočí <cynerd@email.cz> | 2015-10-17 15:40:51 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-10-17 15:40:51 +0200 |
commit | b0d8f22f3492fbb3f6dc0e8026e63c803af59007 (patch) | |
tree | eb9707612e87856962474885f2a18ae1621d214e /usart.h | |
parent | 8fa9db4244f4ee33aa47561c569edfa62fe37928 (diff) | |
download | avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.gz avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.tar.bz2 avr-ioe-b0d8f22f3492fbb3f6dc0e8026e63c803af59007.zip |
Complete commit of current work
Diffstat (limited to 'usart.h')
-rw-r--r-- | usart.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -4,10 +4,12 @@ #include <stdio.h> #include "mcu/mcu_def.h" +#include "tasks.h" #include "buffers.h" #ifndef _IOE_USART_H_ #define _IOE_USART_H_ +#ifdef CONFIG_IOE_USART #ifndef MCUSUPPORT_USART #error "No USART interface is known on your mcu." @@ -28,6 +30,8 @@ volatile IOEBUFFER(_ioe_usart_inbuffer, CONFIG_IOE_USART_INBUFFER_SIZE); volatile IOEBUFFER(_ioe_usart_outbuffer, CONFIG_IOE_USART_OUTBUFFER_SIZE); #endif +extern volatile int8_t _usart_busy; + /* * Initialize USART device. @@ -40,8 +44,12 @@ void usart_send_str(char *str); #ifdef _IOE_USART_INBUFFER uint8_t usart_get(void); #endif -uint8_t usart_queryerror(void); -int8_t usart_busy(void); +static inline uint8_t usart_queryerror(void) { + return UCSR0A & (_BV(FE0) | _BV(DOR0) | _BV(UPE0)); +} +static inline int8_t usart_busy(void) { + return _usart_busy; +} #ifdef _IOE_USART_INBUFFER uint8_t usart_inbuffered(void); #endif @@ -56,4 +64,5 @@ FILE *usart_async_open(void); extern void (*usart_receive)(uint8_t data); extern void (*usart_sent)(void); +#endif /* CONFIG_IOE_USART */ #endif /* _IOE_USART_H_ */ |