aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/AVR/serial_lld.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-02-04 14:39:58 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-02-04 14:39:58 +0000
commit3268a6c4ab856a026a7ab659d036a5a7ef642089 (patch)
tree6a5f87bbfda24d9639a9563ed8dd89e566af05c3 /os/hal/platforms/AVR/serial_lld.h
parent3cf38d95f52d00e39548e7ef82af42919b82eaf8 (diff)
downloadChibiOS-3268a6c4ab856a026a7ab659d036a5a7ef642089.tar.gz
ChibiOS-3268a6c4ab856a026a7ab659d036a5a7ef642089.tar.bz2
ChibiOS-3268a6c4ab856a026a7ab659d036a5a7ef642089.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3914 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/AVR/serial_lld.h')
-rw-r--r--os/hal/platforms/AVR/serial_lld.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/os/hal/platforms/AVR/serial_lld.h b/os/hal/platforms/AVR/serial_lld.h
index c383b6c70..bcaea51c1 100644
--- a/os/hal/platforms/AVR/serial_lld.h
+++ b/os/hal/platforms/AVR/serial_lld.h
@@ -106,7 +106,27 @@ typedef struct {
* @brief Macro for baud rate computation.
* @note Make sure the final baud rate is within tolerance.
*/
-#define UBRR(b) (((F_CPU / b) >> 4) - 1)
+#define UBRR(b) (((F_CPU / b) >> 4) - 1)
+
+/**
+ * @brief Macro for baud rate computationwhen U2Xn == 1.
+ * @note Make sure the final baud rate is within tolerance.
+ */
+#define UBRR2(b) (((F_CPU / b) >> 3) - 1)
+
+/**
+* @brief Macro for baud rate computation.
+* @note Make sure the final baud rate is within tolerance.
+* @note This version uses floating point math for greater accuracy.
+*/
+#define UBRR_F(b) ((((double) F_CPU / (double) b) / 16.0) - 0.5)
+
+/**
+* @brief Macro for baud rate computation when U2Xn == 1.
+* @note Make sure the final baud rate is within tolerance.
+* @note This version uses floating point math for greater accuracy.
+*/
+#define UBRR2_F(b) ((((double) F_CPU / (double) b) / 8.0) - 0.5)
/*===========================================================================*/
/* External declarations. */