diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-08-07 16:50:46 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-08-07 16:50:46 +0200 |
commit | e586c178073b9a0fee90d5fc8e795d266ebd7b7d (patch) | |
tree | ca9a9c40bab37d5af440c80833755223e2bdd946 /spi |
Initial import.
Most sources are split off from suzumebachi project revision 2fc77d2 as is with some path changes. New build rules introduced.
Diffstat (limited to 'spi')
-rw-r--r-- | spi/spi.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spi/spi.h b/spi/spi.h new file mode 100644 index 0000000..9f9cf63 --- /dev/null +++ b/spi/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 |