Skip to main content

Atecc

Struct Atecc 

Source
pub struct Atecc<H>
where H: AteccHal,
{ hal: H, device_addr: u8, }
Expand description

Driver handle owning the HAL.

Does not, by itself, expose any chip command. Use Self::open_channel to wake the chip and obtain an AteccChannel on which the command API lives.

Fields§

§hal: H§device_addr: u8

Implementations§

Source§

impl<H> Atecc<H>
where H: AteccHal,

Source

pub fn new(hal: H) -> Self

Build a new driver around an existing HAL, using the chip’s default I2C address (I2C_ADDRESS).

Source

pub(crate) fn with_address(hal: H, addr: u8) -> Self

Build a new driver against a chip with a non-default I2C address.

Source

pub fn into_hal(self) -> H

Consume the driver and return the underlying HAL.

Source

pub async fn open_channel( &mut self, ) -> Result<AteccChannel<'_, H>, AteccError<H::Error>>

Open a communication channel with the chip.

Performs the wake sequence and returns an AteccChannel that exposes the typed command API. The channel borrows self mutably for as long as it exists, which prevents accidentally opening two channels concurrently.

The caller is expected to close the channel via AteccChannel::close when finished. Dropping a channel without closing leaves the chip awake; its watchdog will eventually idle it, but the next Self::open_channel call may observe a transient state. A defmt::warn! is emitted in that case to flag the protocol violation.

§Errors

Forwards every variant from crate::wake::wake.

Auto Trait Implementations§

§

impl<H> Freeze for Atecc<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for Atecc<H>
where H: RefUnwindSafe,

§

impl<H> Send for Atecc<H>
where H: Send,

§

impl<H> Sync for Atecc<H>
where H: Sync,

§

impl<H> Unpin for Atecc<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for Atecc<H>
where H: UnsafeUnpin,

§

impl<H> UnwindSafe for Atecc<H>
where H: 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.