Skip to content

crosspad_s3.h

Generated from crosspad_s3.h in platform-idf. Edit the header’s doxygen comments to change this page.

ESP BSP: CrossPad.

esp_err_t bsp_audio_init(const i2s_std_config_t *i2s_config)

Init audio (legacy single-codec path)

Note: Prefer bsp_i2s_es8388_init() from i2s_driver.h for dual-codec support.

Parameters

  • i2s_config — I2S configuration. Pass NULL to use default values (Mono, duplex, 16bit, 22050 Hz)

Returns

  • ESP_OK On success
  • ESP_ERR_NOT_SUPPORTED The communication mode is not supported on the current chip
  • ESP_ERR_INVALID_ARG NULL pointer or invalid configuration
  • ESP_ERR_NOT_FOUND No available I2S channel found
  • ESP_ERR_NO_MEM No memory for storing the channel information
  • ESP_ERR_INVALID_STATE This channel has not initialized or already started

Declared in crosspad_s3.h:146.

const audio_codec_data_if_t * bsp_audio_get_codec_itf(void)

Get codec I2S interface (legacy single-codec path)

Note: Prefer bsp_i2s_get_codec_itf() from i2s_driver.h for dual-codec support.

Returns

  • Pointer to codec I2S interface handle or NULL when error occurred

Declared in crosspad_s3.h:155.

esp_err_t bsp_i2c_init(void)

Init I2C driver.

Returns

  • ESP_OK On success
  • ESP_ERR_INVALID_ARG I2C parameter error
  • ESP_FAIL I2C driver installation error

Declared in crosspad_s3.h:183.

esp_err_t bsp_i2c_deinit(void)

Deinit I2C driver and free its resources.

Returns

  • ESP_OK On success
  • ESP_ERR_INVALID_ARG I2C parameter error

Declared in crosspad_s3.h:193.

i2c_master_bus_handle_t bsp_i2c_get_handle(void)

Get I2C driver handle.

Returns

  • I2C handle

Declared in crosspad_s3.h:201.

esp_err_t bsp_spiffs_mount(void)

Mount SPIFFS to virtual file system.

Returns

  • ESP_OK on success
  • ESP_ERR_INVALID_STATE if esp_vfs_spiffs_register was already called
  • ESP_ERR_NO_MEM if memory can not be allocated
  • ESP_FAIL if partition can not be mounted
  • other error codes

Declared in crosspad_s3.h:232.

esp_err_t bsp_spiffs_unmount(void)

Unmount SPIFFS from virtual file system.

Returns

  • ESP_OK on success
  • ESP_ERR_NOT_FOUND if the partition table does not contain SPIFFS partition with given label
  • ESP_ERR_INVALID_STATE if esp_vfs_spiffs_unregister was already called
  • ESP_ERR_NO_MEM if memory can not be allocated
  • ESP_FAIL if partition can not be mounted
  • other error codes

Declared in crosspad_s3.h:245.

lv_display_t * bsp_display_start(void)

Initialize display.

This function initializes SPI, display controller and starts LVGL handling task. LCD backlight must be enabled separately by calling bsp_display_brightness_set()

Returns

Pointer to LVGL display or NULL when error occurred

Declared in crosspad_s3.h:292.

void bsp_display_reset_early(void)

Pulse the LCD/touch reset line now, so its settle time overlaps the rest of the boot instead of being waited out inside bsp_display_start().

Optional: bsp_display_start() resets the panel itself when this was not called, and otherwise waits only for what is left of the settle window.

Declared in crosspad_s3.h:301.

lv_display_t * bsp_display_start_with_config(const bsp_display_cfg_t *cfg)

Initialize display.

This function initializes SPI, display controller and starts LVGL handling task. LCD backlight must be enabled separately by calling bsp_display_brightness_set()

Parameters

  • cfg — display configuration

Returns

Pointer to LVGL display or NULL when error occurred

Declared in crosspad_s3.h:313.

lv_indev_t * bsp_display_get_input_dev(void)

Get pointer to input device (touch, buttons, …)

Note: The LVGL input device is initialized in bsp_display_start() function.

Returns

Pointer to LVGL input device or NULL when not initialized

Declared in crosspad_s3.h:322.

bool bsp_display_lock(uint32_t timeout_ms)

Take LVGL mutex.

Parameters

  • timeout_ms — Timeout in [ms]. 0 will block indefinitely.

Returns

false Mutex was NOT taken

Declared in crosspad_s3.h:331.

void bsp_display_unlock(void)

Give LVGL mutex.

Declared in crosspad_s3.h:337.

esp_err_t bsp_display_enter_sleep(void)

Set display enter sleep mode.

All the display (LCD, backlight, touch) will enter sleep mode.

Returns

  • ESP_OK on success
  • ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel

Declared in crosspad_s3.h:348.

esp_err_t bsp_display_exit_sleep(void)

Set display exit sleep mode.

All the display (LCD, backlight, touch) will exit sleep mode.

Returns

  • ESP_OK on success
  • ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel

Declared in crosspad_s3.h:359.

