summaryrefslogtreecommitdiff
path: root/rcc/crs.h
blob: 8c1cf68e26145dbe20e042e056c9d7b4ddcf5c88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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