Categories
Electronics Home Automation

How to use Espressif SDK functions in the Arduino ESP8266 IDE

I found myself wanting to use one of the espressif SDK functions in the ESP8266 Arduino IDE.  It took me longer then it should have to work it out so I thought I’d share it!  The first step is to make sure you’ve got the ESP8266 library and boards setup properly.  (see the documentation) In the sketch you’d like to include the espressif function in, paste the following up the top:

extern "C" {
    #include "user_interface.h"
}

Just replace “user_interface.h” with the name the espressif documentation tells you to.  What this does is tells the arduino IDE to include the espressif library.  (which is a standard C library)  This little trick should also work for any standard C library.

The correct name for each API can be found at the top of the relevant espressif documentation page. (their documentation – choose the latest “NON-OS SDK”)  Here is an example of the force sleep api:

Leave a Reply

Your email address will not be published.