Blame view

build6/epsilon-master/ion/src/device/regs/syscfg.h 1.01 KB
6663b6c9   adorian   projet complet av...
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  #ifndef REGS_SYSCFG_H
  #define REGS_SYSCFG_H
  
  #include "register.h"
  
  #include "gpio.h"
  
  class SYSCFG {
  public:
    class MEMRMP : Register32 {
    public:
      enum class MemMode {
        MainFlashmemory = 0,
        SystemFlashmemory = 1,
        EmbeddedSRAM = 3
      };
      REGS_FIELD(MEM_MODE, MemMode, 1, 0);
    };
    class EXTICR1 : Register32 {
    public:
      void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*index+3, 4*index, (uint32_t)gpio); }
    };
    class EXTICR2 : Register32 {
    public:
      void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*(index-4)+3, 4*(index-4), (uint32_t)gpio); }
    };
    class EXTICR3 : Register32 {
    public:
      void setEXTI(int index, GPIO gpio) volatile { setBitRange(4*(index-8)+3, 4*(index-8), (uint32_t)gpio); }
    };
    constexpr SYSCFG() {};
    REGS_REGISTER_AT(MEMRMP, 0x00);
    REGS_REGISTER_AT(EXTICR1, 0x08);
    REGS_REGISTER_AT(EXTICR2, 0x0C);
    REGS_REGISTER_AT(EXTICR3, 0x10);
  private:
    constexpr uint32_t Base() const {
      return 0x40013800;
    }
  };
  
  constexpr SYSCFG SYSCFG;
  
  #endif