28 #ifndef ARCH_REG_GPIO_HPP_INCLUDED 29 #define ARCH_REG_GPIO_HPP_INCLUDED 41 static_assert((port >=
'A') && (port <=
'G'),
"invalid index for register");
43 static constexpr
unsigned gpio_no = port -
'A';
59 template<
unsigned pin_no>
61 :
public std::conditional< (pin_no < 8), CRL, CRH >::type
63 using type = typename std::conditional< (pin_no < 8), CRL, CRH >::type;
65 using CNF = regbits< type, (pin_no % 8) * 4 + 2, 2 >;
66 using MODE = regbits< type, (pin_no % 8) * 4 , 2 >;
static constexpr reg_addr_t base_addr
Definition: gpio.hpp:44
static constexpr unsigned gpio_no
Definition: gpio.hpp:43
General-purpose and alternate-function I/Os (GPIOs and AFIOs)
Definition: gpio.hpp:39
GPIO port configuration register: returns CRL or CRH type dependent on pin_no.
Definition: gpio.hpp:60