Skip to content
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

Release 0.0.6a1 #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Changelog

## [0.0.5a2](https://github.com/OpenVoiceOS/ovos-i2c-detection/tree/0.0.5a2) (2025-01-11)
## [0.0.6a1](https://github.com/OpenVoiceOS/ovos-i2c-detection/tree/0.0.6a1) (2025-01-11)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-i2c-detection/compare/0.0.4...0.0.5a2)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-i2c-detection/compare/0.0.5...0.0.6a1)

**Merged pull requests:**

- Feat/mk1 [\#10](https://github.com/OpenVoiceOS/ovos-i2c-detection/pull/10) ([builderjer](https://github.com/builderjer))
- close serial port [\#8](https://github.com/OpenVoiceOS/ovos-i2c-detection/pull/8) ([builderjer](https://github.com/builderjer))
- 📝 Add docstrings to `feat/mk1` [\#12](https://github.com/OpenVoiceOS/ovos-i2c-detection/pull/12) ([coderabbitai[bot]](https://github.com/apps/coderabbitai))



Expand Down
29 changes: 29 additions & 0 deletions ovos_i2c_detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
from ovos_utils.log import LOG

def is_texas_tas5806():
"""
Detect the presence of a Texas TAS5806 audio amplifier via I2C communication.

Executes an I2C detection command to identify the Texas TAS5806 audio amplifier on bus 1 at address 0x2f.

Returns:
bool: True if the TAS5806 amplifier is detected, False otherwise

Notes:
- Uses i2cdetect command to probe the I2C bus
- Checks for device response with address "2f" or "UU"
- Requires i2c-tools to be installed
"""
cmd = 'i2cdetect -y -a 1 0x2f 0x2f | egrep "(2f|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"2f" or out == b"UU":
Expand Down Expand Up @@ -57,6 +70,22 @@ def is_adafruit_amp():
return False

def is_mark_1():
"""
Detect the presence of a Mark 1 device via serial communication.

Checks for the Mark 1 device by first verifying the presence of a WM8960 audio codec,
then attempting to establish a serial connection and retrieve system version information.

Returns:
bool: True if a Mark 1 device is successfully detected, False otherwise

Notes:
- Requires WM8960 audio codec to be present
- Uses serial communication on /dev/ttyAMA0 at 9600 baud
- Sends 'system.version' command to verify device
- Logs firmware version if successfully detected
- Handles potential serial communication errors gracefully
"""
if is_wm8960():
try:
ser = serial.Serial("/dev/ttyAMA0", 9600, timeout=5)
Expand Down
4 changes: 2 additions & 2 deletions ovos_i2c_detection/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 0
VERSION_BUILD = 5
VERSION_ALPHA = 0
VERSION_BUILD = 6
VERSION_ALPHA = 1
# END_VERSION_BLOCK
Loading