cleanup
This commit is contained in:
@@ -59,18 +59,8 @@ struct timer3_traits {
|
||||
constexpr static std::uint32_t arr_bit_mask = 0xFFFF;
|
||||
};
|
||||
|
||||
template <typename TimerTraits>
|
||||
struct timer {
|
||||
constexpr static std::uintptr_t base_address = TimerTraits::base_address;
|
||||
|
||||
using cr1 = reg<base_address + 0x00>;
|
||||
using dier = reg<base_address + 0x0C>;
|
||||
using sr = reg<base_address + 0x10>;
|
||||
using psc = reg<base_address + 0x28>;
|
||||
using arr = reg<base_address + 0x2C>;
|
||||
|
||||
template<auto Bits, typename Reg, uint32_t Mask, uint32_t Pos = 0>
|
||||
struct reg_bits {
|
||||
template<auto Bits, typename Reg, uint32_t Mask, uint32_t Pos = 0>
|
||||
struct reg_bits {
|
||||
using reg = Reg;
|
||||
using T = reg::RegType;
|
||||
|
||||
@@ -84,10 +74,10 @@ struct timer {
|
||||
enum class value : T {
|
||||
val = Bits
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Reg, uint32_t Pos>
|
||||
struct reg_bits_enable_disable {
|
||||
template<typename Reg, uint32_t Pos>
|
||||
struct reg_bits_enable_disable {
|
||||
using reg = Reg;
|
||||
using T = reg::RegType;
|
||||
|
||||
@@ -98,7 +88,17 @@ struct timer {
|
||||
disable = 0,
|
||||
enable = 1
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template <typename TimerTraits>
|
||||
struct timer {
|
||||
constexpr static std::uintptr_t base_address = TimerTraits::base_address;
|
||||
|
||||
using cr1 = reg<base_address + 0x00>;
|
||||
using dier = reg<base_address + 0x0C>;
|
||||
using sr = reg<base_address + 0x10>;
|
||||
using psc = reg<base_address + 0x28>;
|
||||
using arr = reg<base_address + 0x2C>;
|
||||
|
||||
template<auto Bits>
|
||||
using psc_bits = reg_bits<Bits, psc, static_cast<uint32_t>(0xFFFF)>;
|
||||
|
||||
Reference in New Issue
Block a user