Last Updated on : 2025-03-19 07:38:50download
Wukong AI Hardware Development Framework provides basic functional examples, including systems, drivers, and networks. For more information, see Networked Product Development Framework > Example Project Description.
tuyaos_demo_ai_toy
is an AI toy demo application that supports the following features:
OPERATE_RET __soc_device_init(VOID_T)
{
OPERATE_RET rt = OPRT_OK;
// …
// …
TY_AI_TOY_PARA_T para = TY_AI_PROC_PARA_AIBOX_HOLD;
/* Network button initialization */
app_key_init(para.reset_key_pin);
/* AI toy initialization */
TUYA_CALL_ERR_RETURN(ty_ai_toy_init(¶));
TUYA_CALL_ERR_RETURN(ty_ai_toy_start());
return 0;
}
You need to configure several pins for the AI toy to enable features such as system reset, wake-up, and speaker on/off. In the demo, parameters are set by the TY_AI_TOY_PARA_T
struct, and five basic parameters are preset for a quick start. You can select or modify them as needed.
TY_AI_PROC_PARA_DEF
TY_AI_PROC_PARA_DEF2
TY_AI_PROC_PARA_CUSTOM
TY_AI_PROC_PARA_AIBOX
TY_AI_PROC_PARA_AIBOX_HOLD (default configuration)
The triggering methods include press for continuous talk and press and hold for talk. Currently, the demo is optimized only for long-press triggering.
Initialize the reset pin. Press and hold the pin for five seconds and the device will reset and re-enter pairing mode.
/**
* @brief init key
* @param[in] pin_id: key pin number
*/
VOID_T app_key_init(TUYA_GPIO_NUM_E pin_id);
Initialize the features of the AI toy.
/**
* @brief init ai toy demo
*
* @param[in/out] para: init parameters
* @return OPERATE_RET: OPRT_OK on success, others on failed
*/
OPERATE_RET ty_ai_toy_init(TY_AI_TOY_PARA_T *para);
Start the features of the AI toy.
/**
* @brief start ai toy demo
*
* @return OPERATE_RET: OPRT_OK on success, others on failed
*/
OPERATE_RET ty_ai_toy_start(void);
The demo also includes battery level detection. If the specified development board does not have the battery level detection feature, you can comment out the calls to the tuya_ai_toy_battery_init
and tuya_ai_toy_battery_uninit
interfaces in the code.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback