Input Pin#

Hardware Interface#

Defined in namespace hal

#include <libhal/input_pin.hpp>

class input_pin#

Digital input pin hardware abstraction interface.

Use this to read a pin and determine if the voltage on it is HIGH or LOW.

Subclassed by hal::soft::inert_input_pin, hal::soft::input_pin_inverter

Public Functions

inline void configure(const settings &p_settings)#

Configure the input pin to match the settings supplied.

Parameters:

p_settings – - settings to apply to input pin

Throws:

hal::operation_not_supported – - if the settings could not be achieved.

inline bool level()#

Read the state of the input pin.

Returns:

bool - true indicates HIGH voltage level and false indicates LOW voltage level

struct settings#

Generic settings for input pins.

Public Members

pin_resistor resistor = pin_resistor::pull_up#

Pull resistor for an input pin.

Utilities#

Defined in namespace hal

#include <libhal-util/input_pin.hpp>

group InputPin

Functions

constexpr auto operator==(const input_pin::settings &p_lhs, const input_pin::settings &p_rhs)#

Compares two input pin states.

Parameters:
  • p_lhs – An input pin

  • p_rhs – An input pin

Returns:

A boolean if they are the same or not.