GithubHelp home page GithubHelp logo

iotpeanut / arduino-library-with-idf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sukesh-ak/arduino-library-with-idf

0.0 0.0 0.0 11 KB

Integrating Arduino Library into ESP-IDF project

License: The Unlicense

C++ 46.90% CMake 18.54% Dockerfile 34.56%

arduino-library-with-idf's Introduction

INTEGRATING ARDUINO LIBRARY IN ESP-IDF

Make sure to use latest ESP-IDF & Arduino released version
We are going to integrate SparkFun_u-blox_GNSS_Arduino_Library as a component to our sample ESP-IDF project.
This Sparkfun library is taken as an example so you could use any other library you need.

Detailed Steps below

  1. Clone my ESP-IDF C++ template git clone https://github.com/sukesh-ak/ESP-IDF-CPP-Template.git
  2. Set device target idf.py set-target esp32 (or esp32s2 / esp32c3 / esp32s3)
  3. Change firmware/project name in CMakeLists.txt file in the root CMakeLists.txt
  4. Create components folder mkdir components && cd components
  5. Add Arduino as submodule with folder name arduino
git submodule add https://github.com/espressif/arduino-esp32.git arduino 
  1. Add SparkFun_u-blox_GNSS_Arduino_Library as submodule with folder name SparkFun_u-blox_GNSS
git submodule add https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library.git SparkFun_u-blox_GNSS
  1. Create CMakeLists.txt file inside the SparkFun_u-blox_GNSS library folder
# CMakeFiles.txt inside "SparkFun_u-blox_GNSS" folder
cmake_minimum_required(VERSION 3.5)
idf_component_register(SRCS "src/SparkFun_u-blox_GNSS_Arduino_Library.cpp"
                    INCLUDE_DIRS "src/."
                    REQUIRES "arduino" # Library requires Arduino
                    )

project(SparkFun_u-blox_GNSS)
  1. Update CMakeLists.txt file in the main folder
    See the file content here CMakeLists.txt
# Application requires SparkFun_u-blox_GNSS
set(COMPONENT_REQUIRES "SparkFun_u-blox_GNSS")
idf_component_register(SRCS "main.cpp"
                    INCLUDE_DIRS ".")
  1. Run idf.py menuconfig
  2. Build idf.py build
  3. Flash idf.py -p <serial-port> flash

Folder contents

The project contains one source file in C++ language main.cpp. The file is located in folder main.

ESP-IDF projects are built using CMake. The project build configuration is contained in CMakeLists.txt files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both).

Below is short explanation of remaining files in the project folder.

├── CMakeLists.txt
├── components [step 4]
│   ├── arduino [submodules - step 5]
│   └── SparkFun_u-blox_GNSS [submodules - step 6]
│       └── CMakeLists.txt [created in Step 7]
├── main
│   ├── CMakeLists.txt
│   └── main.cpp
└── README.md                  This is the file you are currently reading

Credits

Sparkfun U-Blox GNSS Library

arduino-library-with-idf's People

Contributors

sukesh-ak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.