From a6de1f8069e8eec1dead5952f203dc6ed69ecf5a Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Thu, 18 Aug 2016 23:32:11 +0200 Subject: STM32L0: Add CRS definition. --- rcc/crs.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 rcc/crs.h 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 + +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 -- cgit v1.2.3