diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-07-25 14:55:10 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-07-25 18:13:06 -0400 |
commit | 1487f8a257a7f9c620f163620adf16171581e206 (patch) | |
tree | 7aab4b06fa47c04f5f075e0221197566ccbc7644 /src/stm32f4/gpio.h | |
parent | d501ca6b0b8d58d666cfbee87731e409b55dd902 (diff) | |
download | kutter-1487f8a257a7f9c620f163620adf16171581e206.tar.gz kutter-1487f8a257a7f9c620f163620adf16171581e206.tar.xz kutter-1487f8a257a7f9c620f163620adf16171581e206.zip |
stm32f4: Add support for GPIO
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32f4/gpio.h')
-rw-r--r-- | src/stm32f4/gpio.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/stm32f4/gpio.h b/src/stm32f4/gpio.h new file mode 100644 index 00000000..025b30e1 --- /dev/null +++ b/src/stm32f4/gpio.h @@ -0,0 +1,24 @@ +#ifndef __STM32F4_GPIO_H +#define __STM32F4_GPIO_H + +#include <stdint.h> // uint32_t + +struct gpio_out { + void *regs; + uint32_t bit; +}; +struct gpio_out gpio_out_setup(uint32_t pin, uint32_t val); +void gpio_out_reset(struct gpio_out g, uint32_t val); +void gpio_out_toggle_noirq(struct gpio_out g); +void gpio_out_toggle(struct gpio_out g); +void gpio_out_write(struct gpio_out g, uint32_t val); + +struct gpio_in { + void *regs; + uint32_t bit; +}; +struct gpio_in gpio_in_setup(uint32_t pin, int32_t pull_up); +void gpio_in_reset(struct gpio_in g, int32_t pull_up); +uint8_t gpio_in_read(struct gpio_in g); + +#endif // gpio.h |