summaryrefslogtreecommitdiff
path: root/stm32.h
diff options
context:
space:
mode:
Diffstat (limited to 'stm32.h')
-rw-r--r--stm32.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/stm32.h b/stm32.h
new file mode 100644
index 0000000..9b8ec59
--- /dev/null
+++ b/stm32.h
@@ -0,0 +1,47 @@
+#ifndef STM32_H
+#define STM32_H
+
+#include <stdint.h>
+
+struct RCC_t {
+ volatile uint32_t CR;
+ volatile uint32_t CFGR;
+ volatile uint32_t CIR;
+ volatile uint32_t APB2RSTR;
+ volatile uint32_t APB1RSTR;
+ volatile uint32_t AHBENR;
+ volatile uint32_t APB2ENR;
+ volatile uint32_t APB1ENR;
+ volatile uint32_t BDCR;
+ volatile uint32_t CSR;
+};
+
+static RCC_t& RCC = *(RCC_t*)0x40021000;
+
+struct FLASH_t {
+ volatile uint32_t ACR;
+ volatile uint32_t KEYR;
+ volatile uint32_t OPTKEYR;
+ volatile uint32_t SR;
+ volatile uint32_t CR;
+ volatile uint32_t AR;
+ volatile uint32_t RESERVED;
+ volatile uint32_t OBR;
+ volatile uint32_t WRPR;
+};
+
+static FLASH_t& FLASH = *(FLASH_t*)0x40022000;
+
+struct GPIO_t {
+ volatile uint32_t CRL;
+ volatile uint32_t CRH;
+ volatile uint32_t IDR;
+ volatile uint32_t ODR;
+ volatile uint32_t BSRR;
+ volatile uint32_t BRR;
+ volatile uint32_t LCKR;
+};
+
+static GPIO_t& GPIOA = *(GPIO_t*)0x40010800;
+
+#endif