summaryrefslogtreecommitdiffstats
path: root/app/pins.h
diff options
context:
space:
mode:
authorroot <root@lab.panaceas.james.local>2018-04-08 01:14:30 +0100
committerroot <root@lab.panaceas.james.local>2018-04-08 01:14:30 +0100
commit25e6afd831b94b9735cc6691ee19c8edc921aca7 (patch)
treecc194e7cb067c929b3e8bc9c03552d2d300c301b /app/pins.h
downloadclock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.gz
clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.bz2
clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.zip
working decoding
Diffstat (limited to 'app/pins.h')
-rw-r--r--app/pins.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/pins.h b/app/pins.h
new file mode 100644
index 0000000..16da24c
--- /dev/null
+++ b/app/pins.h
@@ -0,0 +1,46 @@
+
+
+#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_OD(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_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)