d1_pac/rtc/
alarm0_irq_sta.rs

1#[doc = "Register `alarm0_irq_sta` reader"]
2pub type R = crate::R<ALARM0_IRQ_STA_SPEC>;
3#[doc = "Register `alarm0_irq_sta` writer"]
4pub type W = crate::W<ALARM0_IRQ_STA_SPEC>;
5#[doc = "Field `alarm0_irq_pend` reader - Alarm 0 IRQ Pending bit"]
6pub type ALARM0_IRQ_PEND_R = crate::BitReader<ALARM0_IRQ_PEND_A>;
7#[doc = "Alarm 0 IRQ Pending bit\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum ALARM0_IRQ_PEND_A {
10    #[doc = "0: No effect"]
11    NO_EFFECT = 0,
12    #[doc = "1: Pending, alarm 0 counter value is reached\n\nIf alarm 0 irq enable is set to 1, the pending bit will be sent to the interrupt controller."]
13    PENDING = 1,
14}
15impl From<ALARM0_IRQ_PEND_A> for bool {
16    #[inline(always)]
17    fn from(variant: ALARM0_IRQ_PEND_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl ALARM0_IRQ_PEND_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> ALARM0_IRQ_PEND_A {
25        match self.bits {
26            false => ALARM0_IRQ_PEND_A::NO_EFFECT,
27            true => ALARM0_IRQ_PEND_A::PENDING,
28        }
29    }
30    #[doc = "No effect"]
31    #[inline(always)]
32    pub fn is_no_effect(&self) -> bool {
33        *self == ALARM0_IRQ_PEND_A::NO_EFFECT
34    }
35    #[doc = "Pending, alarm 0 counter value is reached\n\nIf alarm 0 irq enable is set to 1, the pending bit will be sent to the interrupt controller."]
36    #[inline(always)]
37    pub fn is_pending(&self) -> bool {
38        *self == ALARM0_IRQ_PEND_A::PENDING
39    }
40}
41#[doc = "Field `alarm0_irq_pend` writer - Alarm 0 IRQ Pending bit"]
42pub type ALARM0_IRQ_PEND_W<'a, REG> = crate::BitWriter1C<'a, REG, ALARM0_IRQ_PEND_A>;
43impl<'a, REG> ALARM0_IRQ_PEND_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "No effect"]
48    #[inline(always)]
49    pub fn no_effect(self) -> &'a mut crate::W<REG> {
50        self.variant(ALARM0_IRQ_PEND_A::NO_EFFECT)
51    }
52    #[doc = "Pending, alarm 0 counter value is reached\n\nIf alarm 0 irq enable is set to 1, the pending bit will be sent to the interrupt controller."]
53    #[inline(always)]
54    pub fn pending(self) -> &'a mut crate::W<REG> {
55        self.variant(ALARM0_IRQ_PEND_A::PENDING)
56    }
57}
58impl R {
59    #[doc = "Bit 0 - Alarm 0 IRQ Pending bit"]
60    #[inline(always)]
61    pub fn alarm0_irq_pend(&self) -> ALARM0_IRQ_PEND_R {
62        ALARM0_IRQ_PEND_R::new((self.bits & 1) != 0)
63    }
64}
65impl W {
66    #[doc = "Bit 0 - Alarm 0 IRQ Pending bit"]
67    #[inline(always)]
68    #[must_use]
69    pub fn alarm0_irq_pend(&mut self) -> ALARM0_IRQ_PEND_W<ALARM0_IRQ_STA_SPEC> {
70        ALARM0_IRQ_PEND_W::new(self, 0)
71    }
72    #[doc = r" Writes raw bits to the register."]
73    #[doc = r""]
74    #[doc = r" # Safety"]
75    #[doc = r""]
76    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
77    #[inline(always)]
78    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
79        self.bits = bits;
80        self
81    }
82}
83#[doc = "Alarm 0 IRQ Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`alarm0_irq_sta::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`alarm0_irq_sta::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
84pub struct ALARM0_IRQ_STA_SPEC;
85impl crate::RegisterSpec for ALARM0_IRQ_STA_SPEC {
86    type Ux = u32;
87}
88#[doc = "`read()` method returns [`alarm0_irq_sta::R`](R) reader structure"]
89impl crate::Readable for ALARM0_IRQ_STA_SPEC {}
90#[doc = "`write(|w| ..)` method takes [`alarm0_irq_sta::W`](W) writer structure"]
91impl crate::Writable for ALARM0_IRQ_STA_SPEC {
92    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
93    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x01;
94}
95#[doc = "`reset()` method sets alarm0_irq_sta to value 0"]
96impl crate::Resettable for ALARM0_IRQ_STA_SPEC {
97    const RESET_VALUE: Self::Ux = 0;
98}