|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <digital.hpp>
Public Types | |
| enum | InputPin { PF1 , PF0 , B12 } |
| enum | OutputPin { B13 , B14 , B15 , Laser } |
| using | InputPullMode = modm::platform::Gpio::InputType |
Public Member Functions | |
| Digital ()=default | |
| mockable | ~Digital ()=default |
| mockable void | init () |
| mockable void | configureInputPullMode (InputPin pin, InputPullMode mode) |
| mockable void | set (OutputPin pin, bool isSet) |
| mockable bool | read (InputPin pin) const |
Similar to the Analog class, wraps input and output digital pins.
| using tap::gpio::Digital::InputPullMode = modm::platform::Gpio::InputType |
This references a struct defined by modm. Can either be floating, pull-up, or pull-down.
|
default |
|
default |
| void tap::gpio::Digital::configureInputPullMode | ( | Digital::InputPin | pin, |
| Digital::InputPullMode | mode | ||
| ) |
By default input pins are floating. Configure them to have a pull-up or pull-down resistor here.
| [in] | pin | the InputPin to configure. |
| [in] | mode | the pull mode to be enabled. |
| void tap::gpio::Digital::init | ( | ) |
Initializes all pins as output/input pins. Does not handle configuring pin types (
| bool tap::gpio::Digital::read | ( | Digital::InputPin | pin | ) | const |
Reads from an InputPin.
| [in] | pin | the InputPin to read from. |
true if the pin is pulled high and false otherwise. | void tap::gpio::Digital::set | ( | Digital::OutputPin | pin, |
| bool | isSet | ||
| ) |
Sets the digital OutputPin either high or low.
| [in] | pin | the OutputPin to set. |
| [in] | isSet | true to send high, false to send low. |