Commit graph

7 commits

Author SHA1 Message Date
Marti Bolivar 15b8a03de9 HardwareSerial: make read() block until data arrive.
This makes the HardwareSerial behavior match that of SerialUSB, and
should help avoid confusion.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-07-31 16:49:00 -04:00
Marti Bolivar 4f4b601504 HardwareSerial.cpp: Fix "#warn" -> "#warning".
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07 03:38:29 -04:00
Marti Bolivar 97b01c0b98 Globally switch style for GPIO config routines.
Stupidly, spi_gpio_cfg() didn't take a spi_dev* argument on F1,
because it doesn't matter there. On F2, where we need to set an
alternate function when configuring GPIOs for SPI, we need to know the
dev.

We can't add break backwards compatibility, so we need a new
function. However, we've since added a bunch of foo_gpio_cfg()
routines, and we don't want confusing asymmetry in the names. So a
global style change is needed. (Fortunately, the new functions weren't
part of a release, so it's no problem to change their names).

Change all foo_gpio_cfg() routines to foo_config_gpios() (or
foo_config_gpio(), if there's only one GPIO to configure). For
backwards compatibility, make spi_gpio_cfg() on F1 an __always_inline
call to spi_config_gpios().

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-03 02:15:22 -04:00
Marti Bolivar ec5a2f8309 Oops; don't break the build on F1.
That was dumb.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-02 19:39:47 -04:00
Marti Bolivar d2c4bd6564 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>
2012-06-01 01:28:51 -04:00
Marti Bolivar 306e19cb9f Fix a bunch of Doxygen file-level comments.
Fix @file in many places. Also fix up the descriptions where it's
appropriate. This standardizes the @file formatting across the library
to explicitly include any parent directories up to the repository
root.

Besides being nice, this will hopefully let us manage Doxygen's XML
output so as to make extracting series-specific pieces via Breathe in
the leaflabs-docs repo possible.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-05-08 16:22:41 -04:00
Marti Bolivar 4b826727d0 Move wirish/comm/*.cpp into wirish.
The wirish/comm/ directory is stupid.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11 16:56:50 -04:00
Renamed from wirish/comm/HardwareSerial.cpp (Browse further)