feat(platform): adapt GPIO configuration to new board

This commit is contained in:
chenjintao
2026-10-23 15:37:22 +08:00
parent 6d103938ab
commit aede687dc9
10 changed files with 801 additions and 421 deletions
+298 -281
View File
@@ -1,5 +1,302 @@
menu "TQ Cat Configuration"
menu "Board Hardware Configuration (GPIO)"
comment "LCD"
config TQ_SCREEN_RESET_PIN
int "Panel reset GPIO (-1 to disable hardware reset)"
default 7
range -1 48
help
The new upper board maps the ST7789P3 RES signal to IO7.
Use -1 only when panel reset is physically not connected.
config TQ_SCREEN_SPI_MISO_GPIO
int "LCD SPI MISO GPIO (-1 to disable)"
default -1
range -1 48
help
LCD SPI MISO GPIO. Use -1 when the panel does not connect MISO.
config TQ_SCREEN_SPI_MOSI_GPIO
int "LCD SPI MOSI GPIO"
default 15
range 0 48
help
LCD SPI MOSI GPIO.
config TQ_SCREEN_SPI_CLK_GPIO
int "LCD SPI clock GPIO"
default 16
range 0 48
help
LCD SPI clock GPIO.
config TQ_SCREEN_SPI_CS_GPIO
int "LCD SPI CS GPIO"
default 5
range 0 48
help
LCD SPI chip-select GPIO.
config TQ_SCREEN_DC_GPIO
int "LCD D/C GPIO"
default 6
range 0 48
help
LCD data/command GPIO.
config TQ_SCREEN_BACKLIGHT_GPIO
int "LCD backlight GPIO"
default 4
range 0 48
help
LCD backlight control GPIO.
config TQ_SCREEN_BACKLIGHT_ACTIVE_HIGH
bool "Backlight active high"
default y
comment "Audio"
config MULTIMODAL_AUDIO_I2C_SCL_GPIO
int "I2C SCL GPIO"
default 2
help
Default from docs/gpio-map.md (ES8311 control SCL on GPIO2).
config MULTIMODAL_AUDIO_I2C_SDA_GPIO
int "I2C SDA GPIO"
default 1
help
Default from docs/gpio-map.md (ES8311 control SDA on GPIO1).
config MULTIMODAL_AUDIO_I2S_MCLK_GPIO
int "I2S MCLK GPIO"
default 38
help
Default from docs/gpio-map.md (I2S_MCLK on GPIO38).
config MULTIMODAL_AUDIO_I2S_BCLK_GPIO
int "I2S BCLK GPIO"
default 39
help
Default from docs/gpio-map.md (I2S_SCLK on GPIO39).
config MULTIMODAL_AUDIO_I2S_WS_GPIO
int "I2S WS GPIO"
default 41
help
Default from docs/gpio-map.md (I2S_LRCK on GPIO41).
config MULTIMODAL_AUDIO_I2S_DOUT_GPIO
int "I2S DOUT GPIO"
default 40
help
Default from docs/gpio-map.md (MCU output to ES8311 DSDIN on GPIO40).
config MULTIMODAL_AUDIO_I2S_DIN_GPIO
int "I2S DIN GPIO"
default 42
help
Default from docs/gpio-map.md (MCU input from ES8311 ASDOUT on GPIO42).
config MULTIMODAL_AUDIO_PA_GPIO
int "PA enable GPIO (-1 to disable)"
default 9
help
Default from docs/gpio-map.md (PA_CTRL on IO9).
comment "Buttons & Digital Inputs"
config MULTIMODAL_PTT_BUTTON_GPIO
int "Push-to-talk button GPIO"
default 13
range 0 48
help
The new board routes the TTP223 touch output to GPIO13.
Verify its idle/active levels on hardware before changing
the active-level and pull-resistor settings.
config MULTIMODAL_PTT_BUTTON_ACTIVE_LEVEL
int "Push-to-talk button active level"
default 0
range 0 1
help
Logic level that means the push-to-talk button is pressed.
config MULTIMODAL_PTT_BUTTON_PULLUP
bool "Enable push-to-talk button pull-up"
default y
help
Enable the internal pull-up when required by the button wiring.
config MULTIMODAL_PTT_BUTTON_PULLDOWN
bool "Enable push-to-talk button pull-down"
default n
help
Enable the internal pull-down when required by the button wiring.
config TQ_CALIBRATION_SWITCH_GPIO
int "Direction calibration switch GPIO"
default 11
range 0 48
help
GPIO used for switch 1 on IO11 and for turntable
direction calibration.
config TQ_CALIBRATION_SWITCH_ACTIVE_LEVEL
int "Direction calibration switch active level"
default 0
range 0 1
help
Logic level that means the calibration switch is active.
config TQ_CALIBRATION_SWITCH_PULLUP
bool "Enable direction calibration switch pull-up"
default y
help
Enable the internal pull-up for the default active-low wiring.
config TQ_CALIBRATION_SWITCH_PULLDOWN
bool "Enable direction calibration switch pull-down"
default n
help
Leave disabled for the default active-low wiring.
config TQ_SLOT_SWITCH_GPIO
int "Slot feature switch GPIO"
default 12
range 0 48
help
GPIO used by the input that triggers the slot machine feature.
config TQ_SLOT_SWITCH_ACTIVE_LEVEL
int "Slot feature switch active level"
default 0
range 0 1
help
Logic level that means the slot machine feature switch is active.
config TQ_SLOT_SWITCH_PULLUP
bool "Enable slot feature switch pull-up"
default y
help
Enable the internal pull-up for the default active-low slot switch wiring.
config TQ_SLOT_SWITCH_PULLDOWN
bool "Enable slot feature switch pull-down"
default n
help
Leave disabled for the default active-low slot switch wiring.
config TQ_RESET_BUTTON_GPIO
int "Wi-Fi reset button GPIO"
default 14
range 0 48
depends on TQ_RESET_BUTTON_ENABLE
help
GPIO used for the dedicated Wi-Fi reset button when enabled.
The new board uses GPIO14 for stepper IN1. Keep this feature
disabled unless a separate reset input is physically wired
and its GPIO configured without conflicts.
config TQ_RESET_BUTTON_ACTIVE_LEVEL
int "Wi-Fi reset button active level"
default 0
range 0 1
depends on TQ_RESET_BUTTON_ENABLE
help
Logic level that means the Wi-Fi reset button is pressed.
config TQ_RESET_BUTTON_PULLUP
bool "Enable Wi-Fi reset button pull-up"
default y
depends on TQ_RESET_BUTTON_ENABLE
help
Enable the internal pull-up for active-low wiring.
config TQ_RESET_BUTTON_PULLDOWN
bool "Enable Wi-Fi reset button pull-down"
default n
depends on TQ_RESET_BUTTON_ENABLE
help
Enable the internal pull-down for active-high wiring.
comment "Stepper Motor"
config TQ_STEPPER_IN1_GPIO
int "Turntable stepper IN1 GPIO"
default 14
range 0 48
help
GPIO connected to the turntable stepper driver IN1 input.
config TQ_STEPPER_IN2_GPIO
int "Turntable stepper IN2 GPIO"
default 21
range 0 48
help
GPIO connected to the turntable stepper driver IN2 input.
config TQ_STEPPER_IN3_GPIO
int "Turntable stepper IN3 GPIO"
default 47
range 0 48
help
GPIO connected to the turntable stepper driver IN3 input.
config TQ_STEPPER_IN4_GPIO
int "Turntable stepper IN4 GPIO"
default 48
range 0 48
help
GPIO connected to the turntable stepper driver IN4 input.
comment "Power & Battery"
config TQ_POWER_HOLD_GPIO
int "Power hold GPIO (-1 to disable)"
default -1
range -1 48
help
GPIO used to keep board power enabled after boot. The new
board has no MCU-controlled power-hold net; leave disabled.
config TQ_POWER_HOLD_ACTIVE_LEVEL
int "Power hold active level"
default 1
range 0 1
help
Logic level that keeps the external power-hold circuit active.
config TQ_BATTERY_ADC_GPIO
int "Battery voltage ADC GPIO"
default 17
range 0 48
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_CHARGE_GPIO
int "TP4056 charge status GPIO (-1 to disable)"
default 18
range -1 48
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_CHARGE_ACTIVE_LEVEL
int "TP4056 charging active level"
default 0
range 0 1
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_SHUTDOWN_WAKE_BUTTON_GPIO
int "Optional active-low deep-sleep wake button GPIO (-1 to disable)"
default -1
range -1 48
depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE
endmenu
menu "Legacy LCD Driver Options"
choice LCD_TYPE
@@ -549,37 +846,6 @@ menu "TQ Cat Configuration"
configured duration clears saved Wi-Fi credentials and then
restarts the device. Other persisted data is not changed.
config TQ_RESET_BUTTON_GPIO
int "Wi-Fi reset button GPIO"
default 14
range 0 48
depends on TQ_RESET_BUTTON_ENABLE
help
GPIO used for the dedicated Wi-Fi reset button when enabled.
GPIO14 is unassigned on the current board revision.
config TQ_RESET_BUTTON_ACTIVE_LEVEL
int "Wi-Fi reset button active level"
default 0
range 0 1
depends on TQ_RESET_BUTTON_ENABLE
help
Logic level that means the Wi-Fi reset button is pressed.
config TQ_RESET_BUTTON_PULLUP
bool "Enable Wi-Fi reset button pull-up"
default y
depends on TQ_RESET_BUTTON_ENABLE
help
Enable the internal pull-up for active-low wiring.
config TQ_RESET_BUTTON_PULLDOWN
bool "Enable Wi-Fi reset button pull-down"
default n
depends on TQ_RESET_BUTTON_ENABLE
help
Enable the internal pull-down for active-high wiring.
config TQ_RESET_BUTTON_LONG_PRESS_MS
int "Wi-Fi reset button hold duration (ms)"
default 5000
@@ -699,10 +965,6 @@ menu "TQ Cat Configuration"
bool "Swap RGB565 color bytes on bus"
default y
config TQ_SCREEN_BACKLIGHT_ACTIVE_HIGH
bool "Backlight active high"
default y
config TQ_SCREEN_BACKLIGHT_BRIGHTNESS_PERCENT
int "Default backlight brightness (percent)"
default 100
@@ -730,56 +992,6 @@ menu "TQ Cat Configuration"
default 0
range 0 320
config TQ_SCREEN_RESET_PIN
int "Panel reset GPIO (-1 to disable hardware reset)"
default 17
range -1 48
help
The 2026-07-24 board maps the ST7789P3 RES signal to IO17.
Use -1 only when panel reset is physically not connected.
config TQ_SCREEN_SPI_MISO_GPIO
int "LCD SPI MISO GPIO (-1 to disable)"
default -1
range -1 48
help
LCD SPI MISO GPIO. Use -1 when the panel does not connect MISO.
config TQ_SCREEN_SPI_MOSI_GPIO
int "LCD SPI MOSI GPIO"
default 18
range 0 48
help
LCD SPI MOSI GPIO.
config TQ_SCREEN_SPI_CLK_GPIO
int "LCD SPI clock GPIO"
default 8
range 0 48
help
LCD SPI clock GPIO.
config TQ_SCREEN_SPI_CS_GPIO
int "LCD SPI CS GPIO"
default 15
range 0 48
help
LCD SPI chip-select GPIO.
config TQ_SCREEN_DC_GPIO
int "LCD D/C GPIO"
default 16
range 0 48
help
LCD data/command GPIO.
config TQ_SCREEN_BACKLIGHT_GPIO
int "LCD backlight GPIO"
default 7
range 0 48
help
LCD backlight control GPIO.
config TQ_SCREEN_SPI_PIXEL_CLOCK_HZ
int "LCD SPI pixel clock (Hz)"
default 20000000
@@ -808,32 +1020,6 @@ menu "TQ Cat Configuration"
menu "Slot Machine"
config TQ_SLOT_SWITCH_GPIO
int "Slot feature switch GPIO"
default 13
range 0 48
help
GPIO used by the input that triggers the slot machine feature.
config TQ_SLOT_SWITCH_ACTIVE_LEVEL
int "Slot feature switch active level"
default 0
range 0 1
help
Logic level that means the slot machine feature switch is active.
config TQ_SLOT_SWITCH_PULLUP
bool "Enable slot feature switch pull-up"
default y
help
Enable the internal pull-up for the default active-low slot switch wiring.
config TQ_SLOT_SWITCH_PULLDOWN
bool "Enable slot feature switch pull-down"
default n
help
Leave disabled for the default active-low slot switch wiring.
config TQ_SLOT_SWITCH_ENABLE
bool "Enable slot feature switch worker"
default y
@@ -859,110 +1045,21 @@ menu "TQ Cat Configuration"
The motor searches for the active-low switch and stops after
the configured calibration sweep if the switch is not pressed.
config TQ_STEPPER_IN1_GPIO
int "Turntable stepper IN1 GPIO"
default 45
range 0 48
help
GPIO connected to the turntable stepper driver IN1 input.
config TQ_STEPPER_IN2_GPIO
int "Turntable stepper IN2 GPIO"
default 48
range 0 48
help
GPIO connected to the turntable stepper driver IN2 input.
config TQ_STEPPER_IN3_GPIO
int "Turntable stepper IN3 GPIO"
default 47
range 0 48
help
GPIO connected to the turntable stepper driver IN3 input.
config TQ_STEPPER_IN4_GPIO
int "Turntable stepper IN4 GPIO"
default 21
range 0 48
help
GPIO connected to the turntable stepper driver IN4 input.
config TQ_CALIBRATION_SWITCH_GPIO
int "Direction calibration switch GPIO"
default 12
range 0 48
help
GPIO used for Button 1 on the SW1/IO12 net and for turntable
direction calibration.
config TQ_CALIBRATION_SWITCH_ACTIVE_LEVEL
int "Direction calibration switch active level"
default 0
range 0 1
help
Logic level that means the calibration switch is active.
config TQ_CALIBRATION_SWITCH_PULLUP
bool "Enable direction calibration switch pull-up"
default y
help
Enable the internal pull-up for the default active-low wiring.
config TQ_CALIBRATION_SWITCH_PULLDOWN
bool "Enable direction calibration switch pull-down"
default n
help
Leave disabled for the default active-low wiring.
endmenu
menu "Power & Battery"
config TQ_POWER_HOLD_GPIO
int "Power hold GPIO (-1 to disable)"
default -1
range -1 48
help
GPIO used to keep board power enabled after boot. The current
battery-sensing board uses IO9 as an ADC input and therefore
disables the legacy power-hold output by default.
config TQ_POWER_HOLD_ACTIVE_LEVEL
int "Power hold active level"
default 1
range 0 1
help
Logic level that keeps the external power-hold circuit active.
config TQ_BATTERY_ENABLE
bool "Enable battery monitoring"
default y
config TQ_BATTERY_ADC_GPIO
int "Battery voltage ADC GPIO"
default 9
range 0 48
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_CHARGE_GPIO
int "TP4057 charge status GPIO (-1 to disable)"
default 10
range -1 48
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_CHARGE_ACTIVE_LEVEL
int "TP4057 charging active level"
default 0
range 0 1
depends on TQ_BATTERY_ENABLE
config TQ_BATTERY_FULL_MIN_VOLTAGE_MV
int "Minimum voltage for charge-complete prompt (mV)"
default 4150
range 4000 4200
depends on TQ_BATTERY_ENABLE
help
The TP4057 status pin cannot distinguish charge termination
The charging-status input alone cannot distinguish charge termination
from charger removal. Require at least this filtered battery
voltage before inferring that charging has completed.
@@ -1061,12 +1158,6 @@ menu "TQ Cat Configuration"
range 3000 4200
depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE
config TQ_BATTERY_SHUTDOWN_WAKE_BUTTON_GPIO
int "Optional active-low deep-sleep wake button GPIO (-1 to disable)"
default -1
range -1 48
depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE
config TQ_BATTERY_SHUTDOWN_PROMPT_FILE
string "Critical-battery shutdown prompt file"
default "audio_prompts/shutdown_power_empty.opus"
@@ -1383,32 +1474,6 @@ menu "TQ Cat Configuration"
Fixed to push2talk. Other upstream modes are intentionally not
supported by this firmware runtime.
config MULTIMODAL_PTT_BUTTON_GPIO
int "Push-to-talk button GPIO"
default 3
range 0 48
help
GPIO used for the push-to-talk button.
config MULTIMODAL_PTT_BUTTON_ACTIVE_LEVEL
int "Push-to-talk button active level"
default 0
range 0 1
help
Logic level that means the push-to-talk button is pressed.
config MULTIMODAL_PTT_BUTTON_PULLUP
bool "Enable push-to-talk button pull-up"
default y
help
Enable the internal pull-up when required by the button wiring.
config MULTIMODAL_PTT_BUTTON_PULLDOWN
bool "Enable push-to-talk button pull-down"
default n
help
Enable the internal pull-down when required by the button wiring.
config TQ_LOCAL_WAKE_ENABLE
bool "Enable local wake-word listener"
default y
@@ -1832,18 +1897,6 @@ menu "TQ Cat Configuration"
range 0 1
default 0
config MULTIMODAL_AUDIO_I2C_SCL_GPIO
int "I2C SCL GPIO"
default 2
help
Default from docs/gpio-map.md (ES8311 control SCL on GPIO2).
config MULTIMODAL_AUDIO_I2C_SDA_GPIO
int "I2C SDA GPIO"
default 1
help
Default from docs/gpio-map.md (ES8311 control SDA on GPIO1).
config MULTIMODAL_AUDIO_I2C_ADDR
hex "ES8311 I2C address"
default 0x18
@@ -1855,46 +1908,10 @@ menu "TQ Cat Configuration"
range 0 1
default 0
config MULTIMODAL_AUDIO_I2S_MCLK_GPIO
int "I2S MCLK GPIO"
default 38
help
Default from docs/gpio-map.md (I2S_MCLK on GPIO38).
config MULTIMODAL_AUDIO_I2S_BCLK_GPIO
int "I2S BCLK GPIO"
default 39
help
Default from docs/gpio-map.md (I2S_SCLK on GPIO39).
config MULTIMODAL_AUDIO_I2S_WS_GPIO
int "I2S WS GPIO"
default 41
help
Default from docs/gpio-map.md (I2S_LRCK on GPIO41).
config MULTIMODAL_AUDIO_I2S_DOUT_GPIO
int "I2S DOUT GPIO"
default 40
help
Default from docs/gpio-map.md (MCU output to ES8311 DSDIN on GPIO40).
config MULTIMODAL_AUDIO_I2S_DIN_GPIO
int "I2S DIN GPIO"
default 42
help
Default from docs/gpio-map.md (MCU input from ES8311 ASDOUT on GPIO42).
config MULTIMODAL_AUDIO_USE_MCLK
bool "Use external MCLK"
default y
config MULTIMODAL_AUDIO_PA_GPIO
int "PA enable GPIO (-1 to disable)"
default 11
help
Default from docs/gpio-map.md (PA_CTRL on IO11).
config MULTIMODAL_AUDIO_I2S_DMA_DESC_NUM
int "I2S DMA descriptor count"
default 4