58 [[nodiscard]]
constexpr uint32_t
mask()
const
60 return (1 <<
Count) - 1;
66 [[nodiscard]] __always_inline uint32_t
extract(uint32_t value)
const
85 template<InputBits Bits>
86 __always_inline uint32_t
bits()
volatile
88 return Bits.extract(
read);
94 template<InputBits Bits>
95 __always_inline uint32_t
bit(uint32_t index)
volatile
97 return (Bits.extract(
read) >> index) & 1;
139 constexpr static uint32_t
led_bit(uint32_t index)
156 for (uint32_t i = 0; i <
LEDCount; i++)
The Arty A7 configuration has two LEDs (LD5 and LD6), four buttons, and four switches,...
static constexpr InputBits Buttons
The buttons zero to three are in the low four bits.
uint32_t bit(uint32_t index) volatile
Helper to read a single bit defined by an InputBits instance.
void led_on(uint32_t index) volatile
Turn on the LED specified by index.
void enable_all() volatile
Enable all of the LED GPIO pins.
uint32_t button(uint32_t index) volatile
Read the value of one of the buttons, indicated by index.
static constexpr uint32_t LastLED
The index of the last GPIO pin connected to a LED.
static constexpr uint32_t LEDCount
The number of GPIO pins used for LEDs.
static constexpr uint32_t led_bit(uint32_t index)
Helper that maps from an LED index to a bit to set / clear to control that LED.
uint32_t switches() volatile
Read the value of all of the switches.
uint32_t writeEnable
Write enable.
static constexpr uint32_t FirstLED
The index of the first GPIO pin connected to a LED.
uint32_t read
Input register.
uint32_t bits() volatile
Helper to read all of the bits defined by an InputBits instance.
uint32_t switch_value(uint32_t index) volatile
Read the value of one of the switches, indicated by index.
static constexpr InputBits Switches
Switches zero to three are in the next four bits.
uint32_t buttons() volatile
Read the value of all of the buttons.
void led_off(uint32_t index) volatile
Turn off the LED specified by index.
uint32_t write
The output register.