├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── CMakeLists.txt ├── LICENSE ├── README.md ├── dependencies.lock └── main ├── CMakeLists.txt └── main.cpp /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM espressif/idf:release-v4.3 2 | 3 | ARG DEBIAN_FRONTEND=nointeractive 4 | 5 | RUN apt-get update \ 6 | && apt install -y -q \ 7 | cmake \ 8 | git \ 9 | libglib2.0-0 \ 10 | libnuma1 \ 11 | libpixman-1-0 12 | 13 | RUN ./opt/esp/entrypoint.sh && pip install --no-cache-dir idf-component-manager 14 | 15 | # QEMU 16 | ENV QEMU_REL=esp-develop-20210220 17 | ENV QEMU_SHA256=44c130226bdce9aff6abf0aeaab44f09fe4f2d71a5f9225ac1708d68e4852c02 18 | ENV QEMU_DIST=qemu-${QEMU_REL}.tar.bz2 19 | ENV QEMU_URL=https://github.com/espressif/qemu/releases/download/${QEMU_REL}/${QEMU_DIST} 20 | 21 | ENV LC_ALL=C.UTF-8 22 | ENV LANG=C.UTF-8 23 | ENV IDF_PYTHON_ENV_PATH=/opt/esp/python_env/idf4.3_py3.6_env 24 | 25 | RUN wget --no-verbose ${QEMU_URL} \ 26 | && echo "${QEMU_SHA256} *${QEMU_DIST}" | sha256sum --check --strict - \ 27 | && tar -xf $QEMU_DIST -C /opt \ 28 | && rm ${QEMU_DIST} 29 | 30 | ENV PATH=/opt/qemu/bin:${PATH} 31 | 32 | RUN echo $($IDF_PATH/tools/idf_tools.py export) >> $HOME/.bashrc 33 | 34 | ENTRYPOINT [ "/opt/esp/entrypoint.sh" ] 35 | 36 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/ubuntu 3 | { 4 | "name": "ESP-IDF QEMU", 5 | "build": { 6 | "dockerfile": "Dockerfile" 7 | }, 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "bash", 10 | "idf.espIdfPath": "/opt/esp/idf", 11 | "idf.customExtraPaths": "", 12 | "idf.pythonBinPath": "/opt/esp/python_env/idf4.3_py3.6_env/bin/python", 13 | "idf.toolsPath": "/opt/esp", 14 | "idf.gitPath": "/usr/bin/git" 15 | }, 16 | // Add the IDs of extensions you want installed when the container is created. 17 | "extensions": [ 18 | "ms-vscode.cpptools", 19 | "espressif.esp-idf-extension" 20 | ], 21 | 22 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 23 | // "forwardPorts": [], 24 | 25 | // Use 'postCreateCommand' to run commands after the container is created. 26 | // "postCreateCommand": "bash /opt/esp/entrypoint.sh", 27 | 28 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 29 | // "remoteUser": "vscodeuser" 30 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: sukesh-ak # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | sdkconfig 3 | sdkconfig.old -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "arduino"] 2 | path = arduino 3 | url = https://github.com/espressif/arduino-esp32.git 4 | [submodule "components/arduino"] 5 | path = components/arduino 6 | url = https://github.com/espressif/arduino-esp32.git 7 | [submodule "components/Adafruit_BMP3XX"] 8 | path = components/Adafruit_BMP3XX 9 | url = https://github.com/adafruit/Adafruit_BMP3XX.git 10 | [submodule "components/SparkFun_u-blox_GNSS"] 11 | path = components/SparkFun_u-blox_GNSS 12 | url = https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library.git 13 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "ESP-IDF", 5 | "compilerPath": "", 6 | "cStandard": "c11", 7 | "cppStandard": "c++17", 8 | "includePath": [ 9 | "${config:idf.espIdfPath}/components/**", 10 | "${config:idf.espIdfPathWin}/components/**", 11 | "${config:idf.espAdfPath}/components/**", 12 | "${config:idf.espAdfPathWin}/components/**", 13 | "${workspaceFolder}/**" 14 | ], 15 | "browse": { 16 | "path": [ 17 | "${config:idf.espIdfPath}/components", 18 | "${config:idf.espIdfPathWin}/components", 19 | "${config:idf.espAdfPath}/components/**", 20 | "${config:idf.espAdfPathWin}/components/**", 21 | "${workspaceFolder}" 22 | ], 23 | "limitSymbolsToIncludedHeaders": false 24 | } 25 | } 26 | ], 27 | "version": 4 28 | } 29 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "espidf", 6 | "name": "Launch", 7 | "request": "launch" 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "C_Cpp.intelliSenseEngine": "Tag Parser", 3 | "idf.adapterTargetName": "esp32" 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build - Build project", 6 | "type": "shell", 7 | "command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py build", 8 | "windows": { 9 | "command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py build", 10 | "options": { 11 | "env": { 12 | "PATH": "${env:PATH};${config:idf.customExtraPaths}" 13 | } 14 | } 15 | }, 16 | "options": { 17 | "env": { 18 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}" 19 | } 20 | }, 21 | "problemMatcher": [ 22 | { 23 | "owner": "cpp", 24 | "fileLocation": [ 25 | "relative", 26 | "${workspaceFolder}" 27 | ], 28 | "pattern": { 29 | "regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 30 | "file": 1, 31 | "line": 2, 32 | "column": 3, 33 | "severity": 4, 34 | "message": 5 35 | } 36 | }, 37 | { 38 | "owner": "cpp", 39 | "fileLocation": "absolute", 40 | "pattern": { 41 | "regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 42 | "file": 1, 43 | "line": 2, 44 | "column": 3, 45 | "severity": 4, 46 | "message": 5 47 | } 48 | } 49 | ], 50 | "group": { 51 | "kind": "build", 52 | "isDefault": true 53 | } 54 | }, 55 | { 56 | "label": "Set ESP-IDF Target", 57 | "type": "shell", 58 | "command": "${command:espIdf.setTarget}", 59 | "problemMatcher": { 60 | "owner": "cpp", 61 | "fileLocation": "absolute", 62 | "pattern": { 63 | "regexp": "^(.*):(//d+):(//d+)://s+(warning|error)://s+(.*)$", 64 | "file": 1, 65 | "line": 2, 66 | "column": 3, 67 | "severity": 4, 68 | "message": 5 69 | } 70 | } 71 | }, 72 | { 73 | "label": "Clean - Clean the project", 74 | "type": "shell", 75 | "command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py fullclean", 76 | "windows": { 77 | "command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py fullclean", 78 | "options": { 79 | "env": { 80 | "PATH": "${env:PATH};${config:idf.customExtraPaths}" 81 | } 82 | } 83 | }, 84 | "options": { 85 | "env": { 86 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}" 87 | } 88 | }, 89 | "problemMatcher": [ 90 | { 91 | "owner": "cpp", 92 | "fileLocation": [ 93 | "relative", 94 | "${workspaceFolder}" 95 | ], 96 | "pattern": { 97 | "regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 98 | "file": 1, 99 | "line": 2, 100 | "column": 3, 101 | "severity": 4, 102 | "message": 5 103 | } 104 | }, 105 | { 106 | "owner": "cpp", 107 | "fileLocation": "absolute", 108 | "pattern": { 109 | "regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 110 | "file": 1, 111 | "line": 2, 112 | "column": 3, 113 | "severity": 4, 114 | "message": 5 115 | } 116 | } 117 | ] 118 | }, 119 | { 120 | "label": "Flash - Flash the device", 121 | "type": "shell", 122 | "command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py -p ${config:idf.port} -b ${config:idf.flashBaudRate} flash", 123 | "windows": { 124 | "command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py flash -p ${config:idf.portWin} -b ${config:idf.flashBaudRate}", 125 | "options": { 126 | "env": { 127 | "PATH": "${env:PATH};${config:idf.customExtraPaths}" 128 | } 129 | } 130 | }, 131 | "options": { 132 | "env": { 133 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}" 134 | } 135 | }, 136 | "problemMatcher": [ 137 | { 138 | "owner": "cpp", 139 | "fileLocation": [ 140 | "relative", 141 | "${workspaceFolder}" 142 | ], 143 | "pattern": { 144 | "regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 145 | "file": 1, 146 | "line": 2, 147 | "column": 3, 148 | "severity": 4, 149 | "message": 5 150 | } 151 | }, 152 | { 153 | "owner": "cpp", 154 | "fileLocation": "absolute", 155 | "pattern": { 156 | "regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 157 | "file": 1, 158 | "line": 2, 159 | "column": 3, 160 | "severity": 4, 161 | "message": 5 162 | } 163 | } 164 | ] 165 | }, 166 | { 167 | "label": "Monitor: Start the monitor", 168 | "type": "shell", 169 | "command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py -p ${config:idf.port} monitor", 170 | "windows": { 171 | "command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py -p ${config:idf.portWin} monitor", 172 | "options": { 173 | "env": { 174 | "PATH": "${env:PATH};${config:idf.customExtraPaths}" 175 | } 176 | } 177 | }, 178 | "options": { 179 | "env": { 180 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}" 181 | } 182 | }, 183 | "problemMatcher": [ 184 | { 185 | "owner": "cpp", 186 | "fileLocation": [ 187 | "relative", 188 | "${workspaceFolder}" 189 | ], 190 | "pattern": { 191 | "regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 192 | "file": 1, 193 | "line": 2, 194 | "column": 3, 195 | "severity": 4, 196 | "message": 5 197 | } 198 | }, 199 | { 200 | "owner": "cpp", 201 | "fileLocation": "absolute", 202 | "pattern": { 203 | "regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 204 | "file": 1, 205 | "line": 2, 206 | "column": 3, 207 | "severity": 4, 208 | "message": 5 209 | } 210 | } 211 | ], 212 | "dependsOn": "Flash - Flash the device" 213 | }, 214 | { 215 | "label": "OpenOCD: Start openOCD", 216 | "type": "shell", 217 | "presentation": { 218 | "echo": true, 219 | "reveal": "never", 220 | "focus": false, 221 | "panel": "new" 222 | }, 223 | "command": "openocd -s ${command:espIdf.getOpenOcdScriptValue} ${command:espIdf.getOpenOcdConfigs}", 224 | "windows": { 225 | "command": "openocd.exe -s ${command:espIdf.getOpenOcdScriptValue} ${command:espIdf.getOpenOcdConfigs}", 226 | "options": { 227 | "env": { 228 | "PATH": "${env:PATH};${config:idf.customExtraPaths}" 229 | } 230 | } 231 | }, 232 | "options": { 233 | "env": { 234 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}" 235 | } 236 | }, 237 | "problemMatcher": { 238 | "owner": "cpp", 239 | "fileLocation": "absolute", 240 | "pattern": { 241 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 242 | "file": 1, 243 | "line": 2, 244 | "column": 3, 245 | "severity": 4, 246 | "message": 5 247 | } 248 | } 249 | }, 250 | { 251 | "label": "adapter", 252 | "type": "shell", 253 | "command": "${config:idf.pythonBinPath}", 254 | "isBackground": true, 255 | "options": { 256 | "env": { 257 | "PATH": "${env:PATH}:${config:idf.customExtraPaths}", 258 | "PYTHONPATH": "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter" 259 | } 260 | }, 261 | "problemMatcher": { 262 | "background": { 263 | "beginsPattern": "\bDEBUG_ADAPTER_STARTED\b", 264 | "endsPattern": "DEBUG_ADAPTER_READY2CONNECT", 265 | "activeOnStart": true 266 | }, 267 | "pattern": { 268 | "regexp": "(\\d+)-(\\d+)-(\\d+)\\s(\\d+):(\\d+):(\\d+),(\\d+)\\s-(.+)\\s(ERROR)", 269 | "file": 8, 270 | "line": 2, 271 | "column": 3, 272 | "severity": 4, 273 | "message": 9 274 | } 275 | }, 276 | "args": [ 277 | "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter_main.py", 278 | "-e", 279 | "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf", 280 | "-s", 281 | "${command:espIdf.getOpenOcdScriptValue}", 282 | "-ip", 283 | "localhost", 284 | "-dn", 285 | "${config:idf.adapterTargetName}", 286 | "-om", 287 | "connect_to_instance" 288 | ], 289 | "windows": { 290 | "command": "${config:idf.pythonBinPathWin}", 291 | "options": { 292 | "env": { 293 | "PATH": "${env:PATH};${config:idf.customExtraPaths}", 294 | "PYTHONPATH": "${command:espIdf.getExtensionPath}/esp_debug_adapter/debug_adapter" 295 | } 296 | } 297 | } 298 | } 299 | ] 300 | } -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about build system see 2 | # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html 3 | # The following five lines of boilerplate have to be in your project's 4 | # CMakeLists in this exact order for cmake to work correctly 5 | cmake_minimum_required(VERSION 3.5) 6 | 7 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 8 | project(arduino-lib-idf) 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # INTEGRATING ARDUINO LIBRARY IN ESP-IDF 2 | **Make sure to use latest ESP-IDF & Arduino `released version`** 3 | We are going to integrate `SparkFun_u-blox_GNSS_Arduino_Library` as a component to our sample `ESP-IDF` project. 4 | This `Sparkfun` library is taken as an example so you could use any other library you need. 5 | 6 | ## Detailed Steps below 7 | > 1. Clone my ESP-IDF C++ template `git clone https://github.com/sukesh-ak/ESP-IDF-CPP-Template.git` 8 | > 2. Set device target `idf.py set-target esp32` (or esp32s2 / esp32c3 / esp32s3) 9 | > 3. Change firmware/project name in CMakeLists.txt file in the root [CMakeLists.txt](CMakeLists.txt) 10 | > 4. Create `components` folder `mkdir components && cd components` 11 | > 5. Add `Arduino` as submodule with folder name `arduino` 12 | ``` 13 | git submodule add https://github.com/espressif/arduino-esp32.git arduino 14 | ``` 15 | > 6. Add `SparkFun_u-blox_GNSS_Arduino_Library` as submodule with folder name `SparkFun_u-blox_GNSS` 16 | ``` 17 | git submodule add https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library.git SparkFun_u-blox_GNSS 18 | ``` 19 | > 7. Create CMakeLists.txt file inside the `SparkFun_u-blox_GNSS` library folder 20 | 21 | ```CMake 22 | # CMakeFiles.txt inside "SparkFun_u-blox_GNSS" folder 23 | cmake_minimum_required(VERSION 3.5) 24 | idf_component_register(SRCS "src/SparkFun_u-blox_GNSS_Arduino_Library.cpp" 25 | INCLUDE_DIRS "src/." 26 | REQUIRES "arduino" # Library requires Arduino 27 | ) 28 | 29 | project(SparkFun_u-blox_GNSS) 30 | ``` 31 | > 8. Update CMakeLists.txt file in the main folder 32 | See the file content here [CMakeLists.txt](main/CMakeLists.txt) 33 | ```CMake 34 | # Application requires SparkFun_u-blox_GNSS 35 | set(COMPONENT_REQUIRES "SparkFun_u-blox_GNSS") 36 | idf_component_register(SRCS "main.cpp" 37 | INCLUDE_DIRS ".") 38 | ``` 39 | > 9. Run `idf.py menuconfig` 40 | > 10. Build `idf.py build` 41 | > 11. Flash `idf.py -p flash` 42 | 43 | ## Folder contents 44 | The project contains one source file in C++ language [main.cpp](main/main.cpp). The file is located in folder [main](main). 45 | 46 | ESP-IDF projects are built using CMake. The project build configuration is contained in `CMakeLists.txt` 47 | files that provide set of directives and instructions describing the project's source files and targets 48 | (executable, library, or both). 49 | 50 | Below is short explanation of remaining files in the project folder. 51 | 52 | ``` 53 | ├── CMakeLists.txt 54 | ├── components [step 4] 55 | │   ├── arduino [submodules - step 5] 56 | │   └── SparkFun_u-blox_GNSS [submodules - step 6] 57 | │   └── CMakeLists.txt [created in Step 7] 58 | ├── main 59 | │   ├── CMakeLists.txt 60 | │   └── main.cpp 61 | └── README.md This is the file you are currently reading 62 | ``` 63 | 64 | ## Credits 65 | [Sparkfun U-Blox GNSS Library](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library) 66 | -------------------------------------------------------------------------------- /dependencies.lock: -------------------------------------------------------------------------------- 1 | manifest_hash: c770a695e065f94af8cb38482af465269b65b1f159ce7f6157a3d0b20bea8145 2 | target: esp32 3 | version: 1.0.0 4 | -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_REQUIRES "SparkFun_u-blox_GNSS") 2 | 3 | idf_component_register(SRCS "main.cpp" 4 | INCLUDE_DIRS ".") 5 | -------------------------------------------------------------------------------- /main/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Converted code from this Arduino example 4 | // examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino 5 | 6 | #include 7 | 8 | SFE_UBLOX_GNSS myGNSS; 9 | static const char *TAG = "MAIN"; 10 | 11 | // Enabling C++ compile 12 | extern "C" { void app_main(); } 13 | 14 | void app_main(void) 15 | { 16 | Wire.begin(); 17 | 18 | if (myGNSS.begin() == false) 19 | { 20 | ESP_LOGE(TAG,"u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."); 21 | while (1); 22 | } 23 | 24 | myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise) 25 | myGNSS.setNavigationFrequency(2); //Produce two solutions per second 26 | myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution 27 | //myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR 28 | 29 | 30 | // loop replacement of Arduino 31 | // But usually in ESP-IDF tasks are used to handle logic 32 | while(1) 33 | { 34 | if (myGNSS.getPVT() && (myGNSS.getInvalidLlh() == false)) 35 | { 36 | Serial.println(); 37 | long latitude = myGNSS.getLatitude(); 38 | long longitude = myGNSS.getLongitude(); 39 | 40 | ESP_LOGE(TAG,"Lat: %ld, Lon: %ld (degrees * 10^-7)", latitude, longitude); 41 | } 42 | } 43 | } --------------------------------------------------------------------------------