mc_sst25/
lib.rs

1//! # Non-blocking I/O library for Microchip SST25 flash memory series
2//!
3//! Optionally non-blocking crate for interacting with Microchip SST25 flash memory devices like
4//! [SST25VF080B](https://ww1.microchip.com/downloads/en/DeviceDoc/20005045C.pdf).
5//!
6//! # Example
7//!
8//! For all details see [device] module.
9//!
10//! ````
11//! use mc_sst25::device::{Flash, Memory};
12//! use mc_sst25::example::{MockBus, MockPin};
13//!
14//! let bus = MockBus::default();
15//! let pin_hold = MockPin::default();
16//! let pin_wp = MockPin::default();
17//!
18//! let mut device = Flash::new(bus, pin_wp, pin_hold);
19//!
20//! // Writing a single byte
21//! device.erase_full().unwrap();
22//! device.byte_program(0x0, 0x66).unwrap();
23//!
24//! // Writing larger data
25//! device.aai_program(0x1, &[0x1, 0x2, 0x3, 0x4]).unwrap();
26//!
27//! // Reading data starting at address 0x0
28//! let data = device.read::<5>(0x0).unwrap();
29//! assert_eq!([0x66, 0x1, 0x2, 0x3, 0x4], data);
30//! ````
31#![cfg_attr(not(test), no_std)]
32#![cfg_attr(feature = "strict", deny(warnings))]
33
34pub mod device;
35
36#[cfg(feature = "example")]
37pub mod example;
38
39#[cfg(test)]
40mod mocks;
41#[cfg(test)]
42mod tests;