Skip to content

Commit

Permalink
[devkit] Add DevKit support
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed May 12, 2024
1 parent 7b69847 commit 3afd695
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
18 changes: 17 additions & 1 deletion utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ function i2c_scan() {
if i2c_get "$address"; then
if [ "$device" == "atmega328p" ]; then
detect_mark1_device
elif [ "$device" == "tas5806" ]; then
detect_devkit_device
else
DETECTED_DEVICES+=("$device")
fi
Expand Down Expand Up @@ -434,9 +436,23 @@ EOF
function detect_mark1_device() {
setup_avrdude
atmega328p="$(avrdude -C +"$RUN_AS_HOME"/.avrduderc -p atmega328p -c linuxgpio -U signature:r:-:i -F 2>>"$LOG_FILE" | head -1)"
if [ "$atmega328p" == "$ATMEGA328P_SIGNATURE" ] ; then
if [ "$atmega328p" == "$ATMEGA328P_SIGNATURE" ]; then
DETECTED_DEVICES+=("atmega328p")
return 0
fi
return 1
}

# This function checks if attiny1614 I2C device is present, this is only
# triggered when a tas5806 I2C device is detected.
function detect_devkit_device() {
if i2c_get "${SUPPORTED_DEVICES["attiny1614"]}"; then
DETECTED_DEVICES+=("attiny1614")
return 0
fi
# If attiny1614 is not detected then this is a Mark II device and not
# a DevKit device so we force back the DETECTED_DEVICES variable
# to tas5806.
DETECTED_DEVICES+=("tas5806")
return 1
}
3 changes: 2 additions & 1 deletion utils/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ export SCENARIO_ALLOWED_HIVEMIND_OPTIONS
export SCENARIO_NAME="scenario.yaml"
export SCENARIO_PATH=""
declare -rA SUPPORTED_DEVICES=(
["tas5806"]="2f" #https://www.ti.com/product/TAS5806MD
["atmega328p"]="1a" #https://www.microchip.com/en-us/product/atmega328p
["attiny1614"]="04" #https://www.microchip.com/en-us/product/attiny1614
["tas5806"]="2f" #https://www.ti.com/product/TAS5806MD
)
export SUPPORTED_DEVICES
export TUI_WINDOW_HEIGHT="35"
Expand Down

0 comments on commit 3afd695

Please sign in to comment.