stm32f1/stm32f103/afio/
evcr.rs

1///Register `EVCR` reader
2pub type R = crate::R<EVCRrs>;
3///Register `EVCR` writer
4pub type W = crate::W<EVCRrs>;
5///Field `PIN` reader - Pin selection
6pub type PIN_R = crate::FieldReader;
7///Field `PIN` writer - Pin selection
8pub type PIN_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9///Field `PORT` reader - Port selection
10pub type PORT_R = crate::FieldReader;
11///Field `PORT` writer - Port selection
12pub type PORT_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13///Field `EVOE` reader - Event Output Enable
14pub type EVOE_R = crate::BitReader;
15///Field `EVOE` writer - Event Output Enable
16pub type EVOE_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    ///Bits 0:3 - Pin selection
19    #[inline(always)]
20    pub fn pin(&self) -> PIN_R {
21        PIN_R::new((self.bits & 0x0f) as u8)
22    }
23    ///Bits 4:6 - Port selection
24    #[inline(always)]
25    pub fn port(&self) -> PORT_R {
26        PORT_R::new(((self.bits >> 4) & 7) as u8)
27    }
28    ///Bit 7 - Event Output Enable
29    #[inline(always)]
30    pub fn evoe(&self) -> EVOE_R {
31        EVOE_R::new(((self.bits >> 7) & 1) != 0)
32    }
33}
34impl core::fmt::Debug for R {
35    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
36        f.debug_struct("EVCR")
37            .field("pin", &self.pin())
38            .field("port", &self.port())
39            .field("evoe", &self.evoe())
40            .finish()
41    }
42}
43impl W {
44    ///Bits 0:3 - Pin selection
45    #[inline(always)]
46    pub fn pin(&mut self) -> PIN_W<EVCRrs> {
47        PIN_W::new(self, 0)
48    }
49    ///Bits 4:6 - Port selection
50    #[inline(always)]
51    pub fn port(&mut self) -> PORT_W<EVCRrs> {
52        PORT_W::new(self, 4)
53    }
54    ///Bit 7 - Event Output Enable
55    #[inline(always)]
56    pub fn evoe(&mut self) -> EVOE_W<EVCRrs> {
57        EVOE_W::new(self, 7)
58    }
59}
60/**Event Control Register (AFIO_EVCR)
61
62You can [`read`](crate::Reg::read) this register and get [`evcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`evcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
63
64See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#AFIO:EVCR)*/
65pub struct EVCRrs;
66impl crate::RegisterSpec for EVCRrs {
67    type Ux = u32;
68}
69///`read()` method returns [`evcr::R`](R) reader structure
70impl crate::Readable for EVCRrs {}
71///`write(|w| ..)` method takes [`evcr::W`](W) writer structure
72impl crate::Writable for EVCRrs {
73    type Safety = crate::Unsafe;
74}
75///`reset()` method sets EVCR to value 0
76impl crate::Resettable for EVCRrs {}