stm32f1_staging/stm32f101/gpioa/
lckr.rspub type R = crate::R<LCKRrs>;
pub type W = crate::W<LCKRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LCK0 {
Unlocked = 0,
Locked = 1,
}
impl From<LCK0> for bool {
#[inline(always)]
fn from(variant: LCK0) -> Self {
variant as u8 != 0
}
}
pub type LCK_R = crate::BitReader<LCK0>;
impl LCK_R {
#[inline(always)]
pub const fn variant(&self) -> LCK0 {
match self.bits {
false => LCK0::Unlocked,
true => LCK0::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == LCK0::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == LCK0::Locked
}
}
pub type LCK_W<'a, REG> = crate::BitWriter<'a, REG, LCK0>;
impl<'a, REG> LCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(LCK0::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(LCK0::Locked)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LCKK {
NotActive = 0,
Active = 1,
}
impl From<LCKK> for bool {
#[inline(always)]
fn from(variant: LCKK) -> Self {
variant as u8 != 0
}
}
pub type LCKK_R = crate::BitReader<LCKK>;
impl LCKK_R {
#[inline(always)]
pub const fn variant(&self) -> LCKK {
match self.bits {
false => LCKK::NotActive,
true => LCKK::Active,
}
}
#[inline(always)]
pub fn is_not_active(&self) -> bool {
*self == LCKK::NotActive
}
#[inline(always)]
pub fn is_active(&self) -> bool {
*self == LCKK::Active
}
}
pub type LCKK_W<'a, REG> = crate::BitWriter<'a, REG, LCKK>;
impl<'a, REG> LCKK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_active(self) -> &'a mut crate::W<REG> {
self.variant(LCKK::NotActive)
}
#[inline(always)]
pub fn active(self) -> &'a mut crate::W<REG> {
self.variant(LCKK::Active)
}
}
impl R {
#[inline(always)]
pub fn lck(&self, n: u8) -> LCK_R {
#[allow(clippy::no_effect)]
[(); 16][n as usize];
LCK_R::new(((self.bits >> n) & 1) != 0)
}
#[inline(always)]
pub fn lck_iter(&self) -> impl Iterator<Item = LCK_R> + '_ {
(0..16).map(move |n| LCK_R::new(((self.bits >> n) & 1) != 0))
}
#[inline(always)]
pub fn lck0(&self) -> LCK_R {
LCK_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn lck1(&self) -> LCK_R {
LCK_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn lck2(&self) -> LCK_R {
LCK_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn lck3(&self) -> LCK_R {
LCK_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn lck4(&self) -> LCK_R {
LCK_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn lck5(&self) -> LCK_R {
LCK_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn lck6(&self) -> LCK_R {
LCK_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn lck7(&self) -> LCK_R {
LCK_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn lck8(&self) -> LCK_R {
LCK_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn lck9(&self) -> LCK_R {
LCK_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn lck10(&self) -> LCK_R {
LCK_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn lck11(&self) -> LCK_R {
LCK_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn lck12(&self) -> LCK_R {
LCK_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn lck13(&self) -> LCK_R {
LCK_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn lck14(&self) -> LCK_R {
LCK_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn lck15(&self) -> LCK_R {
LCK_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn lckk(&self) -> LCKK_R {
LCKK_R::new(((self.bits >> 16) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LCKR")
.field("lck0", &self.lck0())
.field("lck1", &self.lck1())
.field("lck2", &self.lck2())
.field("lck3", &self.lck3())
.field("lck4", &self.lck4())
.field("lck5", &self.lck5())
.field("lck6", &self.lck6())
.field("lck7", &self.lck7())
.field("lck8", &self.lck8())
.field("lck9", &self.lck9())
.field("lck10", &self.lck10())
.field("lck11", &self.lck11())
.field("lck12", &self.lck12())
.field("lck13", &self.lck13())
.field("lck14", &self.lck14())
.field("lck15", &self.lck15())
.field("lckk", &self.lckk())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn lck(&mut self, n: u8) -> LCK_W<LCKRrs> {
#[allow(clippy::no_effect)]
[(); 16][n as usize];
LCK_W::new(self, n)
}
#[inline(always)]
#[must_use]
pub fn lck0(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn lck1(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 1)
}
#[inline(always)]
#[must_use]
pub fn lck2(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 2)
}
#[inline(always)]
#[must_use]
pub fn lck3(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 3)
}
#[inline(always)]
#[must_use]
pub fn lck4(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 4)
}
#[inline(always)]
#[must_use]
pub fn lck5(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 5)
}
#[inline(always)]
#[must_use]
pub fn lck6(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 6)
}
#[inline(always)]
#[must_use]
pub fn lck7(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 7)
}
#[inline(always)]
#[must_use]
pub fn lck8(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn lck9(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 9)
}
#[inline(always)]
#[must_use]
pub fn lck10(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 10)
}
#[inline(always)]
#[must_use]
pub fn lck11(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 11)
}
#[inline(always)]
#[must_use]
pub fn lck12(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 12)
}
#[inline(always)]
#[must_use]
pub fn lck13(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 13)
}
#[inline(always)]
#[must_use]
pub fn lck14(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 14)
}
#[inline(always)]
#[must_use]
pub fn lck15(&mut self) -> LCK_W<LCKRrs> {
LCK_W::new(self, 15)
}
#[inline(always)]
#[must_use]
pub fn lckk(&mut self) -> LCKK_W<LCKRrs> {
LCKK_W::new(self, 16)
}
}
pub struct LCKRrs;
impl crate::RegisterSpec for LCKRrs {
type Ux = u32;
}
impl crate::Readable for LCKRrs {}
impl crate::Writable for LCKRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for LCKRrs {
const RESET_VALUE: u32 = 0;
}