From 608ca2a81196ac175a8f850d21998c56d99e976a Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 17 Nov 2011 00:07:53 +0100 Subject: stm32/f1/gpio.c: Add some Doxygen comments. --- lib/stm32/f1/gpio.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'lib/stm32/f1') 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; -- cgit v1.2.3