|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
AXP202 GPIO pin control. More...
#include <AXP202Gpio.hpp>
Public Member Functions | |
| AXP202Gpio (AXP202Core &core) | |
| Construct AXP202 GPIO interface. | |
| ~AXP202Gpio ()=default | |
| uint8_t | getPinCount () const override |
| Get number of GPIO pins (4: GPIO0-GPIO3) | |
| Status | setDirection (uint8_t pin, Direction dir) override |
| Set GPIO pin direction. | |
| Direction | getDirection (uint8_t pin) override |
| Get GPIO pin direction. | |
| Status | setDrive (uint8_t pin, DriveType drive) override |
| Set GPIO pin drive type. | |
| DriveType | getDrive (uint8_t pin) override |
| Get GPIO pin drive type. | |
| Status | read (uint8_t pin, bool &high) override |
| Read digital level from a GPIO pin. | |
| Status | write (uint8_t pin, Level level) override |
| Write digital level to a GPIO pin. | |
| Status | setFunction (uint8_t pin, uint8_t func) override |
| Set GPIO pin function mode. | |
| uint8_t | getFunction (uint8_t pin) override |
| Get current GPIO pin function mode. | |
Public Member Functions inherited from PmicGpioBase | |
| virtual | ~PmicGpioBase ()=default |
| Virtual destructor. | |
| Status | pinMode (uint8_t pin, Direction dir, DriveType drive=DriveType::Keep, Pull pull=Pull::Keep, uint8_t func=0xFF) |
| Configure a pin with a single high-level call. | |
| virtual Status | setPull (uint8_t pin, Pull pull) |
| Set internal pull resistor. | |
| virtual Pull | getPull (uint8_t pin) |
| Get current internal pull resistor setting. | |
Additional Inherited Members | |
Public Types inherited from PmicGpioBase | |
| enum class | Direction : uint8_t { Input = 0 , Output = 1 } |
| GPIO pin direction. More... | |
| enum class | DriveType : uint8_t { PushPull = 0 , OpenDrain = 1 , Keep = 0xFF } |
| GPIO drive type. More... | |
| enum class | Level : uint8_t { Low = 0 , HiZ = 1 , High = 2 } |
| Output level control. More... | |
| enum class | Pull : uint8_t { None = 0 , Down = 1 , Up = 2 , Keep = 0xFF } |
| Internal pull resistor configuration. More... | |
| enum class | Status : uint8_t { Ok = 0 , InvalidPin = 1 , Failed = 2 } |
| GPIO operation status code. More... | |
Static Public Member Functions inherited from PmicGpioBase | |
| static constexpr bool | isOk (Status s) |
AXP202 GPIO pin control.
Implements the PmicGpioBase interface to manage GPIO direction, drive current, and digital level for the AXP202's four GPIO pins.
Definition at line 72 of file AXP202Gpio.hpp.
|
explicit |
Construct AXP202 GPIO interface.
| core | Reference to AXP202 core communication |
Definition at line 8 of file AXP202Gpio.cpp.
|
default |
|
overridevirtual |
Get GPIO pin direction.
| pin | Pin number (0-3) |
Implements PmicGpioBase.
Definition at line 60 of file AXP202Gpio.cpp.
References PmicGpioBase::Input, PmicGpioBase::Output, and SensorCommWrapper::readReg().
|
overridevirtual |
Get GPIO pin drive type.
| pin | Pin number (0-3) |
Implements PmicGpioBase.
Definition at line 83 of file AXP202Gpio.cpp.
References PmicGpioBase::OpenDrain, and PmicGpioBase::PushPull.
|
overridevirtual |
Get current GPIO pin function mode.
| pin | Pin number (0-3) |
Reimplemented from PmicGpioBase.
Definition at line 151 of file AXP202Gpio.cpp.
References SensorCommWrapper::readReg().
|
overridevirtual |
Get number of GPIO pins (4: GPIO0-GPIO3)
Implements PmicGpioBase.
Definition at line 12 of file AXP202Gpio.cpp.
Referenced by setDrive().
|
overridevirtual |
Read digital level from a GPIO pin.
| pin | Pin number (0-3) |
| high | Reference set to true if pin is high, false if low |
Implements PmicGpioBase.
Definition at line 90 of file AXP202Gpio.cpp.
References PmicGpioBase::Failed, axp202_regs::gpio::GPIO012_SIGNAL, PmicGpioBase::InvalidPin, PmicGpioBase::Ok, and SensorCommWrapper::readReg().
|
overridevirtual |
Set GPIO pin direction.
| pin | Pin number (0-3) |
| dir | Direction (Input or Output) |
Implements PmicGpioBase.
Definition at line 28 of file AXP202Gpio.cpp.
References PmicGpioBase::Failed, PmicGpioBase::Input, PmicGpioBase::InvalidPin, PmicGpioBase::Ok, PmicGpioBase::Output, SensorCommWrapper::readReg(), SensorCommWrapper::updateBits(), and SensorCommWrapper::writeReg().
|
overridevirtual |
Set GPIO pin drive type.
| pin | Pin number (0-3) |
| drive | Drive type |
Implements PmicGpioBase.
Definition at line 73 of file AXP202Gpio.cpp.
References PmicGpioBase::Failed, getPinCount(), and PmicGpioBase::InvalidPin.
|
overridevirtual |
Set GPIO pin function mode.
| pin | Pin number (0-2 only; GPIO3 has no function multiplexing) |
| func | Function mode value (see GPIO0-2 Function Select Values (REG 90H/92H/93H [2:0]) for valid values) |
Reimplemented from PmicGpioBase.
Definition at line 140 of file AXP202Gpio.cpp.
References PmicGpioBase::Failed, PmicGpioBase::InvalidPin, PmicGpioBase::Ok, and SensorCommWrapper::updateBits().
|
overridevirtual |
Write digital level to a GPIO pin.
| pin | Pin number (0-3) |
| level | Level to set (Low, High, or HiZ) |
Implements PmicGpioBase.
Definition at line 109 of file AXP202Gpio.cpp.
References PmicGpioBase::Failed, PmicGpioBase::High, PmicGpioBase::HiZ, PmicGpioBase::InvalidPin, level, PmicGpioBase::Low, PmicGpioBase::Ok, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().