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
impl DeckMemorySection
Sourcepub async fn is_started(&self) -> Result<bool>
pub async fn is_started(&self) -> Result<bool>
Returns whether the deck has been started.
Sourcepub fn supports_read(&self) -> bool
pub fn supports_read(&self) -> bool
Returns whether this deck supports read operations.
Sourcepub fn supports_write(&self) -> bool
pub fn supports_write(&self) -> bool
Returns whether this deck supports write operations.
Sourcepub fn supports_upgrade(&self) -> bool
pub fn supports_upgrade(&self) -> bool
Returns whether this deck supports firmware upgrades.
Sourcepub async fn upgrade_required(&self) -> Result<bool>
pub async fn upgrade_required(&self) -> Result<bool>
Returns whether a firmware upgrade is required for this deck.
Sourcepub async fn bootloader_active(&self) -> Result<bool>
pub async fn bootloader_active(&self) -> Result<bool>
Returns whether the bootloader is currently active on this deck.
Sourcepub fn can_reset_to_firmware(&self) -> bool
pub fn can_reset_to_firmware(&self) -> bool
Returns whether this deck can be reset to firmware mode.
Sourcepub fn can_reset_to_bootloader(&self) -> bool
pub fn can_reset_to_bootloader(&self) -> bool
Returns whether this deck can be reset to bootloader mode.
Sourcepub fn required_hash(&self) -> Option<u32>
pub fn required_hash(&self) -> Option<u32>
Returns the required hash for firmware verification, if any.
Sourcepub fn required_length(&self) -> Option<u32>
pub fn required_length(&self) -> Option<u32>
Returns the required firmware length, if any.
Sourcepub async fn flash_firmware(&self, data: &[u8]) -> Result<()>
pub async fn flash_firmware(&self, data: &[u8]) -> Result<()>
Flash a complete firmware binary to this deck section.
Writes the firmware size to the deck’s command section, then writes the firmware bytes to the section’s base address. The size step is required by some deck flashers (e.g. AI-deck ESP and GAP8) and silently ignored by others; bundling it into this single call ensures it is never skipped.
§Errors
Returns an error if the section does not support firmware upgrade or if any underlying write fails.
Sourcepub async fn flash_firmware_with_progress<F>(
&self,
data: &[u8],
progress_callback: F,
) -> Result<()>
pub async fn flash_firmware_with_progress<F>( &self, data: &[u8], progress_callback: F, ) -> Result<()>
Flash a complete firmware binary to this deck section, reporting progress on the data write.
The callback is invoked with (bytes_written_so_far, total_bytes)
during the data phase. The size-write phase is a fixed 4 bytes and is
not reported.
§Errors
Returns an error if the section does not support firmware upgrade or if any underlying write fails.
Sourcepub async fn reset_to_bootloader(&self) -> Result<()>
pub async fn reset_to_bootloader(&self) -> Result<()>
Sourcepub async fn reset_to_firmware(&self) -> Result<()>
pub async fn reset_to_firmware(&self) -> Result<()>
Sourcepub async fn read_with_progress<F>(
&self,
address: usize,
length: usize,
progress_callback: F,
) -> Result<Vec<u8>>
pub async fn read_with_progress<F>( &self, address: usize, length: usize, progress_callback: F, ) -> Result<Vec<u8>>
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.