GPIO wrapper class for usage with C++ and wiringPi.
More...
#include <WiringPiGPIO.h>
GPIO wrapper class for usage with C++ and wiringPi.
◆ WiringPiGPIO()
| SWE4211RPi::WiringPiGPIO::WiringPiGPIO |
( |
int |
number, |
|
|
DIRECTION |
dir, |
|
|
VALUE |
val = GPIO_LOW |
|
) |
| |
This is the constructor for an instance of a GPIO class.
- Parameters
-
| number | This is the Raspberry Pi GPIO Number. |
| dir | This is the direction for the GPIO pin, either input or output. |
| val | This is the default value for the GPIO pin. |
This is the constructor for an instance of the wiringPi GPIO class.
- Parameters
-
| number | This is the Raspberry Pi GPIO Number. |
| dir | This is the direction for the GPIO pin, either input or output. |
| val | This is the default value for the GPIO pin. |
◆ ~WiringPiGPIO()
| SWE4211RPi::WiringPiGPIO::~WiringPiGPIO |
( |
| ) |
|
|
virtual |
This is the destructor for the class, which will clean up the existing instance.
This is the destructor for the class, which will clean up the existing instance. The pin is returned to being an input and the instance is removed from the instance table.
◆ disableEdgeInterrupt()
| void SWE4211RPi::WiringPiGPIO::disableEdgeInterrupt |
( |
| ) |
|
|
virtual |
This method will disable the edge interrupt for the given pin.
This method will disable the edge interrupts for the given GPIO pin. It also deletes the thread diagnostic entry that was created for the pin's interrupt thread.
Implements SWE4211RPi::GPIO.
◆ enableEdgeInterrupt()
| void SWE4211RPi::WiringPiGPIO::enableEdgeInterrupt |
( |
EDGE |
edgeType | ) |
|
|
virtual |
This method will enable an interrupt to be processed based upon edges. In doing this, callbacks can be made based upon the GPIO pin changing state and methods can block for IO purposes. If interrupts are already enabled for a different edge type, they are disabled first. Calling this with the edge type that is already enabled does nothing.
- Parameters
-
| edgeType | This is the edge type that is to be processed as an interrupt. |
This method will enable an interrupt to be processed based upon edges. In doing this, callbacks can be made based upon the GPIO pin changing state and methods can block for IO purposes.
- Parameters
-
| edgeType | This is the edge type that is to be processed as an interrupt. |
Implements SWE4211RPi::GPIO.
◆ freeGPIOInstance()
| void SWE4211RPi::WiringPiGPIO::freeGPIOInstance |
( |
WiringPiGPIO & |
instance | ) |
|
|
static |
This method will release a reference to the given instance. When the last reference has been released, the pin is returned to being an input.
- Parameters
-
| instance | This is the instance that is to be released. |
This method will release a reference to the given instance. When the last reference has been released, the pin is returned to being an input. The instance itself is not deleted and remains in the instance table. Note that GPIO::freeInstance() does not currently call this method when wiringPi is used.
- Parameters
-
| instance | This is the instance that is to be released. |
◆ getValue()
This method will return the current state of this GPIO pin.
- Returns
- The return will be high or low depending on the state of the pin.
Implements SWE4211RPi::GPIO.
◆ handleInterruptDrivenGPIOPin()
| void SWE4211RPi::WiringPiGPIO::handleInterruptDrivenGPIOPin |
( |
| ) |
|
|
virtual |
This method will be invoked if an interrupt is enabled whenever a transition in pin value occurs.
This method will be invoked if an interrupt is enabled whenever a transition in pin value occurs. It reads the pin to decide whether the edge was rising or falling, records the time of the edge, and wakes any waiting thread and the callback thread.
Implements SWE4211RPi::GPIO.
◆ setValue()
| void SWE4211RPi::WiringPiGPIO::setValue |
( |
GPIO::VALUE |
val | ) |
|
|
virtual |
This method will drive an output pin to the appropriate value.
- Parameters
-
| value | This is the value that is to be written to the pin. |
This method will drive an output pin to the appropriate value.
- Parameters
-
| val | This is the value that is to be written to the pin. |
Implements SWE4211RPi::GPIO.
◆ currentEdgeType
| int SWE4211RPi::WiringPiGPIO::currentEdgeType = GPIO_NONE |
|
protected |
This is the edge type for which interrupts are currently enabled, or GPIO_NONE if edge interrupts are disabled.
◆ initialized
| int SWE4211RPi::WiringPiGPIO::initialized = 0 |
|
staticprivate |
This attribute indicates whether any GPIO has been instantiated. The first GPIO to be instantiated will also setup the wiringPi library using Broadcom GPIO numbering. Subsequent instantiations will not do so.
This will initialize the initialized variable to 0 until a constructor is invoked.
◆ number
| int SWE4211RPi::WiringPiGPIO::number |
|
protected |
The documentation for this class was generated from the following files:
- /media/sf_lwshare/20262027SWE4211AllLabSolutions/Lab11/solution/pi/src/gpio/provided/WiringPiGPIO.h
- /media/sf_lwshare/20262027SWE4211AllLabSolutions/Lab11/solution/pi/src/gpio/provided/WiringPiGPIO.cpp