-
Notifications
You must be signed in to change notification settings - Fork 25
register accessor layer and SPI support #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dc6d647
register accessor layer and SPI support
FoamyGuy 4532b05
repo and version meta vars
FoamyGuy 77983d4
I2C accessor implementation, repo and version meta vars
FoamyGuy a5e9569
Merge remote-tracking branch 'foamyguy/accessor_layer' into accessor_…
FoamyGuy 9bdc1f8
docstrings. implement bool vs int logic in i2c write
FoamyGuy 5196696
move read current value out of accessor into Bit(s). Support multibyt…
FoamyGuy c850754
pass address to read/write Accessor functions. Fix start/end indexes …
FoamyGuy 5039f29
SPI start/end fix for multibyte address. big endian multibyte address…
FoamyGuy b42f50e
split address and data buffers. Address buffer inside Accessor, data …
FoamyGuy 262e989
only use full_buffer for i2c.write(). Split SPI write into two instea…
FoamyGuy f4861a7
add protocol details to both Accessor docstrings. Remove buffer lengt…
FoamyGuy 4b553b4
add i2c comms details
FoamyGuy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
only use full_buffer for i2c.write(). Split SPI write into two instea…
…d of concat. Add multibyte address test.
- Loading branch information
commit 262e9895245ff4dfb846ca9eccba768550e62c08
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # SPDX-FileCopyrightText: 2025 Tim Cocks for Adafruit Industries | ||
| # SPDX-License-Identifier: MIT | ||
| """ | ||
| Verify functionality of multibyte address registers. | ||
|
|
||
| Rrequires OV5640 camera connected. | ||
| Default pins are for RPi Pico + Adafruit PiCowbell Camera Breakout | ||
| """ | ||
|
|
||
| import board | ||
| import busio | ||
| import digitalio | ||
| from adafruit_bus_device.i2c_device import I2CDevice | ||
|
|
||
| from adafruit_register.register_accessor import I2CRegisterAccessor | ||
| from adafruit_register.register_bits import ROBits | ||
|
|
||
| I2C_ADDRESS = 0x3C | ||
| REG_CHIP_ID_HIGH = 0x300A | ||
|
|
||
|
|
||
| class OV5640Tester: | ||
| chip_id = ROBits(16, REG_CHIP_ID_HIGH, 0, register_width=2, lsb_first=False) | ||
|
|
||
| def __init__(self, i2c): | ||
| try: | ||
| i2c_device = I2CDevice(i2c, I2C_ADDRESS) | ||
| self.register_accessor = I2CRegisterAccessor( | ||
| i2c_device, address_width=2, lsb_first=False | ||
| ) | ||
| except ValueError: | ||
| raise ValueError(f"No I2C device found.") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| print("construct bus") | ||
| i2c = busio.I2C(board.GP5, board.GP4) | ||
| print("construct camera") | ||
| reset = digitalio.DigitalInOut(board.GP14) | ||
|
|
||
| ov5640 = OV5640Tester(i2c) | ||
| print(hex(ov5640.chip_id)) |
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.
Uh oh!
There was an error while loading. Please reload this page.