Development Environment Setup When Using Tuya Wi-Fi SDK
Last updated
Last updated
Version | Description | Date |
1.0.0 | The initial version. | 20200601 |
The Tuya device OS is a proprietary IoT operating system, which provides abundant components and you can make SDK customization according to your business requirements. It has the characteristic of lightweight, interconnection, secure transmission, fully functional components and rapid development, effectively lowering the development threshold and shortening the development cycle. It can be widely used in wearable devices, video monitors, compute gateways, smart speakers, smart locks and other smart home appliances.
The Tuya Wi-Fi SDK is developed based on Tuya device OS technology and tailored according to the Wi-Fi application in the Internet of Things scenarios. It is applicable to any Wi-Fi chip that is configured according to the Tuya Smart platform interconnection rules.
For different developing requirement, Tuya provides different strategies and services. If you have independent development ability and can develop the underlying hardware and drivers, you can use the provided SDK to adapt to the abstract interface of the development environment, so as to achieve higher flexibility for device functions.
This topic describes how to set up the development environment for Tuya Wi-Fi SDK. The development environment includes the tool chain, script, library file and other information. However, it is not necessary if you use the module provided by Tuya, or Tuya has designed the SDK to work well with the specific chip platforms. The SDK products released by Tuya have completed the compilation adaptation, interface adaptation and other configuration, you can see the README.md
file for more information.
The development environment includes the tool chain, script, library file and other information provided by the chip manufacturer, which are necessary to compile the Tuya Wi-Fi SDK. Therefore, you must set up the development environment according to the following rules to compile the SDK and firmware.
Collect the tools, libraries, and scripts of the genuine chip, send them together with compilation option and functional requirement to your Tuya account manager.
Upon receiving the material, Tuya engineers make adaptation to the toolchain of genuine chip according your requirement. Taking the RTL8720CF
as an example, see the following description for details.
Create a toolchain
folder under the root directory of the tool chain provided by the chip manufacturer.
Create a build_path
folder to export the compilation location for the toolchain.
TUYA_SDK_TOOLCHAIN_ZIP
: identifies the location of toolchain compression package. During the compilation, if this value is detected, the compression package will be decompressed.
TUYA_SDK_BUILD_PATH
: identifies the location of compiler. The Tuya automated compilation system uses this path as a prefix for the compilation tool.
Create a platform.mk
folder to interact with the Tuya continuous integration system, and perform automated SDK compilation according to your requirement.
TUYA_PLATFORM_DIR
: identifies the location of current development environment.
TUYA_PLATFORM_CFLAGS
: adds CFLAGS and the requested compilation options.
Create a build.conf
folder to customize your functional features requirement. For more information, see Appendix.
After you receive the compiled Tuya Wi-Fi SDK, you can adjust the firmware compilation process according to the following section to compile the firmware, and then burn it to the chip for implementation.
After decompressing the compiled Tuya Wi-Fi SDK, the directory is shown in the following table.
Directory | Subdirectory | Description | Reference |
| / | Stores your application and samples of the Tuya Wi-Fi SDK. It is better to create a folder for every application or sample. | See the sample of Tuya Wi-Fi SDK for usage instruction. |
| Contains one or more samples. | N/A. | |
sdk |
| Stores the header files and library files of Tuya Wi-Fi SDK. | See the API reference section for details. |
| Stores all of the APIs provided by Tuya Wi-Fi SDK. | N/A | |
| The | N/A | |
| / | Stores the development environment and toolchains of Tuya Wi-Fi SDK. The | N/A. |
| / | The compiling entry point for applications and samples. Sets up development and compilation environment. | N/A. |
| / | Records all the notable changes for each version. | N/A. |
| / | User guide written in Markdown. | N/A. |
Based on this environment, Tuya provides a set of compilation features. You can also customize the compilation process. The following instructions taking the one_plug_demo
to describe the firmware compilation process.
one_plug_demo
: downloads the development environment packages to perform the compilation script. Alternatively, the shell script and makefile are supported for compilation.
./apps/one_plug_demo/build.sh
: enters into the development environment, run the compile script, and make packages.
The compiled product will be saved to the apps/one_plug_demo/output/
directory.
The tuya_common
is stored in the Tuya Wi-Fi SDK package.
It is included in the development environment that are configured by running build_app.sh
. You can directly use the related functions in the tuya_common
folder.
The tuya_os_adapter
uses a widely applicable registration method, which provides interface description and definition, and realizes the relevant interfaces and registration, so as to achieve the platform independence of Tuya Wi-Fi SDK. You need to implement tuya_os_adapter
manually and place it in the root directory of development environment.
The Tuya HAL System provides several interfaces of the operating system. For Linux platforms, the Tuya Wi-Fi SDK provides a set of widely-used system related interfaces. These interfaces can be implemented for your customization requirements.
os_adapter_get_systemtickcount
Description
Gets the current ticket value of the system.
Parameter
None.
Return value
The current tick value of the system.
os_adapter_get_tickratems
Description
How many milliseconds to get a ticket for the system.
Parameter
None.
Return value
How many milliseconds is 1 ticket in the system.
os_adapter_system_sleep
Description
Thread sleep.
Parameter
Input or output | Parameter name | Description |
[in] | msTime | System sleep time, unit: ms. |
Return value
None.
os_adapter_system_isrstatus
Description
Gets whether the system is in the interrupt routine.
Parameter
None.
Return value
TRUE: in interrupt routine.
FALSE: not in interrupt routine.
os_adapter_system_reset
Description
Restarts the system.
Parameter
None.
Return value
None.
os_adapter_system_getheapsize
Description
Gets the remaining memory size of the system.
Parameter
None.
Return value
Remaining memory.
os_adapter_system_get_rst_info
Description
Gets the reason for system restart.
TY_RST_REASON_E | —— |
TY_RST_POWER_OFF | Power restart |
TY_RST_HARDWARE_WATCHDOG | Hardware watchdog reset |
TY_RST_FATAL_EXCEPTION | Exception |
TY_RST_SOFTWARE_WATCHDOG | Software watchdog restart |
TY_RST_SOFTWARE | Software reset |
TY_RST_DEEPSLEEP | Deep sleep |
TY_RST_HARDWARE | Hardware reset |
TY_RST_OTHER | Other causes |
TY_RST_UNSUPPORT | Not supported |
Parameter
None.
Return value
Reason for restart.
os_adapter_get_random_data
Description
Generates a random number.
Parameter
Input or output | Parameter name | Description |
[in] | range | Random number range |
Return value
A random value.
Notice
True random number.
os_adapter_set_cpu_lp_mode
Description
Sets CPU low power consumption mode.
mode | —— |
TY_CPU_SLEEP | Low power consumption mode, os auto wake up, within 15mA. |
TY_CPU_DEEP_SLEEP | Deep sleep. |
Parameter
Input or output | Parameter name | Description |
[in] | en | Whether to enable CPU low power mode. |
[in] | mode | CPU low power mode. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_CPU_LPMODE_SET_FAILED: fail
Tuya HAL Memory provides several interfaces for memory application and release. For Linux platforms, the Tuya Wi-Fi SDK provides a set of widely-used system related interfaces. These interfaces can be implemented for your customization requirements.
os_adapter_system_malloc
Description
Memory allocation.
Parameter
Input or output | Parameter name | Description |
[in] | size | Allocated memory size. |
Return value
NULL: Memory allocation failed.
Other: Assigned successfully.
Notice
Other file APIs of the adaptation layer need to apply for memory, and all calls to os_adapter_system_malloc.
os_adapter_system_free
Description
Frees up memory.
Parameter
Input or output | Parameter name | Description |
[in] | ptr | Free memory address. |
Return value
None.
Notice
The other file APIs of the adaptation layer need to release memory, and all calls to os_adapter_system_free
.
Tuya HAL Semaphore provides several interfaces for semaphore operations. For Linux platforms, the Tuya Wi-Fi SDK provides a set of widely-used system related interfaces. These interfaces can be implemented for your customization requirements.
os_adapter_semaphore_create_init
Description
Creates and initializes semaphore.
Parameter
Input or output | Parameter name | Description |
[out] | pHandle | Pointer to semaphore handle. |
[in] | semCnt | Number of initialization semaphores. |
[in] | sem_max | Maximum semaphore number. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: failed to apply for memory
OPRT_OS_ADAPTER_THRD_CREAT_FAILED: fail
os_adapter_semaphore_wait
Description
Waits for semaphore.
Parameter
Input or output | Parameter name | Description |
[in] | semHandle | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_SEM_WAIT_FAILED: fail
os_adapter_semaphore_post
Description
Sends semaphore.
Parameter
Input or output | Parameter name | Description |
[in] | mutexHandle | Semaphore handle. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_SEM_POST_FAILED: fail
Notice
You need to distinguish between thread context and interrupt context.
os_adapter_semaphore_release
Description
Frees up semaphore resources.
Parameter
Input or output | Parameter name | Description |
[in] | semHandle | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_SEM_RELEASE_FAILED: fail
Tuya HAL Mutex provides a mutex operation interface, these interfaces can be implemented for your customization requirements. If it is a Linux platform, it may not be provided. Tuya Wi-Fi SDK provides a set of common interfaces for Linux platforms.
os_adapter_mutex_create_init
Description
Creates and initializes a mutex.
Parameter
Input or output | Parameter name | Description |
[out] | pMutexHandle | Pointer to the mutex handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: failed to apply for memory
OPRT_OS_ADAPTER_MUTEX_CREAT_FAILED: fail
os_adapter_mutex_release
Description
Releases mutex resources.
Parameter
Input or output | Parameter name | Description |
[in] | mutexHandle | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MUTEX_RELEASE_FAILED: fail
os_adapter_mutex_lock
Description
Locks mutex.
Parameter
Input or output | Parameter name | Description |
[in] | mutexHandle | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MUTEX_LOCK_FAILED: fail
os_adapter_mutex_unlock
Description
Unlocks mutex.
Parameter
Input or output | Parameter name | Description |
[in] | mutexHandle | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MUTEX_UNLOCK_FAILED: fail
Notice
You need to distinguish between thread context and interrupt context.
Tuya HAL Thread provides interfaces for thread creation and release, these interfaces can be implemented for your customization requirements. If it is a Linux platform, it may not be provided. Tuya Wi-Fi SDK provides a set of common interfaces for Linux platforms.
os_adapter_thread_create
Description
Creates and starts a thread.
Parameter
Input or output | Parameter name | Description |
[out] | thread | Pointer to thread handle |
[in] | name | Thread name |
[in] | stack_size | Thread stack size, unit is byte, not 4 bytes |
[in] | priority | Thread priority |
[in] | func | Thread function |
[in] | arg | User parameters |
Return value
OPRT_OS_ADAPTER_OK: create success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: failed to apply for memory
OPRT_OS_ADAPTER_THRD_CREAT_FAILED: fail
Notice
The stack_size parameter is 1 byte as a unit.
Tuya business will use six thread priorities of 0, 1, 2, 3, 4, and 5, a lower number indicates a higher priority.
os_adapter_thread_release
Description
Releases thread resources.
Parameter
Input or output | Parameter name | Description |
[in] | thread | Semaphore handle |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_THRD_RELEASE_FAILED: fail
os_adapter_thread_is_self
Description
Determines whether the running context is in the specified thread.
Parameter
Input or output | Parameter name | Description |
[in] | thread | Semaphore handle |
[out] | is_self | Is the specified thread |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_THRD_JUDGE_SELF_FAILED: fail
Tuya HAL Watch Dog provides an interface for Watch Dog creation and refresh, which can be implemented for your customization requirements.
os_adapter_watchdog_init_start
Description
Initializes and runs watchdog.
Parameter
Input or output | Parameter name | Description |
[in] | timeval | Watchdog time |
Return value
int Watchdog time actually set by the chip.
Notice
The upper layer of the graffiti will set the watchdog time to 60s. If the chip does not support the 60s watchdog, the actual set time will be returned.
os_adapter_watchdog_refresh
Description
Refreshes watch dog.
Return value
void
os_adapter_watchdog_stop
Description
Stops watch dog.
Return value
void
Tuya HAL RTC provides an interface for RTC operation and requires different platforms to implement it, which can be implemented for your customization requirements.
os_adapter_rtc_init
Description
Initializes the internal RTC of the chip.
Return value
void no return value.
os_adapter_rtc_set_time
Description
Sets time to RTC inside the chip.
Parameter
Input or output | Parameter name | Description |
[in] | write_time | Timestamp in seconds |
Return value
Void.
os_adapter_rtc_get_time
Description
Gets the time from the internal RTC clock of chip.
Parameter
Input or output | Parameter name | Description |
[in] | void | None. |
Return value
time_t RTC
: time inside the chip, in seconds.
Tuya HAL OTA provides an interface for OTA operation, which requires different platforms to implement it.
os_adapter_ota_start_inform
Description
Sends the notification of upgrade start.
Parameter
Input or output | Parameter name | Description |
[in] | file_size | Total firmware upgrade package size. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: failed to apply for memory
OPRT_OS_ADAPTER_OTA_START_INFORM_FAILED: fail
Notice
Inform the HAL layer that the OTA upgrade is about to start. The HAL layer needs to apply in advance to upgrade OTA management resources and record the size of the OTA firmware package.
os_adapter_ota_data_process
Description
Processes The OTA packet.
Parameter
Input or output | Parameter name | Description |
[in] | total_len | The OTA upgrade firmware total size. |
[in] | offset | The offset of data pointer in OTA upgrade firmware. |
[in] | data | The buffer pointer of this OTA packet. |
[in] | len | The length of this OTA packet. |
[out] | remain_len | Length of data packets that have been delivered but not processed |
[in] | pri_data | Keep parameters, not used for now |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: failed to apply for memory
OPRT_OS_ADAPTER_OTA_PROCESS_FAILED: fail
Notice
This function is used to support OTA upgrade, which needs to be implemented in conjunction with the Tuya upgrade package pull service. There are currently two upgrade methods in Tuya:
HTTP firmware upgrade.
Private serial port protocol firmware upgrade; but for the HAL function, there is no need to care about the source of the data packet.
During the OTA upgrade process, Tuya Wi-Fi SDK will receive packets in a loop and notify this function to the OTA data packet. This function completes the work of writing the OTA data packet into the flash.
os_adapter_ota_end_inform
Description
Informs the end of OTA data download.
Parameter
Input or output | Parameter name | Description |
[in] | reset | Inform the hal layer whether the download needs to be restarted. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_OTA_VERIFY_FAILED: verification failed
OPRT_OS_ADAPTER_OTA_END_INFORM_FAILED: fail
Notice
This notification function will be called after the transmission of the OTA data packet is completed, which needs to be implemented in the secondary function: 1. Release the resources requested by the HAL layer at the beginning of OTA. 2. Do firmware integrity check 3. Modify the OTA parameter area and run the new firmware after restarting 4. Decide whether to restart according to the input parameter reset (restart logic after successful Tuya serial port upgrade is not implemented in this API)
Tuya HAL Storage provides an interface for flash operations, which can be implemented for your customization requirements.
os_adapter_flash_read
Description
Reads data from flash.
Parameter
Input or output | Parameter name | Description |
[in] | addr | The first flash address read. |
[out] | dst | The buffer pointer that receives the read data. |
[in] | size | The size of the buffer read. |
Return value
0: success;
Other: failure error code
Notice
Since it is possible for multiple threads on the Tuya upper layer to call the OS_adapter_FLASH layer API interface simultaneously, the os_adapter_flash_read, OS_adapter_flash_write, and OS_adapter_flash_erase three operation functions need to share the mutex. If the called chip Flash API itself is mutually exclusive, no locking is required.If the calling chip Flash API itself is not mutex exclusive, a mutex is added to the OS_adapter_FLASH layer.
If supported to run on the chip, operating flash may cause the system to tick, after operating Flash need to make up system tick (important).
Read a sector within 3ms.
os_adapter_flash_write
Description
Writes data to flash.
Parameter
Input or output | Parameter name | Description |
[in] | addr | Writes the first flash address. |
[in] | dst | A buffer pointer to which data is written. |
[in] | size | The size of the buffer to be written. |
Return value
0: success
Other: failure error code
Notice
Write a sector within 20ms.
os_adapter_flash_erase
Description
Erases flash block.
Parameter
Input or output | Parameter name | Description |
[in] | addr | Erase the flash first address. |
[in] | size | Flash size erased. |
Return value
0: success;
Other: failure error code
Notice
Wipe a sector within 65ms.
os_adapter_storage_get_desc
Description
Gets the KV(key-value) -Flash partition information of the chip SDK for data partitioning of graffiti application.
Parameter
None.
Return value
UNI_STORAGE_DESC_S*: KV- Flash partition information structure pointer.
Notice
You can define a static structure variable in os_adapter_storge.c
that describes the KV-Flash partition information of the chip for Tuya application data partitioning. For example:
Recommended area:
The partition name | Description | Length (recommended value) | instructions |
SIMPLE_FLASH | KV data | 0x10000(64K) | At least 32 k |
SIMPLE_FLASH_SWAP | Backup area for KV data | 0x4000(16K) | At least 12 k |
SIMPLE_FLASH_KEY_ADDR | KV encryption key storage area | 0x1000(4K) | Size immutable |
After KV Flash has determined the Flash partition, it cannot be changed. If there is any change, forward compatibility is not supported.
Tuya authorization information is stored in KV zone.
os_adapter_uf_get_desc
Description
Gets the UF_file-Flash partition information of the chip SDK for the data of the graffiti application.
Parameter
None.
Return value
UF_PARTITION_TABLE_S*: Uf_file-flash partition information structure pointer.
Notice
Tuya Uf-file is a Flash storage component of Linux file IO operation API (Open, Write,read,close, etc.). It supports the application layer to operate Flash through uf_file.h interface.
You can define a static structure variable in OS_adapter_storge. C that describes the uf_file-Flash partition information that the chip USES to partition data for Tuya.For example,
Recommended partitions (the combined size of several partitions is not less than 128K) :
partition name | Description | Description length (recommended) | instructions |
UF_FILE_1 | UF_FILE data 1 block | 0x8000(32K) | 32K, starting position can be adjusted |
UF_FILE_2 | UF_FILE data area 2 | 0x18000(96K) | 96K, starting position can be adjusted |
The Tuya HAL Output interface provides interfaces for redirecting logs, such as printing to a file or the cloud. These interfaces can be implemented for your customization requirements.
os_adapter_output_log
Description
Prints a string.
Parameter
Input or output | Parameter name | Description |
[in] | str | String pointer |
Return value
Void.
os_adapter_log_close
Description
Closes the log I/O pin. The business needs to use log UART IO as normal IO to turn off the UART function.
Parameter
Input or output | Parameter name | Description |
[in] | str | String pointer |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_LOG_CLOSE_FAILED: fail
os_adapter_log_open
Description
Restores the log I/O pin.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_LOG_OPEN_FAILED: fail
Tuya HAL Wi-Fi provides interfaces for Wi-Fi operations that requires different platforms to implement.
os_adapter_wifi_all_ap_scan
Description
Scans all AP information for the current environment.
Parameter
Input or output | Parameter name | Description |
[out] | ap_ary | Scan results |
[out] | num | Number of SCANNED AP |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_AP_SCAN_FAILED: fail
Notice
blocking function.
can only scan AP in the current country code channel list.
The ap_ary
needs to allocate memory within the API (scan multiple APS, need to allocate contiguous memory space).
The memory is released by the Tuya SDK which actively calls os_adapter_wifi_release_ap
.
os_adapter_wifi_assign_ap_scan
Description
Scans AP information for the SSID specified in the current environment.
Parameter
Input or output | Parameter name | Description |
[in] | ssid | Specify the ssid |
[out] | ap | Scan results |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_AP_SCAN_FAILED: Scan failed
Notice
Blocking function.
Only scan AP in the current country code channel list.
When an AP specifying an SSID exists in the environment, the success rate of scanning the SSID is more than 98%.
AP needs to allocate memory within the API (scanning multiple APS requires allocating continuous memory space).
The memory is released by the Tuya SDK which actively calls os_adapter_wifi_release_ap
.
os_adapter_wifi_release_ap
Description
Frees up the AP information resources.
Parameter
Input or output | Parameter name | Description |
[in] | ap | Ap information that needs to be released |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_AP_RELEASE_FAILED: fail
os_adapter_wifi_set_cur_channel
Description
Sets the signal channel.
Parameter
Input or output | Parameter name | Description |
[in] | chan | channel |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_CHAN_SET_FAILED: fail
Notice
Failed to set a channel signal outside the current national code channel range.
support to set channels in sniffer callback.
os_adapter_wifi_get_cur_channel
Description
Gets the current channel.
Parameter
Input or output | Parameter name | Description |
[out] | chan | channel |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_CHAN_GET_FAILED: fail
os_adapter_wifi_get_ip
Description
Gets WIFI IP information (IP address, gateway address, address mask).
Parameter
Input or output | Parameter name | Description |
[in] | wf | Wi-Fi model |
[out] | ip | IP information |
-------- | -------- | |
WF_STATION | station type | |
WF_AP | ap type |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_IP_GET_FAILED: fail
Notice
IP information under different modes (based on transmission reference WF) needs to be distinguished.
os_adapter_wifi_set_mac
Description
Sets the MAC address.
Parameter
Input or output | Parameter name | Description |
[in] | wf | Wi-Fi model |
[in] | mac | The MAC address |
-------- | -------- | |
WF_STATION | station type | |
WF_AP | ap type |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_MAC_SET_FAILED: fail
Notice
Permanent effect, no loss of power cut.
os_adapter_wifi_get_mac
Description
Gets the MAC address.
Parameter
Input or output | Parameter name | Description |
[in] | wf | Wi-Fi model |
[out] | mac | The MAC address |
-------- | -------- | |
WF_STATION | station type | |
WF_AP | ap type |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_MAC_GET_FAILED: fail
Notice
MAC addresses in STATIONAP mode need to distinguish between operating modes (according to transmission parameter WF).
os_adapter_wifi_set_work_mode
Description
Sets the Wi-Fi working mode.
Parameter
Input or output | Parameter name | Description |
[in] | mode | Wi-Fi working mode |
-------- | -------- | |
WWM_LOWPOWER | Low power consumption (refer to turn off Wi-Fi module) | N/A |
WWM_SNIFFER | monitor | N/A |
WWM_STATION | station | N/A |
WWM_SOFTAP | softap | N/A |
WWM_STATIONAP | stationap | N/A |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_WORKMODE_SET_FAILED: fail
Notice
From the power on the device to the call of Tuya entrance, it is required to be within 200ms.
If the device initialization time exceeds 200ms, the bottom layer can make some necessary initialization and then call Tuya entrance.Place the time consuming Wi-Fi initialization on another thread for execution.
Os_adapter_wifi_set_work_mode is the first API that Tuya service calls with Wi-Fi. In this API, it is necessary to determine whether Wi-Fi initialization has ended.If it's not finished, wait here until it's finished before proceeding to the next step (only need to judge once).
If the device is less than 200ms from electric to Tuya entrance, there is no need to consider this point.
os_adapter_wifi_get_work_mode
Description
Gets Wi-Fi working mode.
Parameter
Input or output | Parameter name | Description |
[out] | mode | Wi-Fi working mode |
-------- | -------- | N/A |
WWM_LOWPOWER | Low power consumption (refer to turn off Wi-Fi module) | N/A |
WWM_SNIFFER | monitor | N/A |
WWM_STATION | station | N/A |
WWM_SOFTAP | softap | N/A |
WWM_STATIONAP | stationap | N/A |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_WORKMODE_GET_FAILED: fail
os_adapter_wifi_sniffer_set
Description
Sets the sniffer function switch.
Parameter
Input or output | Parameter name | Description |
[in] | en | Turn sniffer on or off |
[in] | cb | Grab packet data callback |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_SNIFFER_SET_FAILED: fail
Notice
The data returned to the application includes the management data.
os_adapter_wifi_ap_start
Description
Starts AP mode.
Parameter
Input or output | Parameter name | Description |
[in] | cfg | AP configuration parameters |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_AP_START_FAILED: fail
Notice
According to MAX_CONN, the maximum number of STA can be connected in AP mode.
IP information in AP mode needs to be set according to IP information.
StationAP mode, station Port to connect router, connection process and connection if AP port has connection. The AP port should not be disconnected and broadcast packets can be sent or sent after a failure.
Ez + AP coexistence:
Softap or StationAP mode enables sniffer function and channel switching.
After enabling sniffer, the data thrown back to the callback shall include the device connection request packet of the AP port.
os_adapter_wifi_ap_stop
Description
Stops AP mode.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_AP_STOP_FAILED: fail
Notice
Different closing logic needs to be done for the current mode of softap or StationAP.
In the mode of StationAP, if the station port terminal is connected, close the AP Port process and the station port cannot be disconnected.
os_adapter_wifi_get_connected_ap_info_v2
Description
Gets AP information for fast connection.
Parameter
Input or output | Parameter name | Description |
[out] | fast_ap_info | Associated AP information |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_APINFO_GET_FAILED: fail
Notice
Fast_ap_info needs to dynamically request memory within the API.
Each time the router is reconnected successfully, the router information will be obtained once, and if there is an update, it will be synchronized to Flash.
os_adapter_fast_station_connect_v2
Description
Connects with router quickly.
Parameter
Input or output | Parameter name | Description |
[in] | fast_ap_info | Ap information required for fast connection |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_FAST_CONN_FAILED: fail
Notice
This function is not called until the first connection has been connected and restarted.
os_adapter_wifi_station_connect
Description
Connects with router.
Parameter
Input or output | Parameter name | Description |
[in] | ssid | ssid |
[in] | passwd | passwd |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_CONN_FAILED: fail
Notice
Non-blocking. After starting the connection process successfully, the upper layer will call OS_adapter_wifi_STATION_get_status to query the Wi-Fi connection status every 1s.
The function of automatic re-connection should be enabled. The re-connection time should be less than 1min.
os_adapter_wifi_station_disconnect
Description
Disconnects with router.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_DISCONN_FAILED: fail
os_adapter_wifi_station_get_conn_ap_rssi
Description
Gets the signal strength of the associated AP.
Parameter
Input or output | Parameter name | Description |
[out] | rssi | Signal strength |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_RSSI_GET_FAILED: fail
Notice
If the location of the device and router is not moved, multiple RSSI acquisition can only produce a small range of fluctuation.
The location of mobile devices and routers; rsSI acquisition will have corresponding changes.
os_adapter_wifi_get_bssid
Description
Gets the MAC address of the ASSOCIATED AP.
Parameter
Input or output | Parameter name | Description |
[out] | mac | The MAC address |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_BSSID_GET_FAILED: fail
os_adapter_wifi_station_get_status
Description
Gets the current connection status of Wi-Fi.
Parameter
Input or output | Parameter name | Description |
[out] | stat | Connection status |
WSS_IDLE | N/A | |
WSS_CONNECTING | In the connection | N/A |
WSS_PASSWD_WRONG | Password mistake | N/A |
WSS_CONN_FAIL | The connection fails | N/A |
WSS_CONN_SUCCESS | The connection is successful | N/A |
WSS_GOT_IP | DHCP success | N/A |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_STAT_GET_FAILED: fail
os_adapter_wifi_set_country_code
Description
Sets the country code.
Parameter
Input or output | Parameter name | Description |
[in] | ccode | Country code |
-------- | -------- | |
COUNTRY_CODE_CN | China 1-13 | |
COUNTRY_CODE_US | The United States district 1-11 | |
COUNTRY_CODE_JP | Japan 1-14 | |
COUNTRY_CODE_EU | European1-13 European adaptation needs to be considered |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_CCODE_SET_FAILED: fail
Notice
The country code only needs to support China (CN 1-13), US (US 1-11), Japan (JP 1-14) and Europe (EU 1-13).
For different country codes, the requirements are as follows:
When scanning routers, only AP corresponding to channel list of country code can be scanned.
The European region needs to realize the European adaptive function.
When setting the channel, the channel set is not within the range of the channel list of the current country code, and set the channel return error.
os_adapter_wifi_send_mgnt
Description
Sends management packet data.
Parameter
Input or output | Parameter name | Description |
[in] | buf | Manage package data BUF |
[in] | len | Manage packet data length |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_MGNT_SEND_FAILED: fail
os_adapter_wifi_register_recv_mgnt_callback
Description
Sets whether the application layer receives management package data.
Parameter
Input or output | Parameter name | Description |
[in] | enable | Whether to open receive management package data |
[in] | recv_cb | Receives the management package data callback |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_MGNT_REG_FAILED: fail
os_adapter_set_wifi_lp_mode
Description
Sets to the low power mode.
Parameter
Input or output | Parameter name | Description |
[in] | en | Whether Wi-Fi low power mode is on |
[in] | dtim | The dtim parameters |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_WF_LPMODE_SET_FAILED: fail
Tuya HAL BLE provides an interface to BLE operations that requires different platforms to implement.
ty_bt_param_t
ty_bt_scan_info_t
os_adapter_bt_port_init
Description
Initializes Bluetooth. In cases where RF is shared between Wi-Fi and Bluetooth, this function needs to support multiple calls, that is, it can be called again after tuya_bt_port_deinit
turns off Bluetooth.
Parameter
Input or output | Parameter name | Description |
[in] | p | Bluetooth parameter structure pointer |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_BT_INIT_FAILED: fail
Notice
You cannot add sleep to this function to wait for initialization to complete.
After Bluetooth initialization is complete, the notification is returned to the application layer via the TY_BT_EVENT_ADV_READY event.
os_adapter_bt_port_deinit
Description
Stops the Bluetooth initialization.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_DEINIT_FAILED: fail
Notice
In the case of RF sharing between Wi-Fi and Bluetooth, it is necessary to call this function to turn off Bluetooth before turning off Wi-Fi.
In the case of low power consumption, this function is called to turn off Bluetooth to achieve low power consumption.
os_adapter_bt_gap_disconnect
Description
Disconnects via the Bluetooth as a child node.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_DISCONN_FAILED: fail
os_adapter_bt_send
Description
Sends data via the Bluetooth as a child node.
Parameter
Input or output | Parameter name | Description |
[in] | data | Pointer to the data |
[in] | len | The length of the data |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_SEND_FAILED: fail
os_adapter_bt_reset_adv
Description
Resets Bluetooth broadcast content and scan response content.
Parameter
Input or output | Parameter name | Description |
[in] | adv | Bluetooth broadcast data |
[in] | lscan_respen | Bluetooth scans the response data |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_ADV_RESET_FAILED: fail
os_adapter_bt_get_rssi
Description
Gets the signal strength of Bluetooth.
Parameter
Input or output | Parameter name | Description |
[out] | rssi | Signal strength pointer |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_RSSI_GET_FAILED: fail
os_adapter_bt_start_adv
Description
Starts Bluetooth broadcasting, using the original parameters.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_BT_ADV_START_FAILED: fail
os_adapter_bt_stop_adv
Description
Stops Bluetooth broadcasting.
Parameter
None.
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_BT_ADV_STOP_FAILED: fail
9-os_adapter_bt_assign_scan
Description
Scans the specified Bluetooth name to obtain Bluetooth information for production testing.
Parameter
Input or output | Parameter name | Description |
[inout] | info | Bluetooth information |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_BT_SCAN_FAILED: fail
Notice
Scan_type is TY_BT_SCAN_BY_NAME, then the beacon for the specific Bluetooth name is scanned.
Scan_type is TY_BT_SCAN_BY_MAC, then the beacon for a particular MAC address is scanned.
The signal strength must be carried in the returned information.
Tuya HAL UART provides the interface for UART operation and requires different platforms to implement it.
TY_UART_PORT_E
The TY_UART0
is the default log port, TY_UART1
is the account, TY_UART2
, TY_UART3
is the extension serial port.
The serial port authorized by graffiti upper layer and used by users for docking is TY_UART1. If the serial port set by graffiti is corresponding to the serial port and the core.
The platform is in conflict, please make adjustments in the adaptation layer.
os_adapter_uart_init
Description
Initializes the serial port.
Parameter
Input or output | Parameter name | Description |
[in] | uart | Serial port handle, which needs to initialize the relevant parameters |
[in] | port | A serial port ID |
[in] | arg | Configuration parameters |
[in] | cb | UART RX interrupts the callback |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_UART_INIT_FAILED: fail
os_adapter_uart_deinit
Description
The serial port de-initialization function.
Parameter
Input or output | Parameter name | Description |
[in] | port | A serial port |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_UART_DEINIT_FAILED: fail
os_adapter_uart_send_char
Description
Sends data via serial port.
Parameter
Input or output | Parameter name | Description |
[in] | port | A serial port |
[in] | ch | The data to be sent |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_UART_SEND_FAILED: fail
os_adapter_uart_pool_read_char
Description
Polls data via serial port.
Parameter
Input or output | Parameter name | Description |
[in] | port | A serial port |
[out] | ch | A pointer to the received data |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_UART_READ_FAILED: fail
Tuya HAL GPIO provides interfaces to the GPIO operation and requires different platforms to implement it.
os_adapter_gpio_inout_set
Description
Sets the GPIO I/O state.
Parameter
Input or output | Parameter name | Description |
[in] | port | GPIO PORT |
[in] | in | 0: output. 1: input. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_GPIO_INOUT_SET_FAILED: fail
os_adapter_gpio_mode_set
Description
Sets the GPIO mode function.
Mode | Description |
TY_GPIO_PULLUP | Pull mode |
TY_GPIO_PULLDOWN | Dropdown mode |
TY_GPIO_PULLUP_PULLDOWN | Push-pull output mode |
TY_GPIO_OPENDRAIN | Open leaky output mode |
TY_GPIO_FLOATING | Input mode |
Parameter
Input or output | Parameter name | Description |
[in] | port | GPIO PORT |
[in] | mode | GPIO working mode |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_GPIO_MODE_SET_FAILED: fail
os_adapter_gpio_read
Description
Reads the GPIO port level state function.
Parameter
Input or output | Parameter name | Description |
[in] | port | GPIO PORT |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_GPIO_READ_FAILED: fail
os_adapter_gpio_write
Description
Sets the GPIO port level state function.
Parameter
Input or output | Parameter name | Description |
[in] | port | GPIO port |
[in] | high | Level status. 0: low level. 1: high level. |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_GPIO_WRITE_FAILED: fail
os_adapter_gpio_irq_init
Description
Initializes the GPIO port interrupt function.
trig_type | Description |
TY_IRQ_NONE | N/A |
TY_IRQ_RISE | Rising edge triggers |
TY_IRQ_FALL | Falling edge triggers |
TY_TRQ_BOTH | Triggers bilaterally |
TY_IRQ_HIGH | High level triggers |
TY_IRQ_LOW | lLow level triggers |
Parameter
Input or output | Parameter name | Description |
[in] | port | GPIO PORT |
[in] | cb | Interrupt callback function assigned to GPIO |
[in] | trig_type | Interrupt trigger source type |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_GPIO_IRQ_INIT_FAILED: fail
The Tuya HAL I2C provides interfaces for I2C operation and requires different platforms to implement it.
os_adapter_i2c_open
Description
Turn on the I2C device.
Parameter
Input or output | Parameter name | Description |
[in] | port | I2c device number |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_I2C_OPEN_FAILED: fail
os_adapter_i2c_close
Description
Turn off the I2C device.
Parameter
Input or output | Parameter name | Description |
[in] | port | I2c device number |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_I2C_CLOSE_FAILED: fail
os_adapter_i2c_read
Description
Reads the data.
Parameter
Input or output | Parameter name | Description |
[in] | port | i2c device number |
[in] | addr | slave address |
[out] | buf | reads the data buffer address |
[in] | len | buffer length |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_I2C_READ_FAILED: fail
os_adapter_i2c_write
Description
Writes data.
Parameter
Input or output | Parameter name | Description |
[in] | port | i2c device number |
[in] | addr | slave address |
[in] | buf | reads the data buffer address |
[in] | len | buffer length |
Return value
OPRT_OS_ADAPTER_OK: success
OPRT_OS_ADAPTER_INVALID_PARM: pass parameter error
OPRT_OS_ADAPTER_MALLOC_FAILED: Memory application failed
OPRT_OS_ADAPTER_I2C_WRITE_FAILED: fail
Once you have implemented the required Tuya HAL interface, you need to register these implementations with the Tuya Device OS SDK. This allows the SDK to use these implementations.
No. | Name | Value | Message |
1 | OPRT_OS_ADAPTER_INIT_MUTEX_ATTR_FAILED | -10100 | Failed to initialize synchronization properties |
2 | OPRT_OS_ADAPTER_SET_MUTEX_ATTR_FAILED | -10101 | Failed to set synchronization properties |
3 | OPRT_OS_ADAPTER_DESTROY_MUTEX_ATTR_FAILED | -10102 | Failed to destroy the synchronization attribute |
4 | OPRT_OS_ADAPTER_INIT_MUTEX_FAILED | -10103 | Failed to initialize mutex |
5 | OPRT_OS_ADAPTER_MUTEX_LOCK_FAILED | -10104 | Mutex lock failure |
6 | OPRT_OS_ADAPTER_MUTEX_TRYLOCK_FAILED | -10105 | The mutex failed to try to lock |
7 | OPRT_OS_ADAPTER_MUTEX_LOCK_BUSY | -10106 | Mutex busy |
8 | OPRT_OS_ADAPTER_MUTEX_UNLOCK_FAILED | -10107 | Mutex unlock failed |
9 | OPRT_OS_ADAPTER_MUTEX_RELEASE_FAILED | -10108 | Mutex release failed |
10 | OPRT_OS_ADAPTER_CR_MUTEX_ERR | -10109 | Mutex creation failed |
11 | OPRT_OS_ADAPTER_MEM_PARTITION_EMPTY | -10110 | Memory partition is empty |
12 | OPRT_OS_ADAPTER_MEM_PARTITION_FULL | -10111 | Memory partition is full |
13 | OPRT_OS_ADAPTER_MEM_PARTITION_NOT_FOUND | -10112 | Memory partition does not exist |
14 | OPRT_OS_ADAPTER_INIT_SEM_FAILED | -10113 | Failed to initialize semaphore |
15 | OPRT_OS_ADAPTER_WAIT_SEM_FAILED | -10114 | Failed to wait for the semaphore |
16 | OPRT_OS_ADAPTER_POST_SEM_FAILED | -10115 | Failed to release semaphore |
17 | OPRT_OS_ADAPTER_THRD_STA_UNVALID | -10116 | Thread status is illegal |
18 | OPRT_OS_ADAPTER_THRD_CR_FAILED | -10117 | Thread creation failed |
19 | OPRT_OS_ADAPTER_THRD_JOIN_FAILED | -10118 | Thread JOIN function call failed |
20 | OPRT_OS_ADAPTER_THRD_SELF_CAN_NOT_JOIN | -10119 | The own thread cannot call the JOIN function |
21 | OPRT_OS_ADAPTER_COND_CREATE_FAILED | -10120 | Failed to create condition variable |
22 | OPRT_OS_ADAPTER_COND_RELEASE_FAILED | -10121 | Failed to release condition variable |
23 | OPRT_OS_ADAPTER_COND_WAIT_FAILED | -10122 | Failed to wait for condition variable |
24 | OPRT_OS_ADAPTER_COND_WAIT_TIMEOUT | -10123 | Wait for condition variable timeout |
25 | OPRT_OS_ADAPTER_COND_SIGNAL_FAILED | -10124 | Failure to notify condition variables |
26 | OPRT_OS_ADAPTER_COND_BROADCAST_FAILED | -10125 | Failed to broadcast condition variable |
No. | Name | Default | Message |
1 | TUYA_IOT_DEBUG | 1 | Set DEBUG mode |
2 | KV_KEY_SEED | None. | Generate KEY-VALUE to store the seed of encrypted KEY1, in order to be compatible with old products (RTOS, LINUX use), new products do not need to provide |
3 | KV_KEY_PROJECT_NAME | None. | Generate KEY-VALUE to store the seed of encrypted KEY, in order to be compatible with the old product (used by LINUX), the new product does not need to provide |
4 | WIFI_GW | 1 | Enable WIFI |
5 | GW_SUPPORT_WIRED_WIFI | 0 | To enable wired + WIFI, you must ensure that WIFI_GW is also enabled |
6 | TY_BT_MOD | 0 | Bluetooth enabled |
7 | ENABLE_STATION_AP_MODE | 0 | Enable Station AP mode |
8 | KV_FILE | 0 | Enable KV_FILE, if it is 0, then use KV_FLASH, generally linux is set to 1, ROTS is set to 0 |
9 | SHUTDOWN_MODE | 1 | Enable Socket shutdown mode |
10 | LITTLE_END | 1 | Set the system endian mode |
11 | TLS_SESSION | 0 | Enable TLS session retention, each session retention will consume 240 bytes of memory |
12 | TLS_MODE | TLS_TUYA_ECC_PSK | TLS mode |
13 | ENABLE_CLOUD_OPERATION | 0 | Enable streaming service |
14 | ENABLE_SYS_RPC | 0 | Enable RPC |
15 | TY_SECURITY_CHIP | 0 | Enable security chip capability, turn on when there is a security chip |
16 | TY_RTC | 1 | Enable RTC |
17 | TY_WATCHDOG | 1 | Enable watchdog |
18 | TUYA_OPERATOR_TYPE | 0 | Third-party operator ID reporting, enabling different operators by bit |
19 | ENABLE_HTTP_TRUNK | 0 | Enable HTTP TRUNK mode |
20 | QRCODE_ACTIVE_MODE | 0 | Enable scan code distribution network |
21 | ENABLE_AP_FAST_CONNECT | 0 | Enable AP fast connection mode |
22 | TY_WIFI_FFC | 0 | Enable FFC |
23 | ENABLE_GOOGLE_LOCAL_HOME | 0 | Enable google local home control |
24 | ENABLE_LAN_LINKAGE | 1 | Enable LAN linkage |