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

pub mod device;

#[cfg(feature = "example")]
pub mod example;

#[cfg(test)]
mod mocks;
#[cfg(test)]
mod tests;