| Crates.io | esp-bsp |
| lib.rs | esp-bsp |
| version | 0.4.1 |
| created_at | 2024-01-18 09:06:13.568283+00 |
| updated_at | 2024-12-20 13:54:11.267834+00 |
| description | Rust Bare Metal Board Support Packages for ESP32 related boards with focus on Embassy Async |
| homepage | |
| repository | https://github.com/georgik/esp-bsp-rs |
| max_upload_size | |
| id | 1103989 |
| size | 49,615 |
Rust Bare Metal Board Support Packages (BSP) for ESP32-based boards with focus on Embassy Async.
These boards are available in BSP for backward compatibility, but not recommended for new projects:
To add the ESP-BSP crate to your project:
cargo add esp-bsp
Ensure the correct feature flag is enabled in your Cargo.toml:
[features]
esp-bsp = { version = "0.4.0", features = ["esp32-s3-box-3"] }
Use the prelude for a streamlined initialization process.
use esp_bsp::prelude::*;
#[entry]
fn main() -> ! {
let peripherals = esp_hal::init(esp_hal::Config::default());
esp_alloc::psram_allocator!(peripherals.PSRAM, esp_hal::psram);
let mut delay = Delay::new();
// Initialize I2C for peripherals like accelerometers
let i2c = i2c_init!(peripherals);
// Initialize SPI with DMA for LCD display
let spi = lcd_dma_spi!(peripherals);
// Create the display interface
let di = lcd_display_interface!(peripherals, spi);
// Initialize the display
let mut display = lcd_display!(peripherals, di)
.init(&mut delay)
.unwrap();
// Turn on the backlight
lcd_backlight_init!(peripherals);
// Your application code here
println!("Display initialized!");
loop {}
}
With esp_bsp::prelude::*, the macros ensure correct initialization per board based on the enabled feature.