Data Structures | |
class | GPIORpi |
class GPIORpi |
Public Types | |
Interrupt event | |
enum | IntEvent_t { INT_FALLING_EDGE = 0 , INT_RISING_EDGE = 1 , INT_HIGH = 2 , INT_LOW = 3 , INT_CHANGE = 4 } |
Voltage level | |
enum | VLevel_t { GPIO_LOW = 0 , GPIO_HIGH = 1 } |
Voltage logic | |
enum | VLogic_t { NEGATIVE = 1 , POSITIVE = 2 } |
Public Member Functions | |
GPIORpi () | |
GPIO Rpi constructor. More... | |
GPIORpi (uint8_t pin, uint8_t mode, VLogic_t logic) | |
GPIO Rpi default constructor. More... | |
~GPIORpi () | |
GPIO Rpi destructor. More... | |
Error_t | init () |
Initializes the Raspberry Pi GPIO. More... | |
Error_t | deinit () |
Deinitializes the Raspberry Pi GPIO. More... | |
VLevel_t | read () |
Reads the Raspberry Pi GPIO voltage level. More... | |
Error_t | write (VLevel_t level) |
Writes the Raspberry Pi GPIO output voltage level. More... | |
Error_t | enable () |
Enable the GPIO. More... | |
Error_t | disable () |
Disable the GPIO. More... | |
Error_t | enableInt (void(*cback)(void), IntEvent_t mode) |
Enables the Raspberry Pi GPIO interrupt. More... | |
Error_t | disableInt () |
Disable Raspberry Pi GPIO interrupt. More... | |
IntEvent_t | intEvent () |
Gets the latest Raspberry Pi interrupt event. More... | |
GPIORpi::GPIORpi | ( | ) |
GPIO Rpi constructor.
This function sets the basics for a GPIO.
GPIORpi::GPIORpi | ( | uint8_t | pin, |
uint8_t | mode, | ||
VLogic_t | logic | ||
) |
GPIO Rpi default constructor.
This function is setting the basics for a GPIO. It allows to set the pin number, mode of the pin and the logic level.
[in] | pin | Number of the desired pin |
[in] | mode | Defines the mode of the pin (INPUT, OUTPUT, etc.) |
[in] | logic | Defines the logic level of the pin |
GPIORpi::~GPIORpi | ( | ) |
GPIO Rpi destructor.
This function does cleanup for class object and its class members when the object is destroyed
|
virtual |
Initializes the Raspberry Pi GPIO.
This function initializes the chosen pin.
OK | if success |
INTF_ERROR | if initialization error |
Implements bgt60::GPIO.
|
virtual |
Deinitializes the Raspberry Pi GPIO.
This function deinitializes the chosen pin
OK | always |
Implements bgt60::GPIO.
|
inlinevirtual |
Reads the Raspberry Pi GPIO voltage level.
This function reads the logic level of the chosen pin and returns the logic level value.
GPIO_LOW | if voltage low |
GPIO_HIGH | if voltage high |
Implements bgt60::GPIO.
Writes the Raspberry Pi GPIO output voltage level.
This functions sets the logic level of the chosen pin.
[in] | level | Voltage level |
OK | always |
Implements bgt60::GPIO.
|
inlinevirtual |
Enable the GPIO.
Enables the Raspberry Pi GPIO output according to the GPIO logic
OK | always |
Implements bgt60::GPIO.
|
inlinevirtual |
Disable the GPIO.
Disables the Raspberry Pi GPIO output according to the GPIO logic
OK | always |
Implements bgt60::GPIO.
|
virtual |
Enables the Raspberry Pi GPIO interrupt.
This function enables the interrupt on chosen pin. Depending on the mode, it triggers the interrupt.
[in] | *cback | Function pointer of the interrupt callback |
[in] | mode | Event at which the interrupt will occur |
OK | if success |
INTF_ERROR | if error |
Implements bgt60::GPIO.
|
inlinevirtual |
Disable Raspberry Pi GPIO interrupt.
This function disables the interrupt on chosen pin.
INTF | Error always |
Implements bgt60::GPIO.
|
inlinevirtual |
Gets the latest Raspberry Pi interrupt event.
This function gets the latest interrupt event on the earlier configured GPIO pin.
INT_FALLING_EDGE | if falling edge event |
INT_RISING_EDGE | if rising edge event |
Implements bgt60::GPIO.