aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f4/internal.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-07-23 23:51:31 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-07-25 18:08:28 -0400
commitd501ca6b0b8d58d666cfbee87731e409b55dd902 (patch)
tree1ec67bf43d27fd64e7e8c801cb07961eadc6ee4a /src/stm32f4/internal.h
parent5a02572001d1d903bdb36c13396efe73f3835a67 (diff)
downloadkutter-d501ca6b0b8d58d666cfbee87731e409b55dd902.tar.gz
kutter-d501ca6b0b8d58d666cfbee87731e409b55dd902.tar.xz
kutter-d501ca6b0b8d58d666cfbee87731e409b55dd902.zip
stm32f4: Add initial support for STM32F446 chip
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32f4/internal.h')
-rw-r--r--src/stm32f4/internal.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/stm32f4/internal.h b/src/stm32f4/internal.h
new file mode 100644
index 00000000..0cfb2664
--- /dev/null
+++ b/src/stm32f4/internal.h
@@ -0,0 +1,21 @@
+#ifndef __STM32F4_INTERNAL_H
+#define __STM32F4_INTERNAL_H
+// Local definitions for STM32F4 code
+
+#include "stm32f4xx.h"
+
+#define GPIO(PORT, NUM) (((PORT)-'A') * 16 + (NUM))
+#define GPIO2PORT(PIN) ((PIN) / 16)
+#define GPIO2BIT(PIN) (1<<((PIN) % 16))
+
+#define GPIO_INPUT 0
+#define GPIO_OUTPUT 1
+#define GPIO_FUNCTION 2
+#define GPIO_ANALOG 3
+
+void enable_pclock(uint32_t periph_base);
+uint32_t get_pclock_frequency(uint32_t periph_base);
+void clock_setup(void);
+void gpio_peripheral(uint32_t gpio, uint32_t mode, uint32_t func, int pullup);
+
+#endif // internal.h