aboutsummaryrefslogtreecommitdiff
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-01 01:10:47 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-01 01:28:51 -0400
commitd2c4bd65649d22fce225a68ba3f0c2775ac49964 (patch)
tree84cd29e2f201fbd6bbac753027c146061e0f05e4 /libmaple
parent0762f471ddc4c7a2759e6fac748ad55349885de5 (diff)
Bring back HardwareSerial.
To make this happen, we need to have <board/board.h> tell us whether or not it's got each of the USARTs. Do that with BOARD_HAVE_USARTn, for n = 1,...,6. This lets us define HardwareSerial instances only when appropriate, and gets rid of some board-specific hacks we'd accumulated. The new <libmaple/usart.h> now has a convenience function for determining the bus rate by using the appropriate STM32_PCLKx macro, so we can shave a uint32 per instance, which is nice given that they're all going to be in memory. This changes the constructor arguments, but the API only specifies the semantics of the predefined instances, so this is still backwards-compatible. (We should look into storing the instances in Flash -- they don't change, after all.) We don't actually need struct usart_dev's definition in HardwareSerial.h, so replace it with a forward declaration and include <libmaple/usart.h> it in HardwareSerial.cpp instead. Assert some copyrights. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/include/libmaple/usart.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libmaple/include/libmaple/usart.h b/libmaple/include/libmaple/usart.h
index ad7eb51..293d59e 100644
--- a/libmaple/include/libmaple/usart.h
+++ b/libmaple/include/libmaple/usart.h
@@ -395,6 +395,7 @@ typedef struct usart_dev {
void usart_init(usart_dev *dev);
+/* FIXME document this function */
struct gpio_dev; /* forward declaration */
void usart_async_gpio_cfg(usart_dev *udev,
struct gpio_dev *rx_dev, uint8 rx,