| name | tuyaos-hardware-vibe-coding |
| description | Hardware-aware code generation for TuyaOS (tuyaos-legacy) apps. Confirms pins/instance with the user, writes tkl_*/tal_* driver code under apps/<app>/src, and registers sources/headers in local.mk when needed. Canonical demos: software/TuyaOS/apps/tuyaos_demo_examples/src/examples/. GPIO、PWM、I2C、SPI、ADC、定时器、看门狗、麦克风、喇叭、DVP 摄像头、WiFi、BLE、 蓝牙、联网、STA、AP、扫网、广播、扫描、串口、外设初始化、硬件驱动、点灯、按键、 录音、播放、引脚、片上外设、TuyaOS 硬件。 |
| when_to_use | Use for ANY hardware / peripheral / connectivity request on a TuyaOS project — GPIO, PWM, I2C, SPI, ADC, timer, watchdog, mic, speaker, DVP camera, Wi-Fi (STA/AP/scan/LP), BLE (peripheral/central/remote), or "make the hardware do X". Load this skill FIRST; it routes to the matching TuyaOS peripheral sub-skill. Do NOT use on TuyaOpen (tos.py / TDL) projects. |
| id | tuyaos-hardware-vibe-coding |
| surfaces | ["embedded"] |
| tags | ["hardware","peripheral","vibe-coding","tuyaos","tkl","gpio","pwm","i2c","spi","adc","wifi","ble","bluetooth"] |
| default_enabled | true |
| related | ["tuyaos-build","tyutool-cli","smart-product-dev"] |
TuyaOS Hardware Vibe Coding
TuyaOS-only. Separate from TuyaOpen hardware-vibe-coding (TDD/TDL /
board-context.md). Do not load or copy TuyaOpen peripheral skills here.
Architecture (TuyaOS)
App code calls TKL / TAL drivers directly:
App (apps/<app>/src/*.c)
→ tkl_* (GPIO / I2C / SPI / PWM / ADC / timer / audio / video …)
→ tal_* (log / thread / system / watchdog …)
There is no board_register_hardware(), no tdl_* device layer, and
no .tuyaopen/board-context.md on TuyaOS projects.
Read these first
- Project root —
tuya.json + software/TuyaOS/.
- Active app —
.tuyaos/status.json → activeApp, or user-named app under
software/TuyaOS/apps/<app>/.
- App sources —
apps/<app>/src/, headers in include/ or beside sources.
apps/<app>/local.mk — how sources/headers are registered (see tuyaos-build).
- Reference demos (always prefer reading the real file over inventing APIs):
software/TuyaOS/apps/tuyaos_demo_examples/src/examples/
driver_gpio/ driver_i2c/ driver_pwm/ driver_adc/
driver_spi/ driver_timer/ driver_mic/ driver_speaker/
driver_dvp/ os_watchdog/ os_wifi/ os_ble/
service_ble_remote/ service_ffc_master/ service_ffc_slaver/
If the demo app is not in the current tree, still use the same API names from
the sub-skills below; pin numbers must come from the user / board schematic.
Rules (must follow)
- Confirm pins / instance before code. Ask which GPIO / PWM id / I2C port /
SPI id / ADC channel when the user did not specify. Do not invent board pins.
- Match existing app style. If the app uses
STATIC/VOID/TAL_PR_*, keep
that; if it uses POSIX C, keep that. Prefer the style already in tuya_app_main.c.
- Wire new files in . New under must appear in
; new header dirs in or
. Paths outside the app (e.g. ) use
— see .