rp2040_pac/watchdog/
tick.rs
1#[doc = "Register `TICK` reader"]
2pub type R = crate::R<TICK_SPEC>;
3#[doc = "Register `TICK` writer"]
4pub type W = crate::W<TICK_SPEC>;
5#[doc = "Field `CYCLES` reader - Total number of clk_tick cycles before the next tick."]
6pub type CYCLES_R = crate::FieldReader<u16>;
7#[doc = "Field `CYCLES` writer - Total number of clk_tick cycles before the next tick."]
8pub type CYCLES_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
9#[doc = "Field `ENABLE` reader - start / stop tick generation"]
10pub type ENABLE_R = crate::BitReader;
11#[doc = "Field `ENABLE` writer - start / stop tick generation"]
12pub type ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `RUNNING` reader - Is the tick generator running?"]
14pub type RUNNING_R = crate::BitReader;
15#[doc = "Field `COUNT` reader - Count down timer: the remaining number clk_tick cycles before the next tick is generated."]
16pub type COUNT_R = crate::FieldReader<u16>;
17impl R {
18 #[doc = "Bits 0:8 - Total number of clk_tick cycles before the next tick."]
19 #[inline(always)]
20 pub fn cycles(&self) -> CYCLES_R {
21 CYCLES_R::new((self.bits & 0x01ff) as u16)
22 }
23 #[doc = "Bit 9 - start / stop tick generation"]
24 #[inline(always)]
25 pub fn enable(&self) -> ENABLE_R {
26 ENABLE_R::new(((self.bits >> 9) & 1) != 0)
27 }
28 #[doc = "Bit 10 - Is the tick generator running?"]
29 #[inline(always)]
30 pub fn running(&self) -> RUNNING_R {
31 RUNNING_R::new(((self.bits >> 10) & 1) != 0)
32 }
33 #[doc = "Bits 11:19 - Count down timer: the remaining number clk_tick cycles before the next tick is generated."]
34 #[inline(always)]
35 pub fn count(&self) -> COUNT_R {
36 COUNT_R::new(((self.bits >> 11) & 0x01ff) as u16)
37 }
38}
39impl W {
40 #[doc = "Bits 0:8 - Total number of clk_tick cycles before the next tick."]
41 #[inline(always)]
42 #[must_use]
43 pub fn cycles(&mut self) -> CYCLES_W<TICK_SPEC> {
44 CYCLES_W::new(self, 0)
45 }
46 #[doc = "Bit 9 - start / stop tick generation"]
47 #[inline(always)]
48 #[must_use]
49 pub fn enable(&mut self) -> ENABLE_W<TICK_SPEC> {
50 ENABLE_W::new(self, 9)
51 }
52 #[doc = r" Writes raw bits to the register."]
53 #[doc = r""]
54 #[doc = r" # Safety"]
55 #[doc = r""]
56 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
57 #[inline(always)]
58 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
59 self.bits = bits;
60 self
61 }
62}
63#[doc = "Controls the tick generator
64
65You can [`read`](crate::generic::Reg::read) this register and get [`tick::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 [`tick::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
66pub struct TICK_SPEC;
67impl crate::RegisterSpec for TICK_SPEC {
68 type Ux = u32;
69}
70#[doc = "`read()` method returns [`tick::R`](R) reader structure"]
71impl crate::Readable for TICK_SPEC {}
72#[doc = "`write(|w| ..)` method takes [`tick::W`](W) writer structure"]
73impl crate::Writable for TICK_SPEC {
74 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
75 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
76}
77#[doc = "`reset()` method sets TICK to value 0x0200"]
78impl crate::Resettable for TICK_SPEC {
79 const RESET_VALUE: u32 = 0x0200;
80}