Driver to use a GPIO on a supported serial device. More...
#include <gpio_driver.h>
Public Member Functions | |
bool | get (gpio_input_mode mode) |
Performs a digital read on the GPIO Pin returning the read value in value. | |
uint8_t | getDeviceAddress (void) |
GpioDriver (bosch_hardware_interface *hw, uint8_t pin) | |
Constructor. | |
bool | initialize () |
Initializes the driver and the connected hardware. | |
bool | set (bool value) |
Set a GPIO Pin to HIGH or LOW. It will always configure the pin as an output first. | |
~GpioDriver () | |
Private Attributes | |
uint8_t | _pin |
Driver to use a GPIO on a supported serial device.
This class lets the user access the GPIO pins of any supported hardware It is possible to configure the pin as Output, floating Input, Input with Pullup or Input with Pulldown Depending on the hardware used some of these options might not be available Once the GPIO is configured it can be set to HIGH or LOW if output or can be read if configured as an input
Definition at line 59 of file gpio_driver.h.
GpioDriver::GpioDriver | ( | bosch_hardware_interface * | hw, |
uint8_t | pin | ||
) |
Constructor.
hw | hardware interface to use |
pin | GPIO pin number on the hardware device |
Definition at line 41 of file gpio_driver.cpp.
Definition at line 46 of file gpio_driver.cpp.
bool GpioDriver::get | ( | gpio_input_mode | mode | ) |
Performs a digital read on the GPIO Pin returning the read value in value.
mode | configures the input pin to be either floating, add a pullup or a pulldown |
Definition at line 81 of file gpio_driver.cpp.
uint8_t GpioDriver::getDeviceAddress | ( | void | ) | [virtual] |
Implements bosch_drivers_common::sensor_driver.
Definition at line 50 of file gpio_driver.cpp.
bool GpioDriver::initialize | ( | ) |
Initializes the driver and the connected hardware.
Definition at line 56 of file gpio_driver.cpp.
bool GpioDriver::set | ( | bool | value | ) |
Set a GPIO Pin to HIGH or LOW. It will always configure the pin as an output first.
value | 0 will set the GPIO pin to LOW and 1 will set it to HIGH |
Definition at line 67 of file gpio_driver.cpp.
uint8_t GpioDriver::_pin [private] |
Definition at line 97 of file gpio_driver.h.