stm32f1_staging/stm32f101/usart1/
brr.rs

1///Register `BRR` reader
2pub type R = crate::R<BRRrs>;
3///Register `BRR` writer
4pub type W = crate::W<BRRrs>;
5///Field `DIV_Fraction` reader - fraction of USARTDIV
6pub type DIV_FRACTION_R = crate::FieldReader;
7///Field `DIV_Fraction` writer - fraction of USARTDIV
8pub type DIV_FRACTION_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
9///Field `DIV_Mantissa` reader - mantissa of USARTDIV
10pub type DIV_MANTISSA_R = crate::FieldReader<u16>;
11///Field `DIV_Mantissa` writer - mantissa of USARTDIV
12pub type DIV_MANTISSA_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16, crate::Safe>;
13impl R {
14    ///Bits 0:3 - fraction of USARTDIV
15    #[inline(always)]
16    pub fn div_fraction(&self) -> DIV_FRACTION_R {
17        DIV_FRACTION_R::new((self.bits & 0x0f) as u8)
18    }
19    ///Bits 4:15 - mantissa of USARTDIV
20    #[inline(always)]
21    pub fn div_mantissa(&self) -> DIV_MANTISSA_R {
22        DIV_MANTISSA_R::new((self.bits >> 4) & 0x0fff)
23    }
24}
25impl core::fmt::Debug for R {
26    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
27        f.debug_struct("BRR")
28            .field("div_mantissa", &self.div_mantissa())
29            .field("div_fraction", &self.div_fraction())
30            .finish()
31    }
32}
33impl W {
34    ///Bits 0:3 - fraction of USARTDIV
35    #[inline(always)]
36    pub fn div_fraction(&mut self) -> DIV_FRACTION_W<BRRrs> {
37        DIV_FRACTION_W::new(self, 0)
38    }
39    ///Bits 4:15 - mantissa of USARTDIV
40    #[inline(always)]
41    pub fn div_mantissa(&mut self) -> DIV_MANTISSA_W<BRRrs> {
42        DIV_MANTISSA_W::new(self, 4)
43    }
44}
45/**Baud rate register
46
47You can [`read`](crate::Reg::read) this register and get [`brr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`brr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
48
49See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F101.html#USART1:BRR)*/
50pub struct BRRrs;
51impl crate::RegisterSpec for BRRrs {
52    type Ux = u16;
53}
54///`read()` method returns [`brr::R`](R) reader structure
55impl crate::Readable for BRRrs {}
56///`write(|w| ..)` method takes [`brr::W`](W) writer structure
57impl crate::Writable for BRRrs {
58    type Safety = crate::Unsafe;
59}
60///`reset()` method sets BRR to value 0
61impl crate::Resettable for BRRrs {}