esp-bsp

Board Support Package development guide

This guide describes necessary steps to add a new BSP to the esp-bsp project.

New BSP requirements

API conventions

BSP is a standard IDF component. You can start development by idf.py create-component your_bsp_name.

The APIs that a BSP can offer depend on the boards capabilities. For example, a board that contains audio codec will expose audio API and a board with display and touch controller will expose display and touch API.

General

#define BSP_CAPS_DISPLAY 1 #define BSP_CAPS_TOUCH 1 #define BSP_CAPS_BUTTONS 1 #define BSP_CAPS_AUDIO 1 #define BSP_CAPS_AUDIO_SPEAKER 1 #define BSP_CAPS_AUDIO_MIC 1 #define BSP_CAPS_SDCARD 0 #define BSP_CAPS_IMU 1

* Each BSP must provide a wrapper header file that can be included by `#include "bsp/esp-bsp.h"`
* BSPs that expose display and touch APIs must provide a header file `bsp/display.h` and `bsp/touch.h` that contain functions for display/touch initialization without graphical library (LVGL)
* Complete board's pinout must be in the beginning of the BSP's header file

#### I2C
* I2C can be used by many devices on the bus. The 'init' call must support multiple invocations
* Uses Kconfig for I2C peripheral selection
* Functions, which must be defined in BSP *.c file:
``` c
esp_err_t bsp_i2c_init(void);
esp_err_t bsp_i2c_deinit(void);

Display

LCD Touch

SPI Flash File System

SD card

@todo We still use extern sdmmc_card_t *bsp_sdcard; which is very ugly :( Tracked in BSP-189

@todo We could reuse code from https://github.com/espressif/esp-box/blob/master/components/bsp/src/storage/bsp_sdcard.c

Buttons

LEDs

Audio

Camera

USB

README.md conventions

@todo tracked in BSP-362