Skip to content

Commit

Permalink
feat: add configurable UART3 and SPI
Browse files Browse the repository at this point in the history
Add configurable UART3 and SPI for BananaPi M2 Zero

Signed-off-by: Stephan Wendel <[email protected]>
  • Loading branch information
KwadFan committed Oct 21, 2023
1 parent 43fe27c commit 118ca51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/armbian/config
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ bash-completion"
## BananaPi M2 Zero specific
### Disable OTG Serial Interface? (true/false)
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL" ]] || ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL="true"
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3="true"
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI="true"
24 changes: 24 additions & 0 deletions src/modules/armbian/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,27 @@ if [[ "$(is_board_type)" == "bananapim2zero" ]] \
echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ... [DONE]"
fi
## END Step 8

## Step 9: Enable spi and/or UART3 on BananaPi M2 Zero
### Enable both
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" == "true" ]]; then
echo_green "Enable UART3 and SPI for 'bananapim2zero' SBC ..."
echo "overlays=uart3 spi-spidev" >> "${ARMBIAN_CONFIG_TXT_FILE}"
fi
### UART3 only
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then
echo_green "Enable UART3 for 'bananapim2zero' SBC ..."
echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}"
fi
### SPI only
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then
echo_green "Enable SPI for 'bananapim2zero' SBC ..."
echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}"
fi
## END Step 9

0 comments on commit 118ca51

Please sign in to comment.