Expand description
Safe Rust wrapper for a small M5Unified C ABI surface.
The API is intentionally shaped around M5Unified’s common examples while
keeping Rust call sites safe and host-checkable. Hardware calls are provided
by m5unified-sys; on non-ESP-IDF targets that crate supplies no-op stubs so
examples compile in CI.
§Example
use m5unified::{colors, M5Unified};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut m5 = M5Unified::begin()?;
m5.display.fill_screen(colors::BLACK);
m5.display.set_text_size(2);
m5.display.println("hello from Rust")?;
loop {
m5.update();
if m5.buttons.a().was_pressed() {
m5.display.println("Button A")?;
}
m5.delay_ms(16);
}
}Modules§
- colors
- Common RGB565 color constants used by the translated examples.
Structs§
- Aw32001
- Axp192
- Axp2101
- Axp2101
IrqStatus - Bq27220
- Button
- Buttons
- Color565
- Date
- Date
Time - Display
- Display
Ref - ExtPort
BusConfig - ExtPort
Mask - External port mask for boards with independently switchable power outputs.
- External
Display Config - External
Speaker Config - I2cBus
- I2cDevice
- Imu
- ImuConvert
Params - ImuData
- ImuDevice
- ImuRaw
Data - ImuSensor
Mask - Ina226
- Ina226
Config - INA226 power monitor configuration.
- Ina3221
- IoExpander
- Ip5306
- Led
- LedColor
- LedPower
Hub - LedStrip
- LedStrip
Config - LedStrip
RmtConfig - Log
- M5Timer
- M5Unified
- Top-level handle for M5Unified-backed board features.
- M5Unified
Config - Mic
- MicConfig
- Pi4ioe5v6408
- Point
- Power
- Py32
Pmic - RawPlayback
Options - RawVec3
- Recording
Options - Rect
- Rtc
- RtcDevice
- SdCard
- Mounted SD card handle.
- SdSpi
Config - SPI configuration for mounting an SD card through ESP-IDF’s SDSPI driver.
- Size
- Speaker
- Speaker
Config - Time
- Tone
Options - Touch
- Touch
Detail - Touch
Point - Vec3
- WavPlayback
Options
Enums§
- Audio
Queue State - Aw32001
Charge Status - Charge state reported directly by the AW32001 charger.
- Axp192
PekPress - Latched AXP192 PEK button press state.
- Axp2101
Charge Status - Charge state reported directly by the AXP2101 PMIC.
- Axp2101
PekPress - Latched AXP2101 PEK button press state.
- Board
- Button
Id - Button
State - Charge
State - Battery charge state reported by M5Unified.
- Display
Font - Display
Kind - EpdMode
- Error
- Errors returned by the high-level wrapper.
- ImuAxis
- ImuDevice
Kind - ImuKind
- Ina226
Conversion Time - INA226 bus or shunt conversion time.
- Ina226
Mode - INA226 operation mode.
- Ina226
Sampling - INA226 sample averaging rate.
- LedStrip
Color Order - LedType
- LogLevel
- LogTarget
- PinName
- Power
Type - M5Unified PMIC type.
- Py32
Pmic PekPress - Latched PY32 PMIC power-key press state.
- RtcDevice
Kind - Text
Datum - Touch
State
Constants§
- SD_
MOUNT_ PATH - FAT VFS mount path used by the native SD SPI helper.
Functions§
- sd_
begin - Mount an SD card using the board SD SPI pins reported by M5Unified.
- sd_
begin_ with_ config - Mount an SD card using explicit SPI pins and mount options.
- sd_end
- Unmount the SD card mounted by
sd_beginorsd_begin_with_config. - sd_
is_ mounted - Return whether this shim has an SD card mounted at
SD_MOUNT_PATH.