summaryrefslogtreecommitdiff
path: root/src/spi_init.h
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2017-05-03 22:49:09 +0100
committerVasil Zlatanov <v@skozl.com>2017-05-03 22:49:09 +0100
commit8f5d8626ff7be8237e227d18f8151a8ad1f72f43 (patch)
tree545b798748055e1dc95429cafa378f22117ab21a /src/spi_init.h
parented42bbde1941d4121a1095d35e056a1c33cd0775 (diff)
downloade2-switch-8f5d8626ff7be8237e227d18f8151a8ad1f72f43.tar.gz
e2-switch-8f5d8626ff7be8237e227d18f8151a8ad1f72f43.tar.bz2
e2-switch-8f5d8626ff7be8237e227d18f8151a8ad1f72f43.zip
Add SPI initialasation class
Diffstat (limited to 'src/spi_init.h')
-rw-r--r--src/spi_init.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/spi_init.h b/src/spi_init.h
new file mode 100644
index 0000000..e87568a
--- /dev/null
+++ b/src/spi_init.h
@@ -0,0 +1,14 @@
+#define D_MOSI_PIN p5
+#define D_CLK_PIN p7
+#define D_DC_PIN p8
+#define D_RST_PIN p9
+#define D_CS_PIN p10
+
+//an SPI sub-class that sets up format and clock speed
+class SPInit:public SPI {
+public:
+ SPInit(PinName mosi, PinName miso, PinName clk):SPI(mosi, miso, clk) {
+ format(8, 3);
+ frequency(2000000);
+ };
+};