embassy-stm32

Crates

git

Versions

stm32wba54kg

Flavors

Tamp

Struct Tamp 

Source
pub struct Tamp<'d> { /* private fields */ }
Expand description

Tamper detection driver.

Implementations§

Source§

impl<'d> Tamp<'d>

Source

pub fn new( _peri: Peri<'d, TAMP>, _irq: impl Binding<TAMP, InterruptHandler> + 'd, ) -> Self

Create a new tamper detection driver.

Source

pub fn configure_external_channel( &mut self, channel: u8, pin: Peri<'d, impl Pin>, config: ExternalTamperConfig, ) -> ExternalTamperPin<'d>

Enable and configure an external tamper channel, binding it to pin.

channel is the 0-based tamper channel index (TAMP1 = 0, TAMP2 = 1, …). It must match the silicon pin mapping documented in your chip’s reference manual/datasheet; this is not checked against the pin passed in.

Source

pub fn enable_internal_tamper(&mut self, tamper: InternalTamper)

Enable an internal tamper condition.

Source

pub fn disable_internal_tamper(&mut self, tamper: InternalTamper)

Disable an internal tamper condition.

Source

pub async fn wait_for_tamper(&mut self) -> TamperStatus

Wait for a tamper detection event.

The status returned reflects the raw, latched SR flags at the time of return. Once handled, call Self::clear_tamper_flags() with the returned status to clear it and resume monitoring those channels — until then, their interrupt is left disabled (they won’t wake this future again, but the flag itself stays latched).

Source

pub fn tamper_status(&self) -> TamperStatus

Read the current, raw tamper detection status (SR).

Source

pub fn clear_tamper_flags(&mut self, status: TamperStatus)

Clear the given tamper flags in SCR, and re-enable the interrupt (IER) for any of them that are still enabled in CR1.

Source

pub fn read_backup_register(&self, register: usize) -> Option<u32>

Read a backup register (BKPRn). Returns None if register is out of range.

Source

pub fn write_backup_register(&mut self, register: usize, value: u32)

Write a backup register (BKPRn). Silently does nothing if register is out of range.

Source

pub fn monotonic_counter(&self) -> u32

Read the monotonic tamper counter. It increments by one on every access performed internally on a read, so consecutive calls return increasing values.

Not available on G0/G4, which don’t have this register — this method doesn’t exist on those chips.

Auto Trait Implementations§

§

impl<'d> Freeze for Tamp<'d>

§

impl<'d> RefUnwindSafe for Tamp<'d>

§

impl<'d> Send for Tamp<'d>

§

impl<'d> Sync for Tamp<'d>

§

impl<'d> Unpin for Tamp<'d>

§

impl<'d> !UnwindSafe for Tamp<'d>

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.