|
45 | 45 | //!
|
46 | 46 | //! For writing files:
|
47 | 47 | //!
|
48 |
| -//! ```rust,ignore |
49 |
| -//! let my_other_file = root_dir.open_file_in_dir("MY_DATA.CSV", embedded_sdmmc::Mode::ReadWriteCreateOrAppend)?; |
50 |
| -//! my_other_file.write(b"Timestamp,Signal,Value\n")?; |
51 |
| -//! my_other_file.write(b"2025-01-01T00:00:00Z,TEMP,25.0\n")?; |
52 |
| -//! my_other_file.write(b"2025-01-01T00:00:01Z,TEMP,25.1\n")?; |
53 |
| -//! my_other_file.write(b"2025-01-01T00:00:02Z,TEMP,25.2\n")?; |
54 |
| -//! |
55 |
| -//! // Don't forget to flush the file so that the directory entry is updated |
56 |
| -//! my_other_file.flush()?; |
| 48 | +//! ```rust |
| 49 | +//! use embedded_sdmmc::{BlockDevice, Directory, Error, Mode, TimeSource}; |
| 50 | +//! fn write_file<D: BlockDevice, T: TimeSource, const DIRS: usize, const FILES: usize, const VOLUMES: usize>( |
| 51 | +//! root_dir: &mut Directory<D, T, DIRS, FILES, VOLUMES>, |
| 52 | +//! ) -> Result<(), Error<D::Error>> |
| 53 | +//! { |
| 54 | +//! let my_other_file = root_dir.open_file_in_dir("MY_DATA.CSV", Mode::ReadWriteCreateOrAppend)?; |
| 55 | +//! my_other_file.write(b"Timestamp,Signal,Value\n")?; |
| 56 | +//! my_other_file.write(b"2025-01-01T00:00:00Z,TEMP,25.0\n")?; |
| 57 | +//! my_other_file.write(b"2025-01-01T00:00:01Z,TEMP,25.1\n")?; |
| 58 | +//! my_other_file.write(b"2025-01-01T00:00:02Z,TEMP,25.2\n")?; |
| 59 | +//! // Don't forget to flush the file so that the directory entry is updated |
| 60 | +//! my_other_file.flush()?; |
| 61 | +//! Ok(()) |
| 62 | +//! } |
57 | 63 | //! ```
|
58 | 64 | //!
|
59 | 65 | //! ## Features
|
|
0 commit comments