pub struct Tamp<'d> { /* private fields */ }Expand description
Tamper detection driver.
Implementations§
Source§impl<'d> Tamp<'d>
impl<'d> Tamp<'d>
Sourcepub fn new(
_peri: Peri<'d, TAMP>,
_irq: impl Binding<TAMP, InterruptHandler> + 'd,
) -> Self
pub fn new( _peri: Peri<'d, TAMP>, _irq: impl Binding<TAMP, InterruptHandler> + 'd, ) -> Self
Create a new tamper detection driver.
Sourcepub fn configure_external_channel(
&mut self,
channel: u8,
pin: Peri<'d, impl Pin>,
config: ExternalTamperConfig,
) -> ExternalTamperPin<'d>
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.
Sourcepub fn enable_internal_tamper(&mut self, tamper: InternalTamper)
pub fn enable_internal_tamper(&mut self, tamper: InternalTamper)
Enable an internal tamper condition.
Sourcepub fn disable_internal_tamper(&mut self, tamper: InternalTamper)
pub fn disable_internal_tamper(&mut self, tamper: InternalTamper)
Disable an internal tamper condition.
Sourcepub async fn wait_for_tamper(&mut self) -> TamperStatus
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).
Sourcepub fn tamper_status(&self) -> TamperStatus
pub fn tamper_status(&self) -> TamperStatus
Read the current, raw tamper detection status (SR).
Sourcepub fn clear_tamper_flags(&mut self, status: TamperStatus)
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.
Sourcepub fn read_backup_register(&self, register: usize) -> Option<u32>
pub fn read_backup_register(&self, register: usize) -> Option<u32>
Read a backup register (BKPRn). Returns None if register is out of range.
Sourcepub fn write_backup_register(&mut self, register: usize, value: u32)
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.
Sourcepub fn monotonic_counter(&self) -> u32
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.