Setup
Arduino
Install the following:
-
Arduino v2.x or newer. Please follow the installation instructions for your OS.
-
Arduino ESP32 v2.0.15 or newer. Please follow the installation guide from Espressif.
-
PowerFeather-SDK 1.0.0 or newer. Follow the instructions for installing a library.
To test if setup was done properly, create a sketch with the following content:
#include <PowerFeather.h>
using namespace PowerFeather;
void setup()
{
Board.init();
}
void loop()
{
}
The above is the minimal sketch code for PowerFeather, which just initializes the board hardware. Build the sketch, it should proceed without any errors.
ESP-IDF
ESP-IDF needs to be installed first. PowerFeather-SDK requires ESP-IDF v4.4 or newer. Please follow the installation guide for Windows or Linux and macOS.
To demonstrate adding PowerFeather-SDK to an ESP-IDF project, we'll create a sample one. Open a terminal with the ESP-IDF environment loaded on Windows or Linux and macOS. Navigate to a directory where the sample ESP-IDF project can be created, and run the command:
idf.py create-project "powerfeather_project"
Navigate into the created sample ESP-IDF project directory. Rename main/powerfeather_project.c
to main/powerfeather_project.cpp
. Your project tree should look like the following:
Edit main/CMakeLists.txt
and change powerfeather_project.c
to powerfeather_project.cpp
, to reflect the rename done in the previous step.
Replace the contents of main/main.cpp
with the following:
#include <PowerFeather.h>
using namespace PowerFeather;
extern "C" void app_main()
{
Board.init();
}
The above is the minimal ESP-IDF project code for PowerFeather, which just initializes the board hardware.
To add PowerFeather-SDK as a component for the sample ESP-IDF project, run the command:
idf.py add-dependency "powerfeather/powerfeather-sdk^1.0.0"
Build the sample ESP-IDF project by issuing the commands:
idf.py set-target esp32s3
idf.py build
If everything was set up correctly, the build should proceed without any compilation errors.