Flyby SDK v1.0.2
Loading...
Searching...
No Matches
flyby::Pin Class Referencefinal

Interface for the GPIO pins. More...

#include <pins.h>

Collaboration diagram for flyby::Pin:

Public Types

enum  PinType : uint8_t { IN , OUT , INOUT }
 The type of pin can be IN, OUT, or INOUT.
enum  PinValue : uint8_t { LOW , HIGH }
 The value of the pin can be either high or low.

Public Member Functions

void set_high () const
 Set the pin to HIGH.
void set_low () const
 Set the pin to LOW.
PinValue get_value () const
 Get the current value of the pin.
std::shared_ptr< PinObservablesubscribe ()
 Subscribe to the pin's state changes.

Static Public Member Functions

static bool initialize_pins ()
 Initializes the hardware to support pin operations.
static void release_pins ()
 Deallocates the pin resources.

Static Public Attributes

static Pin IN_0
 The GPIO input pin with index 0.
static Pin OUT_0
 The GPIO output pin with index 0.
static Pin OUT_1
 The GPIO output pin with index 1.

Detailed Description

Interface for the GPIO pins.

Users should use the static pins, such as OUT_0, instead of constructing this object themselves.

Member Function Documentation

◆ get_value()

PinValue flyby::Pin::get_value ( ) const
nodiscard

Get the current value of the pin.

Returns
PinValue can be HIGH or LOW.

◆ initialize_pins()

bool flyby::Pin::initialize_pins ( )
static

Initializes the hardware to support pin operations.

Must be called before using any of the pin library.

◆ release_pins()

void flyby::Pin::release_pins ( )
static

Deallocates the pin resources.

Should be done to allow other applications or components to use the pins.

◆ subscribe()

std::shared_ptr< PinObservable > flyby::Pin::subscribe ( )
nodiscard

Subscribe to the pin's state changes.

Returns
PinObservable with rising and falling edge callbacks.

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