Numworks Epsilon  1.4.1
Graphing Calculator Operating System
syscfg.h
Go to the documentation of this file.
1 #ifndef REGS_SYSCFG_H
2 #define REGS_SYSCFG_H
3 
4 #include "register.h"
5 
6 #include "gpio.h"
7 
8 class SYSCFG {
9 public:
10  class MEMRMP : Register32 {
11  public:
12  enum class MemMode {
13  MainFlashmemory = 0,
15  EmbeddedSRAM = 3
16  };
17  REGS_FIELD(MEM_MODE, MemMode, 1, 0);
18  };
19  class EXTICR1 : Register32 {
20  public:
21  void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*index+3, 4*index, (uint32_t)gpio); }
22  };
23  class EXTICR2 : Register32 {
24  public:
25  void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*(index-4)+3, 4*(index-4), (uint32_t)gpio); }
26  };
27  class EXTICR3 : Register32 {
28  public:
29  void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*(index-8)+3, 4*(index-8), (uint32_t)gpio); }
30  };
31  constexpr SYSCFG() {};
32  REGS_REGISTER_AT(MEMRMP, 0x00);
33  REGS_REGISTER_AT(EXTICR1, 0x08);
34  REGS_REGISTER_AT(EXTICR2, 0x0C);
35  REGS_REGISTER_AT(EXTICR3, 0x10);
36 private:
37  constexpr uint32_t Base() const {
38  return 0x40013800;
39  }
40 };
41 
42 constexpr SYSCFG SYSCFG;
43 
44 #endif
Definition: gpio.h:6
constexpr SYSCFG SYSCFG
Definition: syscfg.h:42
REGS_FIELD(MEM_MODE, MemMode, 1, 0)
Definition: syscfg.h:8
unsigned int uint32_t
Definition: stdint.h:6
REGS_REGISTER_AT(MEMRMP, 0x00)
void setEXTI(int index, GPIO gpio) volatile
Definition: syscfg.h:21
void setEXTI(int index, GPIO gpio) volatile
Definition: syscfg.h:29
void setBitRange(uint8_t high, uint8_t low, T value) volatile
Definition: register.h:21
void setEXTI(int index, GPIO gpio) volatile
Definition: syscfg.h:25
constexpr SYSCFG()
Definition: syscfg.h:31