Struct Programmer

Source
pub struct Programmer<P, D, E> { /* private fields */ }

Implementations§

Source§

impl Programmer<Serial, Delay, ErrorKind>

Source

pub fn linux<P: AsRef<Path>>( port: P, baud: usize, options: Options, ) -> Result<Self, Error>

Create a new linux serial port programmer instance

Source§

impl<P, D, E> Programmer<P, D, E>
where P: SerialPort<E>, D: DelayMs<u32>, E: Debug,

Source

pub fn new(port: P, delay: D, options: Options) -> Result<Self, Error<E>>

Create a new programmer instance and connect to the attached bootloader

Source

pub fn info(&mut self) -> Result<u8, Error<E>>

Fetch bootloader info byte

Source

pub fn erase(&mut self, page_offset: u8, page_count: u8) -> Result<(), Error<E>>

Erase pages by page offset and count

Source

pub fn erase_pages(&mut self, pages: &[u8]) -> Result<(), Error<E>>

Erase pages by page number

Source

pub fn erase_all(&mut self) -> Result<(), Error<E>>

Erase the entire flash

Source

pub fn read(&mut self, addr: u32, data: &mut [u8]) -> Result<(), Error<E>>

Read memory from the device

Source

pub fn write(&mut self, addr: u32, data: &[u8]) -> Result<(), Error<E>>

Write memory to the device

Source

pub fn reset(&mut self, bootloader: bool) -> Result<(), Error<E>>

Reset the device using RTS while asserting DTR entering the bootloading or application

Source

pub fn chip_id(&mut self) -> Result<u16, Error<E>>

Fetch device chip ID (not-working)

Source

pub fn write_cmd(&mut self, command: Command) -> Result<(), Error<E>>

Write a bootloader command to the device

Source

pub fn write_bytes(&mut self, data: &[u8]) -> Result<(), Error<E>>

Source

pub fn write_bytes_csum(&mut self, data: &[u8]) -> Result<(), Error<E>>

Write data with xor checksum

Source

pub fn read_char(&mut self) -> Result<u8, Error<E>>

Read a single character from the device

Auto Trait Implementations§

§

impl<P, D, E> Freeze for Programmer<P, D, E>
where P: Freeze, D: Freeze,

§

impl<P, D, E> RefUnwindSafe for Programmer<P, D, E>

§

impl<P, D, E> Send for Programmer<P, D, E>
where P: Send, D: Send, E: Send,

§

impl<P, D, E> Sync for Programmer<P, D, E>
where P: Sync, D: Sync, E: Sync,

§

impl<P, D, E> Unpin for Programmer<P, D, E>
where P: Unpin, D: Unpin, E: Unpin,

§

impl<P, D, E> UnwindSafe for Programmer<P, D, E>
where P: UnwindSafe, D: UnwindSafe, E: UnwindSafe,

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.