Skip to main content

Crate ssh_stamp_esp32_boards

Crate ssh_stamp_esp32_boards 

Source
Expand description

Board Support Package for ssh-stamp-esp32.

Board definitions live in boards/*.toml (one file per board, containing pin mappings and an optional documentation URL). The build.rs reads those TOML files and generates all Rust code — board structs, the take_uart_pins! macro, and the select_board! macro — into OUT_DIR/boards_gen.rs, which is included here.

The TOML files are the single source of truth for pin numbers. No human writes or edits the generated Rust code.

§Board catalog

Pin allocation for every board of this platform, generated from its boards/*.toml files on each cargo doc (cargo xtask <board> doc) run. The TOML files are the single source of truth: this table is the only place the allocation is written down, and no README, guide or hand-written doc page repeats it.

BoardChipUART RXUART TXCAN TXCAN RXI2C SDAI2C SCL
esp32-s2-saolaesp32s21011xxxx
esp32c5-devkitcesp32c589xxxx
esp32c6-devkitcesp32c61011xxxx
esp32c61-devkitcesp32c6123xxxx
waveshare-esp32-s3-touch-lcd-43esp32s3444320198 (mux)9 (mux)

Cells are GPIO numbers. x marks a bus that is neither supported nor tested on that board yet — either the hardware does not break it out, or nothing has driven it there so far. Adding the pins to the board’s TOML is what fills the cell in, here and in the firmware.

Pins marked (mux) are not a bus of their own: the firmware drives them to steer an on-board switch or IO expander (the [can_mux] section of the board’s TOML) before it can use the bus they route.

Select a board with cargo xtask <board> build, or with --features board-<board> when driving cargo directly.

§Adding a board

  1. Create boards/{board-name}.toml with a [pins] section (uart_rx and uart_tx, plus can_tx/can_rx and i2c_sda/i2c_scl for the buses the board breaks out), a [build] section naming its chip, and an optional url.
  2. Add board-{name} = [] to [features] in Cargo.toml.

No .rs file, no macro editing, no binary changes. The build.rs validates that selected features have matching TOML files, and the board shows up in the catalog above on the next cargo xtask <board> doc.

Macros§

select_board
Select the active board type B at compile time.
setup_can_transceiver
Prepare the board’s CAN transceiver routing, if it needs any.
take_can_pins
Extract CAN GPIO pins from peripherals.
take_uart_pins
Extract UART GPIO pins and logical pin numbers from peripherals.

Structs§

Esp32S2Saola
Board: esp32-s2-saola.
Esp32c5Devkitc
Board: esp32c5-devkitc.
Esp32c6Devkitc
Board: esp32c6-devkitc.
Esp32c61Devkitc
Board: esp32c61-devkitc.
WaveshareEsp32S3TouchLcd43
Board: waveshare-esp32-s3-touch-lcd-43.

Traits§

Board
Board identification trait.