Skip to main content

DeckMemorySection

Struct DeckMemorySection 

Source
pub struct DeckMemorySection { /* private fields */ }
Expand description

Represents a memory section for a deck in the Crazyflie system.

This structure contains information about a deck’s memory configuration, including its capabilities (read, write, upgrade) and memory layout (addresses for base, command, and info).

Implementations§

Source§

impl DeckMemorySection

Source

pub async fn is_started(&self) -> Result<bool>

Returns whether the deck has been started.

Source

pub fn supports_read(&self) -> bool

Returns whether this deck supports read operations.

Source

pub fn supports_write(&self) -> bool

Returns whether this deck supports write operations.

Source

pub fn supports_upgrade(&self) -> bool

Returns whether this deck supports firmware upgrades.

Source

pub async fn upgrade_required(&self) -> Result<bool>

Returns whether a firmware upgrade is required for this deck.

Source

pub async fn bootloader_active(&self) -> Result<bool>

Returns whether the bootloader is currently active on this deck.

Source

pub fn can_reset_to_firmware(&self) -> bool

Returns whether this deck can be reset to firmware mode.

Source

pub fn can_reset_to_bootloader(&self) -> bool

Returns whether this deck can be reset to bootloader mode.

Source

pub fn required_hash(&self) -> Option<u32>

Returns the required hash for firmware verification, if any.

Source

pub fn required_length(&self) -> Option<u32>

Returns the required firmware length, if any.

Source

pub fn name(&self) -> &str

Returns the name of this memory section.

Source

pub async fn reset_to_bootloader(&self) -> Result<()>

Reset the MCU connected to this memory section into bootloader mode.

§Returns

A Result indicating success or failure of the reset operation

§Errors

Returns an Error if the section does not support resetting to bootloader or if the reset operation fails

Source

pub async fn reset_to_firmware(&self) -> Result<()>

Reset the MCU connected to this memory section into firmware mode.

§Returns

A Result indicating success or failure of the reset operation

§Errors

Returns an Error if the section does not support resetting to firmware or if the reset operation fails

Source

pub async fn write(&self, address: usize, data: &[u8]) -> Result<()>

Write data to the memory section at the specified address.

§Arguments
  • address - The address within the memory section to write to.
  • data - The data to write.
§Returns

A Result indicating success or failure of the write operation.

§Errors

Returns an Error if the section does not support writing or if the write operation fails.

Source

pub async fn write_with_progress<F>( &self, address: usize, data: &[u8], progress_callback: F, ) -> Result<()>
where F: FnMut(usize, usize),

Write data to the memory section at the specified address with progress reporting.

§Arguments
  • address - The address within the memory section to write to.
  • data - The data to write.
  • progress_callback - A callback function that takes two usize arguments: the number of bytes written so far and the total number of bytes to write.
§Returns

A Result indicating success or failure of the write operation.

§Errors

Returns an Error if the section does not support writing or if the write operation fails.

Source

pub async fn read(&self, address: usize, length: usize) -> Result<Vec<u8>>

Read data from the memory section at the specified address.

§Arguments
  • address - The address within the memory section to read from.
  • length - The number of bytes to read.
§Returns

A Result containing a vector of bytes read from the memory section or an Error if the operation fails.

Source

pub async fn read_with_progress<F>( &self, address: usize, length: usize, progress_callback: F, ) -> Result<Vec<u8>>
where F: FnMut(usize, usize),

Read data from the memory section at the specified address with progress reporting.

§Arguments
  • address - The address within the memory section to read from.
  • length - The number of bytes to read.
  • progress_callback - A callback function that takes two usize arguments: the number of bytes read so far and the total number of bytes to read.
§Returns

A Result containing a vector of bytes read from the memory section or an Error if the operation fails.

Trait Implementations§

Source§

impl Debug for DeckMemorySection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.