summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2016-08-18 23:32:11 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2016-08-18 23:36:07 +0200
commita6de1f8069e8eec1dead5952f203dc6ed69ecf5a (patch)
tree82c8f0b093d87d6aeee267f3fab6a093de62425e
parent2b4cc4d10dc7f12df6b65035ec1ab4786c43e394 (diff)
STM32L0: Add CRS definition.
-rw-r--r--rcc/crs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/rcc/crs.h b/rcc/crs.h
new file mode 100644
index 0000000..8c1cf68
--- /dev/null
+++ b/rcc/crs.h
@@ -0,0 +1,30 @@
+#ifndef CRS_H
+#define CRS_H
+
+#include <stdint.h>
+
+struct CRS_reg_t {
+ volatile uint32_t CR;
+ volatile uint32_t CFGR;
+ volatile uint32_t ISR;
+ volatile uint32_t ICR;
+};
+
+class CRS_t {
+ public:
+ CRS_reg_t& reg;
+
+ CRS_t(uint32_t reg_addr) : reg(*(CRS_reg_t*)reg_addr) {}
+
+ void enable() {
+ reg.CR |= (1 << 6) | (1 << 5); // AUTOTRIMEN, CEN
+ }
+};
+
+#if defined(STM32L0)
+static CRS_t CRS(0x40006c00);
+#endif
+
+void flash_init();
+
+#endif