Class Digital¶
Defined in File digital.hpp
Class Documentation¶
-
class Digital¶
Similar to the Analog class, wraps input and output digital pins.
See also
InputPin for the input pins configured (pin names correspond to RoboMaster dev board definitions).
See also
OutputPin for the output pins configured (pin names correspond to RoboMaster dev board definitions).
Public Types
-
enum InputPin¶
Currently enabled digital input pins.
Values:
-
enumerator PF1¶
-
enumerator PF0¶
-
enumerator B12¶
-
enumerator PF1¶
-
enum OutputPin¶
Currently enabled digital output pins.
Values:
-
enumerator B13¶
-
enumerator B14¶
-
enumerator B15¶
-
enumerator Laser¶
-
enumerator B13¶
-
using InputPullMode = modm::platform::Gpio::InputType¶
This references a struct defined by modm. Can either be floating, pull-up, or pull-down.
Public Functions
-
Digital() = default¶
-
mockable ~Digital() = default¶
- mockable void init ()
Initializes all pins as output/input pins. Does not handle configuring pin types (
See also
- mockable void configureInputPullMode (InputPin pin, InputPullMode mode)
By default input pins are floating. Configure them to have a pull-up or pull-down resistor here.
- Parameters:
pin – [in] the InputPin to configure.
mode – [in] the pull mode to be enabled.
- mockable void set (OutputPin pin, bool isSet)
Sets the digital OutputPin either high or low.
- Parameters:
pin – [in] the OutputPin to set.
isSet – [in]
trueto send high,falseto send low.
- mockable bool read (InputPin pin) const
Reads from an InputPin.
- Parameters:
pin – [in] the InputPin to read from.
- Returns:
trueif the pin is pulled high andfalseotherwise.
-
enum InputPin¶