Skip to content

Library wrapper for Tuya IoT Core SDK for Embedded C SDK

License

Notifications You must be signed in to change notification settings

gcopoix/tuya-iot-core-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This wrapper modifies the original Tuya SDK so it conveniently can be used as single library for own projects / targets.

The modifications

The following modifications/enhancements are applied to the original Tuya SDK:

Usage

As we now have a single Tuya SDK library, we can conveniently use and embed it to our project

  1. as git submodule in your project and FetchContent_Declare() / FetchContent_MakeAvailable():

    make_minimum_required( VERSION 3.11.0 )
    project( my_project LANGUAGES C )
    
    include( FetchContent )
    
    # add Tuya IoT Core SDK
    FetchContent_Declare( tuya-iot-core-sdk
        SOURCE_DIR ${CMAKE_SOURCE_DIR}/tuya-iot-core-sdk
    )
    FetchContent_MakeAvailable( tuya-iot-core-sdk )
    
    # my project as executable
    # (we can simply use / start from a copy of a Tuya SDK example source file we copy to our local project
    #  e.g. tuya-iot-core-sdk/examples/data_model_basic_demo/data_model_basic_demo.c)
    add_executable( my_project
        data_model_basic_demo.c
    )
    
    # link Tuya SDK as dependency to my project
    add_dependencies( my_project tuya-iot-core-sdk )
    target_link_libraries( my_project tuya-iot-core-sdk )
    
  2. directly by FetchContent_Declare() / FetchContent_MakeAvailable() (populate at configure time):

    make_minimum_required( VERSION 3.11.0 )
    project( my_project LANGUAGES C )
    
    include( FetchContent )
    
    # add Tuya IoT Core SDK
    FetchContent_Declare( tuya-iot-core-sdk
        GIT_REPOSITORY https://github.com/gcopoix/tuya-iot-core-sdk.git
        GIT_TAG        <commit hash>
    )
    FetchContent_MakeAvailable( tuya-iot-core-sdk )
    
    # my project as executable
    # (we can simply use / start from a copy of a Tuya SDK example source file we copy to our local project
    #  e.g. tuya-iot-core-sdk/examples/data_model_basic_demo/data_model_basic_demo.c)
    add_executable( my_project
        data_model_basic_demo.c
    )
    
    # link Tuya SDK as dependency to my project
    add_dependencies( my_project tuya-iot-core-sdk )
    target_link_libraries( my_project tuya-iot-core-sdk )
    
  3. as git submodule in your project and add_subdirectory():

    make_minimum_required( VERSION 3.5.0 )
    project( my_project LANGUAGES C )
    
    # add Tuya IoT Core SDK
    add_subdirectory( tuya-iot-core-sdk )
    
    # my project as executable
    # (we can simply use / start from a copy of a Tuya SDK example source file we copy to our local project
    #  e.g. tuya-iot-core-sdk/examples/data_model_basic_demo/data_model_basic_demo.c)
    add_executable( my_project
        data_model_basic_demo.c
    )
    
    # link Tuya SDK as dependency to my project
    add_dependencies( my_project tuya-iot-core-sdk )
    target_link_libraries( my_project tuya-iot-core-sdk )
    

Cross Compiling

With the modifications above the Tuya SDK library now can be cross compiled.
To fulfill the dependencies for a cross compiled Tuya SDK please implement the platform wrappers for your own target:

An ESP-IDF wrapper implementation is mentioned e.g. here

More information about cross compiling in the cmake documentation.

About

Library wrapper for Tuya IoT Core SDK for Embedded C SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages