aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/gpio.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-07-28 23:15:54 -0400
committerKevinOConnor <kevin@koconnor.net>2019-08-05 11:25:40 -0400
commit8b9cc62359057a686929cc713ffe2931e2203946 (patch)
treeab2e5469d7919cc6ed652e2928f0eaf9a24420c3 /src/stm32/gpio.h
parentec3d865b517affd77678e5b1a45ef4691619726d (diff)
downloadkutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.gz
kutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.xz
kutter-8b9cc62359057a686929cc713ffe2931e2203946.zip
stm32: Rename stm32f4/ directory to stm32/
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4 chips, rename the directory to just "stm32". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/gpio.h')
-rw-r--r--src/stm32/gpio.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/stm32/gpio.h b/src/stm32/gpio.h
new file mode 100644
index 00000000..c7602504
--- /dev/null
+++ b/src/stm32/gpio.h
@@ -0,0 +1,41 @@
+#ifndef __STM32_GPIO_H
+#define __STM32_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);
+
+struct gpio_adc {
+ uint32_t chan;
+};
+struct gpio_adc gpio_adc_setup(uint32_t pin);
+uint32_t gpio_adc_sample(struct gpio_adc g);
+uint16_t gpio_adc_read(struct gpio_adc g);
+void gpio_adc_cancel_sample(struct gpio_adc g);
+
+struct spi_config {
+ void *spidev;
+ uint32_t spi_cr1;
+};
+struct spi_config spi_setup(uint32_t bus, uint8_t mode, uint32_t rate);
+void spi_prepare(struct spi_config config);
+void spi_transfer(struct spi_config config, uint8_t receive_data
+ , uint8_t len, uint8_t *data);
+
+#endif // gpio.h