X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/9c037a952f5aaf78c4e13398506cfa2d588bb449..83e293a6ec98c7faad1b76dd312b31b86cbeecc1:/Projects/XPLAINBridge/Lib/SoftUART.h?ds=sidebyside diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h index 416490d8d..d0b03c04b 100644 --- a/Projects/XPLAINBridge/Lib/SoftUART.h +++ b/Projects/XPLAINBridge/Lib/SoftUART.h @@ -37,11 +37,11 @@ #include #include #include + + #include "../XPLAINBridge.h" + #include "LightweightRingBuff.h" /* Macros: */ - #define BAUD 9600 - #define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2)) / BAUD) - #define SRX PD0 #define SRXPIN PIND #define SRXPORT PORTD @@ -50,24 +50,16 @@ #define STXPORT PORTD #define STXDDR DDRD - /* External Variables: */ - extern volatile bool srx_done; - extern volatile uint8_t stx_count; - - /* Inline Functions: */ - static inline bool SoftUART_IsReady(void) - { - return !(stx_count); - } - - static inline bool SoftUART_IsReceived(void) + /* Inline Functions: */ + static inline void SoftUART_SetBaud(const uint32_t Baud) { - return srx_done; + uint16_t BitTime = ((F_CPU / Baud) - 1); + + OCR1A = BitTime; + OCR3A = BitTime; } /* Function Prototypes: */ - void SoftUART_TxByte(uint8_t c); - uint8_t SoftUART_RxByte(void); void SoftUART_Init(void); #endif \ No newline at end of file