1#[doc = "Register `pcntr%s` reader"]
2pub type R = crate::R<PCNTR_SPEC>;
3#[doc = "Register `pcntr%s` writer"]
4pub type W = crate::W<PCNTR_SPEC>;
5#[doc = "Field `pwm_counter_status` reader - On PWM output or capture input, reading this register could get the current value of the PWM 16-bit up-counter."]
6pub type PWM_COUNTER_STATUS_R = crate::FieldReader<u16>;
7#[doc = "Field `pwm_counter_start` reader - PWM counter value is set for phase control."]
8pub type PWM_COUNTER_START_R = crate::FieldReader<u16>;
9#[doc = "Field `pwm_counter_start` writer - PWM counter value is set for phase control."]
10pub type PWM_COUNTER_START_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
11impl R {
12 #[doc = "Bits 0:15 - On PWM output or capture input, reading this register could get the current value of the PWM 16-bit up-counter."]
13 #[inline(always)]
14 pub fn pwm_counter_status(&self) -> PWM_COUNTER_STATUS_R {
15 PWM_COUNTER_STATUS_R::new((self.bits & 0xffff) as u16)
16 }
17 #[doc = "Bits 16:31 - PWM counter value is set for phase control."]
18 #[inline(always)]
19 pub fn pwm_counter_start(&self) -> PWM_COUNTER_START_R {
20 PWM_COUNTER_START_R::new(((self.bits >> 16) & 0xffff) as u16)
21 }
22}
23impl W {
24 #[doc = "Bits 16:31 - PWM counter value is set for phase control."]
25 #[inline(always)]
26 #[must_use]
27 pub fn pwm_counter_start(&mut self) -> PWM_COUNTER_START_W<PCNTR_SPEC> {
28 PWM_COUNTER_START_W::new(self, 16)
29 }
30 #[doc = r" Writes raw bits to the register."]
31 #[doc = r""]
32 #[doc = r" # Safety"]
33 #[doc = r""]
34 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
35 #[inline(always)]
36 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
37 self.bits = bits;
38 self
39 }
40}
41#[doc = "PWM Count Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pcntr::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 [`pcntr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
42pub struct PCNTR_SPEC;
43impl crate::RegisterSpec for PCNTR_SPEC {
44 type Ux = u32;
45}
46#[doc = "`read()` method returns [`pcntr::R`](R) reader structure"]
47impl crate::Readable for PCNTR_SPEC {}
48#[doc = "`write(|w| ..)` method takes [`pcntr::W`](W) writer structure"]
49impl crate::Writable for PCNTR_SPEC {
50 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
51 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
52}
53#[doc = "`reset()` method sets pcntr%s to value 0"]
54impl crate::Resettable for PCNTR_SPEC {
55 const RESET_VALUE: Self::Ux = 0;
56}