summaryrefslogtreecommitdiff
path: root/tests/spi-master/hw.h
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2017-03-27 23:20:07 +0000
committerKarl Palsson <karlp@tweak.net.au>2017-03-27 23:20:07 +0000
commitf8d621ec5b7ff6c6d411b93a4b0d322a56827ba0 (patch)
treec82a13f731f2d498a9ba318707f269a452e99bf1 /tests/spi-master/hw.h
parentcb66272d4ebb2e69046d11394bf0924de77c61b3 (diff)
downloadolsndot-f8d621ec5b7ff6c6d411b93a4b0d322a56827ba0.tar.gz
olsndot-f8d621ec5b7ff6c6d411b93a4b0d322a56827ba0.tar.bz2
olsndot-f8d621ec5b7ff6c6d411b93a4b0d322a56827ba0.zip
spi-master: initial busy sending test stub.
Basic framework. now we can build on it.
Diffstat (limited to 'tests/spi-master/hw.h')
-rw-r--r--tests/spi-master/hw.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/spi-master/hw.h b/tests/spi-master/hw.h
new file mode 100644
index 0000000..2cbbea8
--- /dev/null
+++ b/tests/spi-master/hw.h
@@ -0,0 +1,41 @@
+/*
+ * March 2017 Karl Palsson <karlp@tweak.net.au>
+ */
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#pragma once
+
+struct hw_detail
+{
+ uint32_t periph; /* eg: SPI2 */
+ uint32_t periph_rcc; /* eg: RCC_SPI2 */
+ uint32_t periph_rst; /* eg: RST_SPI2 */
+ uint32_t pins; /* to set to the AF for the periph */
+ uint32_t port; /* eg GPIOB */
+ uint32_t port_rcc; /* for the gpio pins */
+ uint32_t trigger_rcc;
+ uint32_t trigger_port;
+ uint32_t trigger_pin;
+};
+
+extern struct hw_detail hw_details;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Expected to setup clocks, turn on all peripherals, and configure
+ * any gpios necessary.
+ * @param hw pointer to hw details necessary
+ */
+ void hw_setup(struct hw_detail* hw);
+
+ /* let devices have a status led */
+ void hw_set_led(bool val);
+
+#ifdef __cplusplus
+}
+#endif