This repository shows how to manage the LED controller PCA9532 from Linux userspace. For many types of devices, creating a Linux kernel driver is overkill. The logic of controlling the device does not necessarily have to be within the kernel. Running the driver in userspace simplifies development and reduces the risk of serious bugs within a kernel module.
Power ON/OFF is controlled by GPIO. The output LED configuration is sent through I2C bus to PCA9532.
LED controller users shouldn't care about the low level details, such as the bus communication between device and processor. They only need to know the public API of libPCA9532 to control it.
Scheme below shows how low level shared libraries are loaded by other shared libraries and by the test application.
libPCA9532 API:
| Function | Description |
|---|---|
pca9532_open |
Initialize PCA9532 |
pca9532_set_led |
Set led value |
pca9532_set_mask_out |
Set LED 12 to LED 1 values from uint16 mask |
set_led_rgb |
Set led RGB color (if you had) |
libI2C API:
| Function | Description |
|---|---|
i2c_read |
Read I2C message |
i2c_write |
Send I2C message |
libGPIO API:
| Function | Description |
|---|---|
gpio_config |
Config GPIO as input/output |
gpio_free |
Free GPIO |
gpio_get_direction |
Get GPIO input/output direction |
gpio_get_value |
Get GPIO input value |
gpio_set_value |
Set GPIO output value |

