Add I2C device management API with HT16K33 LED matrix support #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new I2C device management API for Raspberry Pi GPIO, following the existing pattern established by the ADC module. It provides a higher-level abstraction for communicating with I2C devices like LED matrices.
New Features
Core I2C Device API (
raspi_i2c.h):open_i2c_device()- Open an I2C device by name, bus, address, and typei2c_write_byte(),i2c_write_register()- Write to I2C devicei2c_read_byte(),i2c_read_register()- Read from I2C deviceclose_i2c_device(),close_all_i2c_devices()- Close deviceshas_i2c_device(),i2c_device_named()- Device registry lookupsHT16K33 LED Matrix Support:
ht16k33_init()- Initialize display (oscillator on, display on)ht16k33_set_brightness()- Set brightness level (0-15)ht16k33_clear()- Clear the displayht16k33_draw_pattern()- Draw an 8x8 patternht16k33_turn_off()- Turn off the displayDevice Types:
I2C_DEVICE_GENERIC- Generic I2C deviceI2C_DEVICE_HT16K33_8X8- 8x8 LED Matrix (address 0x70)I2C_DEVICE_HT16K33_14SEG- 14-segment display (address 0x70)I2C_DEVICE_PCF8574- I/O Expander (address 0x20)Example Usage
Type of change
How Has This Been Tested?
Built and tested on macOS using CMake:
Testing Checklist
Checklist