Skip to content
Angus Gratton edited this page Jul 6, 2016 · 2 revisions

Header files for esp-open-rtos are spread through the directory structure a bit. Here are the main places to look.

core/include

The "core" component contains header files for programs to access esp-open-rtos core features. This directory is added to the include path, so you can just #include these files directly.

core/include/esp/

The core/include/esp subdirectory contains core headers specific for ESP8266 hardware access. Each ESP8266 peripheral has a header providing access to the peripheral registers, ie esp/timer_regs.h. Then there is a wrapper header, ie esp/timer.h, which contains simpler task-specific wrapper functions for the peripheral.

Use the esp/ directory prefix to include these headers, ie #include <esp/timer.h>.

You can use either the wrappers or the direct registers to access the peripheral, but usually the wrapper has the more programmer-friendly functions.

Register access headers include non-documented registers named _unknown. If you uncover the behaviour of any unknown registers, please consider submitting a PR to document/rename them.

include/espressif

This directory contains the Espressif ESP8266 SDK access functions, provided in Espressif's SDK library. Include these in the same way as writing code for the Espressif SDK, ie #include <espressif/esp_wifi.h>.

In esp-open-rtos, all of the functions provided in these headers are prefixed with sdk_, ie sdk_system_rtc_mem_read.

The espressif/ directory also contains the espressif/esp8266/eagle_soc.h header, which is Espressif's register access header. This header works via macros READ_PERI_REG(), WRITE_PERI_REG(), etc. We do not recommend you use this approach for writing register access code, the esp-open-rtos register access headers allow for much more readable code.

open_esplibs/include/esplibs

This directory contains internal interfaces used inside the Espressif SDK libraries. This header interface is not stable and not recommended for use in esp-open-rtos programs. You will find them used internally inside some core functions, and the open_esplibs source functions themselves.

For most SDK functions, you should be able to find a function in include/espressif that provides the functionality you need.

extras/...

Each component in "extras" usually contains at least one header directory which is added to the search path by the component. Exactly which paths to use are specific to the component, but there is usually an example which shows how to include the headers for the component.