Class Pin

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class Pin : public Wire

MCU pin model.

Pin represents a external pad of the MCU used for GPIO. The pin has two electrical states given by the external circuit and the internal circuit (the GPIO port), which are resolved into a single electrical state. In case of conflict, the SHORTED state is set. The internal circuit state is set by GPIO controls.

Public Functions

explicit Pin(pin_id_t id)
inline pin_id_t id() const
inline void set_external_state(const state_t &state)

Set the state applied to the pin by the external circuit

inline void set_external_state(StateEnum state, double level = 0.0)

Set the state applied to the pin by the external circuit

inline void set_external_state(char state, double level = 0.0)

Set the state applied to the pin by the external circuit

void set_gpio_controls(const controls_t &controls)

Set the controls for the internal circuit state

inline controls_t gpio_controls() const

Getter for the GPIO controls currently applied

Pin(const Pin&) = delete
Pin &operator=(const Pin&) = delete
struct controls_t

Structure for defining the controls of a GPIO

Public Members

unsigned char dir = 0

Direction control: 0=IN, 1=OUT.

unsigned char drive = 0

Driving state: 0=LOW, 1=HIGH.

bool inverted = false

Enable inversion of the driving state.

bool pull_up = false

Enable the pull up.