mirror of
https://github.com/icewind1991/esp8266-flash.git
synced 2026-06-03 10:34:05 +02:00
A driver for the esp8266 onboard flash
- Rust 83.1%
- Shell 16.9%
| .cargo | ||
| examples | ||
| src | ||
| .gitignore | ||
| Cargo.toml | ||
| flash_example | ||
| README.md | ||
| setenv | ||
ESP8266-flash
A driver for the esp8266 onboard flash
Example
use esp8266_hal::target::Peripherals;
use esp8266_flash::ESPFlash;
use spi_memory::prelude::*;
let dp = unsafe { Peripherals::steal() };
let pins = dp.GPIO.split();
let mut flash = ESPFlash::new(dp.SPI0);
let mut buff = [0u8; 8];
flash.read(ADDR, &mut buff).unwrap();
buff[0] += 1;
flash.erase_sectors(ADDR, 1).unwrap();
flash.write_bytes(ADDR, &mut buff).unwrap();
Flashing the example
In order to flash the example program
- Edit
setenvto point toRUSTC - Connect the esp8266 over usb
- run
flash_example - check the output using
picocom --baud 115200 /dev/ttyUSB0
See the xtensa-rust-quickstart for more information.