stm32f1_staging/stm32f103/usart1/
gtpr.rs

1///Register `GTPR` reader
2pub type R = crate::R<GTPRrs>;
3///Register `GTPR` writer
4pub type W = crate::W<GTPRrs>;
5///Field `PSC` reader - Prescaler value
6pub type PSC_R = crate::FieldReader;
7///Field `PSC` writer - Prescaler value
8pub type PSC_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9///Field `GT` reader - Guard time value
10pub type GT_R = crate::FieldReader;
11///Field `GT` writer - Guard time value
12pub type GT_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
13impl R {
14    ///Bits 0:7 - Prescaler value
15    #[inline(always)]
16    pub fn psc(&self) -> PSC_R {
17        PSC_R::new((self.bits & 0xff) as u8)
18    }
19    ///Bits 8:15 - Guard time value
20    #[inline(always)]
21    pub fn gt(&self) -> GT_R {
22        GT_R::new(((self.bits >> 8) & 0xff) as u8)
23    }
24}
25impl core::fmt::Debug for R {
26    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
27        f.debug_struct("GTPR").field("gt", &self.gt()).field("psc", &self.psc()).finish()
28    }
29}
30impl W {
31    ///Bits 0:7 - Prescaler value
32    #[inline(always)]
33    pub fn psc(&mut self) -> PSC_W<GTPRrs> {
34        PSC_W::new(self, 0)
35    }
36    ///Bits 8:15 - Guard time value
37    #[inline(always)]
38    pub fn gt(&mut self) -> GT_W<GTPRrs> {
39        GT_W::new(self, 8)
40    }
41}
42/**Guard time and prescaler register
43
44You can [`read`](crate::Reg::read) this register and get [`gtpr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gtpr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
45
46See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#USART1:GTPR)*/
47pub struct GTPRrs;
48impl crate::RegisterSpec for GTPRrs {
49    type Ux = u16;
50}
51///`read()` method returns [`gtpr::R`](R) reader structure
52impl crate::Readable for GTPRrs {}
53///`write(|w| ..)` method takes [`gtpr::W`](W) writer structure
54impl crate::Writable for GTPRrs {
55    type Safety = crate::Unsafe;
56}
57///`reset()` method sets GTPR to value 0
58impl crate::Resettable for GTPRrs {}