rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
board.h File Reference

Board bring-up for the 7-inch ESP32-P4 display board: the touch I2C (Inter-Integrated Circuit) bus, the backlight's PWM (pulse-width modulation) and the touch controller's reset. More...

#include <stdbool.h>
#include <stdint.h>
#include "driver/i2c_master.h"
#include "esp_err.h"
#include "board_pins.h"

Go to the source code of this file.

Functions

esp_err_t board_init (void)
 Bring up the touch I2C bus and the backlight PWM, the backlight at 0% (dark).
i2c_master_bus_handle_t board_i2c_bus (void)
 The touch bus: the GT911 and, in a build with it, the touch injector.
esp_err_t board_backlight_percent (int percent)
 Set the backlight brightness.
esp_err_t board_backlight (bool on)
 Backlight at 100% or 0%.
esp_err_t board_touch_reset_sequence (void)
 Run the GT911 reset on BOARD_TOUCH_PIN_RST: low 20ms, high, then 60ms before the first read. Does nothing with GPIO_NUM_NC. INT is not wired to the SoC, so the address the GT911 takes is its own choice; gt911_new() probes 0x5D, then 0x14.

Detailed Description

Board bring-up for the 7-inch ESP32-P4 display board: the touch I2C (Inter-Integrated Circuit) bus, the backlight's PWM (pulse-width modulation) and the touch controller's reset.

Every line is a GPIO (general-purpose input/output) of the SoC (system on chip); the board has no I/O expander.

SPDX-License-Identifier: MIT

Function Documentation

◆ board_backlight()

esp_err_t board_backlight ( bool on)

Backlight at 100% or 0%.

Parameters
ontrue for 100%, false for 0% (dark).
Returns
As board_backlight_percent().

◆ board_backlight_percent()

esp_err_t board_backlight_percent ( int percent)

Set the backlight brightness.

Parameters
percent0 to 100%; values outside are clamped.
Returns
ESP_OK, ESP_ERR_INVALID_STATE before board_init(), or the LEDC error.

◆ board_i2c_bus()

i2c_master_bus_handle_t board_i2c_bus ( void )

The touch bus: the GT911 and, in a build with it, the touch injector.

Returns
The bus handle, or NULL before board_init() succeeded.

◆ board_init()

esp_err_t board_init ( void )

Bring up the touch I2C bus and the backlight PWM, the backlight at 0% (dark).

Safe to call repeatedly: a second call returns at once.

Returns
ESP_OK, or the error of the bus or LEDC call that failed.

◆ board_touch_reset_sequence()

esp_err_t board_touch_reset_sequence ( void )

Run the GT911 reset on BOARD_TOUCH_PIN_RST: low 20ms, high, then 60ms before the first read. Does nothing with GPIO_NUM_NC. INT is not wired to the SoC, so the address the GT911 takes is its own choice; gt911_new() probes 0x5D, then 0x14.

Returns
ESP_OK, the board_init() error, or the GPIO error.