aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/gpio.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-05-18 21:48:23 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-05-19 18:45:45 -0400
commitc78bb9dbc6d2b5a9136ecd35a1f45f2a00145c65 (patch)
treeaca22ee28df7f9a7f45f2f537de4cb7d5370fd34 /libmaple/gpio.c
parent639149a8abbe3c41e62cb3986f5df8509209ca2f (diff)
downloadlibrambutan-c78bb9dbc6d2b5a9136ecd35a1f45f2a00145c65.tar.gz
librambutan-c78bb9dbc6d2b5a9136ecd35a1f45f2a00145c65.zip
gpio: Renaming for consistency.
Gave the anonymous enum typedefed to afio_exti_num the same name; renamed AFIORemapPeripheral afio_remap_peripheral.
Diffstat (limited to 'libmaple/gpio.c')
-rw-r--r--libmaple/gpio.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/libmaple/gpio.c b/libmaple/gpio.c
index c250f68..2c58cc2 100644
--- a/libmaple/gpio.c
+++ b/libmaple/gpio.c
@@ -145,7 +145,7 @@ void gpio_set_mode(gpio_dev *dev, uint8 pin, gpio_pin_mode mode) {
*/
/**
- * Initialize the AFIO clock, and reset the AFIO registers.
+ * @brief Initialize the AFIO clock, and reset the AFIO registers.
*/
void afio_init(void) {
rcc_clk_enable(RCC_AFIO);
@@ -155,15 +155,12 @@ void afio_init(void) {
#define AFIO_EXTI_SEL_MASK 0xF
/**
- * Select a source input for an external interrupt.
+ * @brief Select a source input for an external interrupt.
*
- * @param exti External interrupt. One of: AFIO_EXTI_0,
- * AFIO_EXTI_1, ..., AFIO_EXTI_15.
+ * @param exti External interrupt.
* @param gpio_port Port which contains pin to use as source input.
- * One of: AFIO_EXTI_PA, AFIO_EXTI_PB, AFIO_EXTI_PC,
- * AFIO_EXTI_PD, and, on high density devices,
- * AFIO_EXTI_PE, AFIO_EXTI_PF, AFIO_EXTI_PG.
- * @see exti_port
+ * @see afio_exti_num
+ * @see afio_exti_port
*/
void afio_exti_select(afio_exti_num exti, afio_exti_port gpio_port) {
__io uint32 *exti_cr = &AFIO_BASE->EXTICR1 + exti / 4;
@@ -176,15 +173,14 @@ void afio_exti_select(afio_exti_num exti, afio_exti_port gpio_port) {
}
/**
- * @brief Remap an alternate function peripheral to a different pin
- * mapping
- * @param peripheral to remap
+ * @brief Perform an alternate function remap.
+ * @param remapping Remapping to perform.
*/
-void afio_remap(AFIORemapPeripheral p) {
- if (p & AFIO_REMAP_USE_MAPR2) {
- p &= ~AFIO_REMAP_USE_MAPR2;
- AFIO_BASE->MAPR2 |= p;
+void afio_remap(afio_remap_peripheral remapping) {
+ if (remapping & AFIO_REMAP_USE_MAPR2) {
+ remapping &= ~AFIO_REMAP_USE_MAPR2;
+ AFIO_BASE->MAPR2 |= remapping;
} else {
- AFIO_BASE->MAPR |= p;
+ AFIO_BASE->MAPR |= remapping;
}
}