aboutsummaryrefslogtreecommitdiff
path: root/Projects/XPLAINBridge/Lib/SoftUART.h
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-07-15 11:01:31 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-07-15 11:01:31 +0000
commitfafe59ee089f579e66e6e740b791120fcba265d1 (patch)
treefa40f50761a29781d5d3b6e3b94a784a18a19bc2 /Projects/XPLAINBridge/Lib/SoftUART.h
parent79ee5516459e285d3512648a262a289ddcac2056 (diff)
Added ability to set the serial baud rate via the user's terminal in the XPLAINBridge project.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1390 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Projects/XPLAINBridge/Lib/SoftUART.h')
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h
index a107d48a..d0b03c04 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 ((F_CPU / BAUD) - 1)
-
#define SRX PD0
#define SRXPIN PIND
#define SRXPORT PORTD
@@ -53,6 +50,15 @@
#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);