X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/1c407b9669c0658ee9eb8b188818135ea04215e4..3a03da970558de9211fc1a43b12bf69e38854d09:/Projects/XPLAINBridge/Lib/SoftUART.h diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h index a685a6d8f..923631b50 100644 --- a/Projects/XPLAINBridge/Lib/SoftUART.h +++ b/Projects/XPLAINBridge/Lib/SoftUART.h @@ -30,6 +30,11 @@ this software. */ +/** \file + * + * Header file for SoftUART.c. + */ + #ifndef _SOFT_UART_ #define _SOFT_UART_ @@ -42,9 +47,6 @@ #include "LightweightRingBuff.h" /* Macros: */ - #define BAUD 9600 - #define BIT_TIME ((F_CPU + (BAUD / 2)) / BAUD) - #define SRX PD0 #define SRXPIN PIND #define SRXPORT PORTD @@ -53,7 +55,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); + + ICR1 = BitTime; + ICR3 = BitTime; + } + /* Function Prototypes: */ - void SoftUART_Init(void); + void SoftUART_Init(void); #endif \ No newline at end of file