void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation)

Rotate screen.

Display must be already initialized by calling bsp_display_start()

Parameters

  • disp — Pointer to LVGL display
  • rotation — Angle of the display rotation

Declared in crosspad_s3.h:369.

esp_err_t bsp_touch_new(esp_lcd_touch_handle_t *ret_touch)

Initialize touch controller.

Initialize I2C touch controller. This function can be called only once, before any other touch function.

Parameters

  • ret_touch — Pointer to touch controller handle. Can be used with other esp_lcd_touch_* functions.

Returns

  • ESP_OK on success
  • ESP_ERR_INVALID_ARG when the parameter ret_touch is NULL
  • ESP_FAIL on other errors

Declared in crosspad_s3.h:400.

esp_err_t bsp_touch_set_sensitivity(bsp_touch_sensitivity_t level)

Change the sensitivity of the running touch controller, no reset.

Returns

  • ESP_OK on success
  • ESP_ERR_INVALID_STATE when no touch controller came up
  • ESP_ERR_INVALID_ARG for an unknown level
  • controller/I2C errors otherwise

Declared in crosspad_s3.h:420.

esp_err_t bsp_iot_button_create(button_handle_t btn_array[], int *btn_cnt, int btn_array_size)

Initialize all buttons.

Returned button handlers must be used with espressif/button component API

Note: For LCD panel button which is defined as BSP_BUTTON_MAIN, bsp_display_start should be called before call this function.

Parameters

  • btn_array — Output button array
  • btn_cnt — Number of button handlers saved to btn_array, can be NULL
  • btn_array_size — Size of output button array. Must be at least BSP_BUTTON_NUM

Returns

  • ESP_OK All buttons initialized
  • ESP_ERR_INVALID_ARG btn_array is too small or NULL
  • ESP_FAIL Underlaying iot_button_create failed

Declared in crosspad_s3.h:451.

esp_err_t bsp_stm32_init(void)

Initialize STM32 communication subsystem.

This function initializes UART communication with STM32 microcontroller and starts the communication task for handling MIDI sysex messages. It should be called during BSP initialization.

Returns

  • ESP_OK STM32 communication initialized successfully
  • ESP_FAIL Initialization failed

Declared in crosspad_s3.h:471.

esp_err_t bsp_stm32_deinit(void)

Deinitialize STM32 communication subsystem.

Returns

  • ESP_OK STM32 communication deinitialized successfully
  • ESP_FAIL Deinitialization failed

Declared in crosspad_s3.h:480.

ValueValueDescription
BSP_BUTTON_NUM

Declared in crosspad_s3.h:97.

BSP display configuration structure.

FieldTypeDescription
lvgl_port_cfglvgl_port_cfg_tLVGL port configuration
buffer_sizeuint32_tSize of the buffer for the screen in pixels
double_bufferboolTrue, if should be allocated two buffers
buff_dmaunsigned intAllocated LVGL buffer will be DMA capable
buff_spiramunsigned intAllocated LVGL buffer will be in PSRAM
flagsstruct bsp_display_cfg_t

Declared in crosspad_s3.h:274.

Touch sensitivity levels; the BSP maps each to a controller threshold.

ValueValueDescription
BSP_TOUCH_SENSITIVITY_LOW0the threshold the panel has always run at
BSP_TOUCH_SENSITIVITY_MEDIUM
BSP_TOUCH_SENSITIVITY_HIGH

Declared in crosspad_s3.h:405.

MacroValueDescription
CONFIG_BSP_SPIFFS_MOUNT_POINT"/spiffs"
CONFIG_BSP_SPIFFS_PARTITION_LABEL"spiffs"
CONFIG_BSP_SPIFFS_MAX_FILES5
BSP_CAPS_DISPLAY1
BSP_CAPS_TOUCH1
BSP_CAPS_BUTTONS1
BSP_CAPS_AUDIO1
BSP_CAPS_AUDIO_SPEAKER1
BSP_CAPS_AUDIO_MIC1
BSP_CAPS_AUDIO_DUAL1
BSP_CAPS_SDCARD1
BSP_CAPS_IMU1
BSP_LED_NUM16
BSP_CAPS_LEDBSP_LED_NUM
BSP_HAS_JACK_ADC(ADC_PIN != GPIO_NUM_NC)
BSP_HAS_BACK_COVER_DETECT(BSP_BACK_COVER_PIN != GPIO_NUM_NC)
BSP_HAS_IMU_INT2(BSP_IMU_INT2_PIN != GPIO_NUM_NC)
NUM_ADC_SAMPLES8
BSP_I2C_NUMCONFIG_BSP_I2C_NUM
BSP_SPIFFS_MOUNT_POINTCONFIG_BSP_SPIFFS_MOUNT_POINT
BSP_LCD_PIXEL_CLOCK_HZ(40 * 1000 * 1000)
BSP_LCD_SPI_NUM(SPI3_HOST)
BSP_TOUCH_I2C_CLKBSP_I2C_SCL
BSP_TOUCH_I2C_DATABSP_I2C_SDA