summaryrefslogtreecommitdiffstats
path: root/boot/pins.h
diff options
context:
space:
mode:
authorroot <root@lab.ourano.james.local>2021-02-26 12:12:38 +0000
committerroot <root@lab.ourano.james.local>2021-02-26 12:12:38 +0000
commit3d48137c00511b3f2d35511482d1a76f8d06382d (patch)
treed75c88220cc847007869b0795a240c5077948262 /boot/pins.h
parent6d3a824e1cdae6e28146b7de380724b49488f3c2 (diff)
downloadclock-3d48137c00511b3f2d35511482d1a76f8d06382d.tar.gz
clock-3d48137c00511b3f2d35511482d1a76f8d06382d.tar.bz2
clock-3d48137c00511b3f2d35511482d1a76f8d06382d.zip
works
Diffstat (limited to 'boot/pins.h')
-rw-r--r--boot/pins.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/boot/pins.h b/boot/pins.h
new file mode 100644
index 0000000..723ca82
--- /dev/null
+++ b/boot/pins.h
@@ -0,0 +1,55 @@
+
+#define MAP_AF_100(a, af) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_100MHZ, a); \
+ gpio_set_af( a ## _PORT, af, a); \
+ } while (0)
+
+#define MAP_AF(a, af) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
+ gpio_set_af( a ## _PORT, af, a); \
+ } while (0)
+
+#define MAP_AF_PU(a, af) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
+ gpio_set_af( a ## _PORT, af, a); \
+ } while (0)
+
+#define MAP_AF_OD(a, af) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, a); \
+ gpio_set_af( a ## _PORT, af, a); \
+ } while (0)
+
+
+#define MAP_OUTPUT_PP(a) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
+ } while (0)
+
+#define MAP_OUTPUT_PP_PU(a) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
+ } while (0)
+
+#define MAP_OUTPUT_OD(a) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, a ); \
+ gpio_set_output_options( a ## _PORT, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, a); \
+ } while (0)
+
+
+#define MAP_INPUT_PU(a) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, a ); \
+ } while (0)
+
+
+#define MAP_INPUT(a) do { \
+ gpio_mode_setup( a ## _PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, a ); \
+ } while (0)
+
+
+#define CLEAR(a) gpio_clear( a ## _PORT, a)
+#define SET(a) gpio_set( a ## _PORT, a)
+#define GET(a) gpio_get( a ## _PORT, a)