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

The I2C (Inter-Integrated Circuit) addresses taken on the 7-inch ESP32-P4 display board's buses, which a device added there must stay clear of. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  panel_i2c_range_t
 One range of the panel's I2C address table and its owner. More...

Macros

#define PANEL_I2C_RESERVED(a)
 The table as a constant expression, for a _Static_assert on an address fixed at build time.

Functions

bool panel_i2c_addr_reserved (unsigned addr)
 Whether addr belongs to the board, or is no 7-bit address at all.
const char * panel_i2c_owner (unsigned addr)
 The owner of addr: "GT911" or "I2C reserved", "not a 7-bit address" above 0x7F, NULL for a free address.

Variables

const panel_i2c_range_t panel_i2c_reserved_table []
 The ranges, in rising address order.
const unsigned panel_i2c_reserved_count

Detailed Description

The I2C (Inter-Integrated Circuit) addresses taken on the 7-inch ESP32-P4 display board's buses, which a device added there must stay clear of.

The board has two buses (board_pins.h):

I2C_NUM_0 the touch bus, GPIO7 (SDA) and GPIO8 (SCL): the GT911 touch controller, and in a build with it the touch injector at the GT911's second address (testbench/touch-injector) I2C_NUM_1 the knob's bus, BOARD_KNOB_PIN_SDA and BOARD_KNOB_PIN_SCL (placeholder pins): the MT6701 alone

The table, from board_pins.h and the I2C specification (NXP UM10204, table 4, reserved addresses):

0x00 - 0x03 I2C reserved: general call / START byte (0x00), CBUS (0x01), a different bus format (0x02), future use (0x03) 0x14 GT911 touch controller, its second address (BOARD_TOUCH_I2C_ADDR_ALT); the touch injector's 0x5D GT911 touch controller, its first address (BOARD_TOUCH_I2C_ADDR) 0x78 - 0x7F I2C reserved: 10-bit addressing (0x78 - 0x7B) and future use (0x7C - 0x7F)

The GT911's two addresses are kept off both buses, so a device can move between them. 0x04 to 0x07 are the specification's Hs-mode (high-speed mode) master codes and stay open: the MT6701 knob's factory address is 0x06, and no device on these buses runs Hs-mode. An address above 0x7F is no 7-bit address and is refused with the table. What answers where on the board is not measured.

Owns no hardware, so the host tests hold it. knob_attach() (knob.h) refuses an address here.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ PANEL_I2C_RESERVED

#define PANEL_I2C_RESERVED ( a)
Value:
((unsigned)(a) > 0x7Fu || (unsigned)(a) <= 0x03u || \
(unsigned)(a) == 0x14u || (unsigned)(a) == 0x5Du || \
(unsigned)(a) >= 0x78u)

The table as a constant expression, for a _Static_assert on an address fixed at build time.

panel_i2c_addr_reserved() gives the same answer for every address; test_panel_i2c holds the two to each other.

Function Documentation

◆ panel_i2c_addr_reserved()

bool panel_i2c_addr_reserved ( unsigned addr)

Whether addr belongs to the board, or is no 7-bit address at all.

Parameters
addrThe 7-bit address.
Returns
true when the board answers at addr, or addr is no 7-bit address.

◆ panel_i2c_owner()

const char * panel_i2c_owner ( unsigned addr)

The owner of addr: "GT911" or "I2C reserved", "not a 7-bit address" above 0x7F, NULL for a free address.

Parameters
addrThe address to name.
Returns
The owner's name, or NULL for a free address.