Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::gpio::Digital Class Reference

#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
 

Detailed Description

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).
OutputPin for the output pins configured (pin names correspond to RoboMaster dev board definitions).

Member Typedef Documentation

◆ InputPullMode

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.

Member Enumeration Documentation

◆ InputPin

Currently enabled digital input pins.

Enumerator
PF1 
PF0 
B12 

◆ OutputPin

Currently enabled digital output pins.

Enumerator
B13 
B14 
B15 
Laser 

Constructor & Destructor Documentation

◆ Digital()

tap::gpio::Digital::Digital ( )
default

◆ ~Digital()

mockable tap::gpio::Digital::~Digital ( )
default

Member Function Documentation

◆ configureInputPullMode()

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.

Parameters
[in]pinthe InputPin to configure.
[in]modethe pull mode to be enabled.

◆ init()

void tap::gpio::Digital::init ( )

Initializes all pins as output/input pins. Does not handle configuring pin types (

See also
configureInputPullMode).

◆ read()

bool tap::gpio::Digital::read ( Digital::InputPin  pin) const

Reads from an InputPin.

Parameters
[in]pinthe InputPin to read from.
Returns
true if the pin is pulled high and false otherwise.

◆ set()

void tap::gpio::Digital::set ( Digital::OutputPin  pin,
bool  isSet 
)

Sets the digital OutputPin either high or low.

Parameters
[in]pinthe OutputPin to set.
[in]isSettrue to send high, false to send low.

The documentation for this class was generated from the following files: