X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f64e3db07ac167bf0b64bf429a53721f1848e91d..6bda628718f67c04ed43e8328f55bdce5319c504:/Projects/XPLAINBridge/Lib/SoftUART.h diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h index a9401da10..7203b3a0d 100644 --- a/Projects/XPLAINBridge/Lib/SoftUART.h +++ b/Projects/XPLAINBridge/Lib/SoftUART.h @@ -42,9 +42,6 @@ #include "LightweightRingBuff.h" /* Macros: */ - #define BAUD 9600 - #define BIT_TIME (uint16_t)((F_CPU + (BAUD / 2.0f)) / BAUD) - #define SRX PD0 #define SRXPIN PIND #define SRXPORT PORTD @@ -53,7 +50,16 @@ #define STXPORT PORTD #define STXDDR DDRD + /* Inline Functions: */ + static inline void SoftUART_SetBaud(const uint32_t Baud) + { + uint16_t BitTime = ((F_CPU / Baud) - 1); + + OCR1A = BitTime; + OCR3A = BitTime; + } + /* Function Prototypes: */ - void SoftUART_Init(void); + void SoftUART_Init(void); #endif \ No newline at end of file