Skip to content

Commit 4f76105

Browse files
authored
Merge pull request #119 from flipperzero-rs/sdk-46.0
Migrate to SDK 46.0 (firmware 0.95.0)
2 parents 34073b3 + 32fa8b5 commit 4f76105

File tree

6 files changed

+1954
-902
lines changed

6 files changed

+1954
-902
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1414

1515
### Changed
1616

17-
- Migrated to SDK 40.1 (firmware 0.94.1).
17+
- Migrated to SDK 46.0 (firmware 0.95.0).
1818

1919
## [0.11.0]
2020

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Rust for Flipper Zero 🐬❤️🦀
22

33
[![crates.io](https://img.shields.io/crates/v/flipperzero)](https://crates.io/crates/flipperzero)
4-
[![Flipper Zero API](https://img.shields.io/badge/Flipper%20Zero%20API-40.1-orange)](https://github.com/flipperdevices/flipperzero-firmware/blob/0.94.1/firmware/targets/f7/api_symbols.csv)
4+
[![Flipper Zero API](https://img.shields.io/badge/Flipper%20Zero%20API-46.0-orange)](https://github.com/flipperdevices/flipperzero-firmware/blob/0.95.0/targets/f7/api_symbols.csv)
55
[![docs.rs](https://img.shields.io/docsrs/flipperzero)](https://docs.rs/flipperzero)
66
[![MIT license](https://img.shields.io/crates/l/flipperzero)](LICENSE)
77

@@ -17,13 +17,13 @@ This means it's not possible to use anything in the [`std`](https://doc.rust-lan
1717

1818
## SDK version
1919

20-
Currently supports SDK 40.1 ([flipperzero-firmware@0.94.1](https://github.com/flipperdevices/flipperzero-firmware/tree/0.94.1)).
20+
Currently supports SDK 46.0 ([flipperzero-firmware@0.95.0](https://github.com/flipperdevices/flipperzero-firmware/tree/0.95.0)).
2121

22-
The crate major version number will be updated after a bump in [API version](https://github.com/flipperdevices/flipperzero-firmware/blob/release/firmware/targets/f7/api_symbols.csv) in the Flipper Zero firmware.
22+
The crate major version number will be updated after a bump in [API version](https://github.com/flipperdevices/flipperzero-firmware/blob/release/targets/f7/api_symbols.csv) in the Flipper Zero firmware.
2323

2424
| Crate version | API version |
2525
|---------------|-------------|
26-
| Unreleased | 40.1 |
26+
| Unreleased | 46.0 |
2727
| 0.11.x | 35.0 |
2828
| 0.10.x | 28.2 |
2929
| 0.9.x | 23.0 |

crates/flipperzero/src/storage.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,13 @@ impl Drop for File {
174174

175175
impl Read for File {
176176
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
177-
let to_read = buf.len().try_into().map_err(|_| Error::InvalidParameter)?;
178177
let bytes_read = unsafe {
179-
sys::storage_file_read(self.0.as_ptr(), buf.as_mut_ptr() as *mut c_void, to_read)
178+
sys::storage_file_read(self.0.as_ptr(), buf.as_mut_ptr() as *mut c_void, buf.len())
180179
};
181180
let error = unsafe { sys::storage_file_get_error(self.0.as_ptr()) };
182181

183182
if error == sys::FS_Error_FSE_OK {
184-
Ok(bytes_read as usize)
183+
Ok(bytes_read)
185184
} else {
186185
Err(Error::from_sys(error).unwrap())
187186
}
@@ -242,14 +241,13 @@ impl Seek for File {
242241

243242
impl Write for File {
244243
fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
245-
let to_write = buf.len().try_into().map_err(|_| Error::InvalidParameter)?;
246244
let bytes_written = unsafe {
247-
sys::storage_file_write(self.0.as_ptr(), buf.as_ptr() as *mut c_void, to_write)
245+
sys::storage_file_write(self.0.as_ptr(), buf.as_ptr() as *mut c_void, buf.len())
248246
};
249247
let error = unsafe { sys::storage_file_get_error(self.0.as_ptr()) };
250248

251249
if error == sys::FS_Error_FSE_OK {
252-
Ok(bytes_written as usize)
250+
Ok(bytes_written)
253251
} else {
254252
Err(Error::from_sys(error).unwrap())
255253
}

0 commit comments

Comments
 (0)