28 #ifndef ARCH_REG_GPIO_HPP_INCLUDED 29 #define ARCH_REG_GPIO_HPP_INCLUDED 32 #include <type_traits> 42 static_assert((port >=
'A') && (port <=
'I'),
"invalid index for GPIO register");
44 static constexpr
unsigned gpio_no = port -
'A';
47 static constexpr uint32_t
moder_reset = ( port ==
'A' ? 0xA8000000 :
48 port ==
'B' ? 0x00000280 :
54 static constexpr uint32_t
pupdr_reset = ( port ==
'A' ? 0x64000000 :
55 port ==
'B' ? 0x00000100 :
62 using IDR =
reg< uint32_t, base_addr + 0x10,
ro >;
83 template<
unsigned pin_no >
using AFRx =
84 typename std::conditional<
93 #endif // ARCH_REG_GPIO_HPP_INCLUDED static constexpr uint32_t pupdr_reset
Definition: gpio.hpp:54
static constexpr uint32_t ospeedr_reset
Definition: gpio.hpp:51
static constexpr reg_addr_t base_addr
Definition: gpio.hpp:45
static constexpr unsigned gpio_no
Definition: gpio.hpp:44
static constexpr uint32_t moder_reset
Definition: gpio.hpp:47
typename std::conditional<(pin_no< 8), AFRLx< pin_no >, AFRHx< pin_no > >::type AFRx
pin_no = [8..15]
Definition: gpio.hpp:88
General-purpose and alternate-function I/Os (GPIOs and AFIOs)
Definition: gpio.hpp:40