Class Pin

Class Documentation

class Pin

Pin control class for managing individual pin states.

Provides methods for setting pin levels, enabling/disabling pins, and managing pin state with safety checks.

Public Functions

inline Pin()

Default constructor.

Initializes pin with level=false and active=true.

void set_level(bool level)

Set the logical level of the pin.

Updates the internal state but doesn’t immediately apply to hardware.

Parameters:

level – The logical level to set (true=high, false=low)

void update()

Apply the current pin state to hardware.

Updates the actual pin output based on current level and active state.

void toggle()

Toggle the pin level.

Inverts the current logical level of the pin.

void enable()

Enable the pin.

Sets the pin as active, allowing it to be controlled.

void disable()

Disable the pin.

Sets the pin as inactive, preventing control operations.

bool is_active()

Check if the pin is active.

Returns:

true if the pin is enabled, false otherwise

Public Members

uint32_t pin_idx

IOPORT index for this pin