|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
Controls LED brightness by generating a specific number of pulses on a GPIO pin. More...
#include <AW9364LedDriver.hpp>
Public Member Functions | |
| void | begin (uint8_t pin) |
| Initialize the driver for use with a native Arduino pin. | |
| void | begin (IoExpanderBase &base, uint8_t pin) |
| Initialize the driver for use with a GPIO expander pin. | |
| void | setBrightness (uint8_t value) |
| Set the LED brightness level. | |
| uint8_t | getBrightness () const |
| Get the current brightness setting. | |
Protected Member Functions | |
| void | _pinMode (uint8_t pin, uint8_t mode) |
| Internal helper to set pin mode, handling both native and expander pins. | |
| void | _digitalWrite (uint8_t pin, uint8_t value) |
| Internal helper to write digital value, handling both native and expander pins. | |
Controls LED brightness by generating a specific number of pulses on a GPIO pin.
The driver toggles the pin rapidly to produce a perceived brightness level. It can operate either directly on an Arduino pin or via an IoExpanderBase (e.g., an I2C GPIO expander).
Definition at line 51 of file actuator/AW9364LedDriver.hpp.
|
inlineprotected |
Internal helper to write digital value, handling both native and expander pins.
| pin | Pin number. |
| value | HIGH (true) or LOW (false). |
Definition at line 183 of file actuator/AW9364LedDriver.hpp.
References IoExpanderBase::digitalWrite().
Referenced by begin(), begin(), and setBrightness().
|
inlineprotected |
Internal helper to set pin mode, handling both native and expander pins.
| pin | Pin number. |
| mode | INPUT or OUTPUT. |
Definition at line 168 of file actuator/AW9364LedDriver.hpp.
References IoExpanderBase::pinMode().
|
inline |
Initialize the driver for use with a GPIO expander pin.
| base | Reference to an IoExpanderBase instance (e.g., XL9555). |
| pin | Pin number on the expander (0‑pinCount‑1). |
Definition at line 77 of file actuator/AW9364LedDriver.hpp.
References _digitalWrite(), and _pinMode().
|
inline |
Initialize the driver for use with a native Arduino pin.
| pin | Arduino pin number (must support OUTPUT mode). |
Definition at line 59 of file actuator/AW9364LedDriver.hpp.
References _digitalWrite(), and _pinMode().
Referenced by setup().
|
inline |
Get the current brightness setting.
Definition at line 156 of file actuator/AW9364LedDriver.hpp.
|
inline |
Set the LED brightness level.
Brightness is controlled by the number of pulses generated. A value of 0 turns the LED off (pin LOW). Non‑zero values are mapped to a number of pulses that adjust the brightness upward or downward from the current setting. Pulses are generated by quickly toggling the pin LOW→HIGH.
| value | Desired brightness (0‑16). Values >16 are clamped to 16. |
Definition at line 99 of file actuator/AW9364LedDriver.hpp.
References _digitalWrite(), i, and MAX_BRIGHTNESS_STEPS.
Referenced by loop().