Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/embedded/board/esp32c6_devkitc"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
esp32c6 |
std/embedded/chip/esp32c6 |
esp32c6_devkitc.dodo |
esp_flash |
std/embedded/chip/esp_flash |
esp32c6_devkitc.dodo |
esp_rng |
std/embedded/chip/esp_rng |
esp32c6_devkitc.dodo |
esp_rtc |
std/embedded/chip/esp_rtc |
esp32c6_devkitc.dodo |
esp_watchdog |
std/embedded/chip/esp_watchdog |
esp32c6_devkitc.dodo |
hal |
std/embedded/hal |
esp32c6_devkitc.dodo |
NAME
Constant · Source
pub const NAME: &str = "ESP32-C6-DevKitC-1"
LED_PIN
Constant · Source
The RGB LED’s data line, and the BOOT button, low while pressed.
pub const LED_PIN: u32 = 8
BUTTON_PIN
Constant · Source
pub const BUTTON_PIN: u32 = 9
LED_ON_COLOR
Constant · Source
The color the LED shows when
b.ledis on: a dim white, bright enough to see and easy on the eyes.
pub const LED_ON_COLOR: u32 = 0x10_10_10
I2C_SDA_PIN
Constant · Source
The usual bus pins, from the free pins next to each other on the J1 header: I2C on GPIO 6 (SDA) and 7 (SCL), SPI on GPIO 2 (MISO), 4 (SCK), and 5 (MOSI), with GPIO 3 free for a chip select, and a serial port on GPIO 16 (TX) and 17 (RX), which the board’s USB serial adapter connects to its second USB connector:
i2c := b.pins.i2c(I2C_SDA_PIN, I2C_SCL_PIN, hal.I2C_FAST_HZ)! serial := b.pins.uart(UART_TX_PIN, some(UART_RX_PIN), 115_200)!
Any other free pins carry the buses too, through the GPIO matrix.
pub const I2C_SDA_PIN: u32 = 6
I2C_SCL_PIN
Constant · Source
pub const I2C_SCL_PIN: u32 = 7
SPI_RX_PIN
Constant · Source
pub const SPI_RX_PIN: u32 = 2
SPI_SELECT_PIN
Constant · Source
pub const SPI_SELECT_PIN: u32 = 3
SPI_CLOCK_PIN
Constant · Source
pub const SPI_CLOCK_PIN: u32 = 4
SPI_TX_PIN
Constant · Source
pub const SPI_TX_PIN: u32 = 5
UART_TX_PIN
Constant · Source
pub const UART_TX_PIN: u32 = 16
UART_RX_PIN
Constant · Source
pub const UART_RX_PIN: u32 = 17
Board
Struct · Source
pub struct Board {
// The RGB LED, an output pin that lights it in LED_ON_COLOR when high;
// `set_color` shows any color.
pub led: Led
// The remaining GPIOs, and the buses, serial ports, PWM outputs, ADC
// inputs, CAN controllers (`can`), I2S streams (`i2s_output`,
// `i2s_input`), and PWM inputs (`pwm_input`) on them; GPIO 8 is already
// taken by `led`.
pub pins: esp32c6.Pins
// The system timer: delay_us, delay_ms, now_us, and alarms.
pub timer: esp32c6.Timer
// The USB connector next to the RGB LED, marked USB: `serial()` opens
// the chip's own USB serial port, for printing over the USB cable.
pub usb: esp32c6.Usb
// The DMA channels: `channel()` claims one, for copies that run while
// the program does other work.
pub dma: esp32c6.Dma
// The random number generator: `fill(bytes)`, and hal.random_u32 and
// friends over it; fit for keys while no analog input is claimed.
pub rng: esp_rng.Rng
// The watchdog, stopped: `start(timeout_ms)`, `feed()`, `stop()`,
// `reset_reason()`, and scratch words that survive its reset.
pub watchdog: esp_watchdog.Watchdog
// The real-time clock: the LP timer, counting milliseconds through
// resets until the board loses power, with an alarm.
pub rtc: esp_rtc.Rtc
// The 8 MiB program flash: `region`, `last`, and `free` hand out the
// flash above the program, for std/embedded/storage.
pub flash: esp_flash.Flash
// Sleep modes, clock gating, and the dormant state, the
// std/embedded/power protocol; see esp32c6.Power.
pub power: esp32c6.Power
// The low-power core, which runs the program the firmware embeds with
// `lp-core`; see esp32c6.LpCore.
pub lp_core: esp32c6.LpCore
}
take
Function · Source
Start the chip and claim the LED, off. A second call returns hal.Error.Busy.
pub fn take() -> Board!hal.Error
Led
Struct · Source
The board’s RGB LED: an output pin, on when high, for the board contract and portable code, and a color with
set_color.
pub struct Led: hal.OutputPin {
// Private implementation fields omitted.
}
Led.set_high
Function · Source
Light the LED in its color.
pub fn set_high(&mut self)
Led.set_low
Function · Source
Turn the LED off.
pub fn set_low(&mut self)
Led.toggle
Function · Source
pub fn toggle(&mut self)
Led.is_high
Function · Source
Whether the LED is on.
pub fn is_high(&self) -> bool
Led.set_color
Function · Source
Show
rgb, a 0xRRGGBB color, and use it from now on when the LED is set high; 0 turns it off.
pub fn set_color(&mut self, rgb: u32)
Led.color
Function · Source
The color the LED shows when on.
pub fn color(&self) -> u32
report_panic
Function · Source
Write a failed check’s message to every serial port claimed from
b.pins.uartand to the USB serial port, as the default panic hook does before it halts. For a panic hook of your own, for example one that restarts the board:extern “C” fn dodo_board_panic(check: *const u8, file: *const u8, line: u32, column: u32) { unsafe { board.report_panic(check, file, line, column) } esp32c6.restart() }
SAFETY:
checkandfilemust be the hook’s NUL-terminated strings, and the caller must halt or reset afterwards, as this takes over the ports.
pub unsafe fn report_panic(check: *const u8, file: *const u8, line: u32, column: u32)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.
reboot_to_bootloader
Function · Source
Restart into the boot ROM’s download mode, as if BOOT were held at reset: the board waits for a flasher on both USB connectors.
dodo runresets the board into that mode by itself, so this is rarely needed. Does not return.
pub fn reboot_to_bootloader()