summaryrefslogtreecommitdiff
path: root/hal
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-04-22 23:19:58 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-04-22 23:19:58 +0200
commit63a58dcd75b7fb553dc79539da7582c2f521dbbb (patch)
treed390e8424e5ae676cd78d1a2c38f41b59598b29c /hal
parentf3b6264feb44628f837552e78102e82d8c986bd0 (diff)
Added SPI registers.
Diffstat (limited to 'hal')
-rw-r--r--hal/spi.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/hal/spi.h b/hal/spi.h
new file mode 100644
index 0000000..9f9cf63
--- /dev/null
+++ b/hal/spi.h
@@ -0,0 +1,31 @@
+#ifndef SPI_H
+#define SPI_H
+
+struct SPI_reg_t {
+ volatile uint32_t CR1;
+ volatile uint32_t CR2;
+ volatile uint32_t SR;
+ volatile uint32_t DR;
+ volatile uint32_t CRCPR;
+ volatile uint32_t RXCRCR;
+ volatile uint32_t TXCRCR;
+ volatile uint32_t I2SCFGR;
+ volatile uint32_t I2SPR;
+};
+
+class SPI_t {
+ public:
+ SPI_reg_t& reg;
+
+ SPI_t(uint32_t reg_addr) : reg(*(SPI_reg_t*)reg_addr) {}
+};
+
+#if defined(STM32F1)
+
+#elif defined(STM32F4)
+static SPI_t SPI1(0x40013000);
+static SPI_t SPI2(0x40003800);
+static SPI_t SPI3(0x40003c00);
+#endif
+
+#endif