diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2016-08-18 23:32:11 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2016-08-18 23:32:11 +0200 |
commit | 6ba3f13d6523d443f91a8dae52855a856101f729 (patch) | |
tree | 0243205fe0f0fbeb369289d71d9c2e57c77f18a7 | |
parent | fec817033faed408dbd84dac19c51c0ef6b5301a (diff) |
STM32L0: Add CRS definition.
-rw-r--r-- | rcc/crs.h | 30 |
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 |