Expand description
Component for Buttons.
§Usage
The button_component_helper!
macro takes ’static references to GPIO pins.
When GPIO instances are owned values, the button_component_helper_owned!
can be used, indicating that the passed values are owned values. This macro
will perform static allocation of the passed in GPIO pins internally.
let button = components::button::ButtonComponent::new(
board_kernel,
components::button_component_helper!(
sam4l::gpio::GPIOPin,
(
&sam4l::gpio::PC[24],
kernel::hil::gpio::ActivationMode::ActiveLow,
kernel::hil::gpio::FloatingState::PullUp
)
),
)
.finalize(button_component_static!(sam4l::gpio::GPIOPin));
Typically, ActivationMode::ActiveLow
will be associated with
FloatingState::PullUp
whereas ActivationMode::ActiveHigh
will be paired
with FloatingState::PullDown
. FloatingState::None
will be used when the
board provides external pull-up/pull-down resistors.