(&self)
| 338 | } |
| 339 | |
| 340 | pub fn flash_version(&self) -> Option<(String, String, EcCurrentImage)> { |
| 341 | // Unlock SPI |
| 342 | let _data = EcRequestFlashNotify { |
| 343 | flags: MecFlashNotify::AccessSpi as u8, |
| 344 | } |
| 345 | .send_command(self) |
| 346 | .ok()?; |
| 347 | |
| 348 | let v = EcRequestGetVersion {}.send_command(self).ok()?; |
| 349 | |
| 350 | // Lock SPI |
| 351 | let _ = EcRequestFlashNotify { |
| 352 | flags: MecFlashNotify::AccessSpiDone as u8, |
| 353 | } |
| 354 | .send_command(self); |
| 355 | |
| 356 | let curr = match v.current_image { |
| 357 | 1 => EcCurrentImage::RO, |
| 358 | 2 => EcCurrentImage::RW, |
| 359 | _ => EcCurrentImage::Unknown, |
| 360 | }; |
| 361 | |
| 362 | Some(( |
| 363 | std::str::from_utf8(&v.version_string_ro) |
| 364 | .ok()? |
| 365 | .trim_end_matches(char::from(0)) |
| 366 | .to_string(), |
| 367 | std::str::from_utf8(&v.version_string_rw) |
| 368 | .ok()? |
| 369 | .trim_end_matches(char::from(0)) |
| 370 | .to_string(), |
| 371 | curr, |
| 372 | )) |
| 373 | } |
| 374 | |
| 375 | pub fn motionsense_sensor_count(&self) -> EcResult<u8> { |
| 376 | EcRequestMotionSenseDump { |
no test coverage detected