OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
GPIO Struct Reference

GPIO pin number. More...

#include <SimWheelTypes.hpp>

Public Member Functions

 GPIO (int pin)
 Assign a pin number.
 
 GPIO ()
 Create a GPIO as "not connected".
 
 GPIO (UNSPECIFIED value)
 Assign a "not connected" value.
 
 operator int () const
 Get pin number.
 
 GPIO (const GPIO &instance)
 Copy another GPIO instance.
 
bool operator== (const UNSPECIFIED value) const
 Check if "not connected".
 
bool operator!= (const UNSPECIFIED value) const
 Check if a pin number was assigned.
 
void reserve () const
 Reserve this GPIO for exclusive use.
 
void grant () const
 Grant this GPIO for non-exclusive use.
 
void abortIfUnspecified () const
 Throw an exception if unspecified.
 

Protected Attributes

int _pin
 Assigned pin number.
 

Detailed Description

GPIO pin number.

Note
Checks for unusable pins

Definition at line 605 of file SimWheelTypes.hpp.

Constructor & Destructor Documentation

◆ GPIO() [1/4]

GPIO::GPIO ( int pin)
inline

Assign a pin number.

Exceptions
gpio_errorIf not usable or not capable
Parameters
pinPin number

Definition at line 614 of file SimWheelTypes.hpp.

◆ GPIO() [2/4]

GPIO::GPIO ( )
inline

Create a GPIO as "not connected".

Definition at line 657 of file SimWheelTypes.hpp.

◆ GPIO() [3/4]

GPIO::GPIO ( UNSPECIFIED value)
inline

Assign a "not connected" value.

Parameters
valueUnspecified value

Definition at line 664 of file SimWheelTypes.hpp.

◆ GPIO() [4/4]

GPIO::GPIO ( const GPIO & instance)
inline

Copy another GPIO instance.

Parameters
instanceInstance to be copied

Definition at line 678 of file SimWheelTypes.hpp.

Member Function Documentation

◆ abortIfUnspecified()

void GPIO::abortIfUnspecified ( ) const
inline

Throw an exception if unspecified.

Exceptions
gpio_errorIf "not connected"

Definition at line 738 of file SimWheelTypes.hpp.

◆ grant()

void GPIO::grant ( ) const
inline

Grant this GPIO for non-exclusive use.

Definition at line 722 of file SimWheelTypes.hpp.

◆ operator int()

GPIO::operator int ( ) const
inline

Get pin number.

Returns
int Pin number or -1 if "not connected"

Definition at line 671 of file SimWheelTypes.hpp.

◆ operator!=()

bool GPIO::operator!= ( const UNSPECIFIED value) const
inline

Check if a pin number was assigned.

Parameters
valueUnspecified value
Returns
true If "not connected"
false If a GPIO pin was assigned

Definition at line 696 of file SimWheelTypes.hpp.

◆ operator==()

bool GPIO::operator== ( const UNSPECIFIED value) const
inline

Check if "not connected".

Parameters
valueUnspecified value
Returns
true If a GPIO pin was assigned
false If "not connected"

Definition at line 687 of file SimWheelTypes.hpp.

◆ reserve()

void GPIO::reserve ( ) const
inline

Reserve this GPIO for exclusive use.

Exceptions
gpio_errorIf already reserved

Definition at line 711 of file SimWheelTypes.hpp.

Member Data Documentation

◆ _pin

int GPIO::_pin
protected

Assigned pin number.

Definition at line 756 of file SimWheelTypes.hpp.


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