aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32/f1
diff options
context:
space:
mode:
authorUwe Hermann2011-11-17 00:07:53 +0100
committerUwe Hermann2011-11-17 00:12:47 +0100
commit608ca2a81196ac175a8f850d21998c56d99e976a (patch)
tree6be4aefdfe734a5a7ccbd5012e2da23a9faba94e /lib/stm32/f1
parent373794ab68ffdeade799becd12a58abb42e8f2ea (diff)
stm32/f1/gpio.c: Add some Doxygen comments.
Diffstat (limited to 'lib/stm32/f1')
-rw-r--r--lib/stm32/f1/gpio.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/stm32/f1/gpio.c b/lib/stm32/f1/gpio.c
index 347e800..f6f3da6 100644
--- a/lib/stm32/f1/gpio.c
+++ b/lib/stm32/f1/gpio.c
@@ -73,11 +73,25 @@ void gpio_set_mode(u32 gpioport, u8 mode, u8 cnf, u16 gpios)
GPIO_CRH(gpioport) = crh;
}
+/**
+ * Set one or more pins of the given GPIO port to 1.
+ *
+ * @param gpioport The GPIO port to use (GPIOA - GPIOG).
+ * @param gpios The GPIO pin(s) to set to 1 (GPIO0 - GPIO15, or GPIO_ALL).
+ * If multiple pins shall be set, use '|' to separate them.
+ */
void gpio_set(u32 gpioport, u16 gpios)
{
GPIO_BSRR(gpioport) = gpios;
}
+/**
+ * Clear one or more pins of the given GPIO port to 0.
+ *
+ * @param gpioport The GPIO port to use (GPIOA - GPIOG).
+ * @param gpios The GPIO pin(s) to set to 0 (GPIO0 - GPIO15, or GPIO_ALL).
+ * If multiple pins shall be cleared, use '|' to separate them.
+ */
void gpio_clear(u32 gpioport, u16 gpios)
{
GPIO_BRR(gpioport) = gpios;
@@ -88,16 +102,35 @@ u16 gpio_get(u32 gpioport, u16 gpios)
return gpio_port_read(gpioport) & gpios;
}
+/**
+ * Toggle one or more pins of the given GPIO port.
+ *
+ * @param gpioport The GPIO port to use (GPIOA - GPIOG).
+ * @param gpios The GPIO pin(s) to toggle (GPIO0 - GPIO15, or GPIO_ALL).
+ * If multiple pins shall be toggled, use '|' to separate them.
+ */
void gpio_toggle(u32 gpioport, u16 gpios)
{
GPIO_ODR(gpioport) ^= gpios;
}
+/**
+ * Read the current value of the given GPIO port.
+ *
+ * @param gpioport The GPIO port to read (GPIOA - GPIOG).
+ * @return The value of the current GPIO port.
+ */
u16 gpio_port_read(u32 gpioport)
{
return (u16)GPIO_IDR(gpioport);
}
+/**
+ * Write to the given GPIO port.
+ *
+ * @param gpioport The GPIO port to write to (GPIOA - GPIOG).
+ * @param data The data to write to the specified GPIO port.
+ */
void gpio_port_write(u32 gpioport, u16 data)
{
GPIO_ODR(gpioport) = data;