aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-03 02:11:07 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-03 02:15:22 -0400
commitf5c37f28fd9be3bd8e2c7159a09891d5e571bc43 (patch)
tree5a1fdc7cc45a8583df6a4b7b3412a25cfd180d23 /libmaple/include
parentff56b76d41a390ed193da180316690f6e2dcbb75 (diff)
downloadlibrambutan-f5c37f28fd9be3bd8e2c7159a09891d5e571bc43.tar.gz
librambutan-f5c37f28fd9be3bd8e2c7159a09891d5e571bc43.zip
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>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/adc.h6
-rw-r--r--libmaple/include/libmaple/spi.h15
-rw-r--r--libmaple/include/libmaple/usart.h19
3 files changed, 27 insertions, 13 deletions
diff --git a/libmaple/include/libmaple/adc.h b/libmaple/include/libmaple/adc.h
index ff9a5e4..a500af7 100644
--- a/libmaple/include/libmaple/adc.h
+++ b/libmaple/include/libmaple/adc.h
@@ -262,10 +262,14 @@ extern void adc_foreach(void (*fn)(const adc_dev*));
struct gpio_dev;
/**
* @brief Configure a GPIO pin for ADC conversion.
+ * @param dev ADC device to use for conversion (currently ignored on
+ * all targets).
* @param gdev GPIO device to configure.
* @param bit Bit on gdev to configure for ADC conversion.
*/
-extern void adc_gpio_cfg(struct gpio_dev *gdev, uint8 bit);
+extern void adc_config_gpio(const struct adc_dev *dev,
+ struct gpio_dev *gdev,
+ uint8 bit);
/**
* @brief Enable an ADC and configure it for single conversion mode.
diff --git a/libmaple/include/libmaple/spi.h b/libmaple/include/libmaple/spi.h
index 3805b2e..90e2036 100644
--- a/libmaple/include/libmaple/spi.h
+++ b/libmaple/include/libmaple/spi.h
@@ -224,13 +224,14 @@ struct gpio_dev;
* @param miso_bit MISO pin's GPIO bit on comm_dev
* @param mosi_bit MOSI pin's GPIO bit on comm_dev
*/
-void spi_gpio_cfg(uint8 as_master,
- struct gpio_dev *nss_dev,
- uint8 nss_bit,
- struct gpio_dev *comm_dev,
- uint8 sck_bit,
- uint8 miso_bit,
- uint8 mosi_bit);
+extern void spi_config_gpios(spi_dev *dev,
+ uint8 as_master,
+ struct gpio_dev *nss_dev,
+ uint8 nss_bit,
+ struct gpio_dev *comm_dev,
+ uint8 sck_bit,
+ uint8 miso_bit,
+ uint8 mosi_bit);
/**
* @brief SPI mode configuration.
diff --git a/libmaple/include/libmaple/usart.h b/libmaple/include/libmaple/usart.h
index 293d59e..26a64d3 100644
--- a/libmaple/include/libmaple/usart.h
+++ b/libmaple/include/libmaple/usart.h
@@ -395,12 +395,21 @@ 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,
- struct gpio_dev *tx_dev, uint8 tx,
- unsigned flags);
+/* FIXME [PRE 0.0.13] decide if flags are necessary */
+/**
+ * @brief Configure GPIOs for use as USART TX/RX.
+ * @param udev USART device to use
+ * @param rx_dev RX pin gpio_dev
+ * @param rx RX pin bit on rx_dev
+ * @param tx_dev TX pin gpio_dev
+ * @param tx TX pin bit on tx_dev
+ * @param flags Currently ignored
+ */
+extern void usart_config_gpios_async(usart_dev *udev,
+ struct gpio_dev *rx_dev, uint8 rx,
+ struct gpio_dev *tx_dev, uint8 tx,
+ unsigned flags);
#define USART_USE_PCLK 0
void usart_set_baud_rate(usart_dev *dev, uint32 clock_speed, uint32 baud);