stm32f1_staging/stm32f102/dac/
dhr12rd.rs

1///Register `DHR12RD` reader
2pub type R = crate::R<DHR12RDrs>;
3///Register `DHR12RD` writer
4pub type W = crate::W<DHR12RDrs>;
5///Field `DACC1DHR` reader - DAC channel1 12-bit right-aligned data
6pub type DACC1DHR_R = crate::FieldReader<u16>;
7///Field `DACC1DHR` writer - DAC channel1 12-bit right-aligned data
8pub type DACC1DHR_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16, crate::Safe>;
9///Field `DACC2DHR` reader - DAC channel2 12-bit right-aligned data
10pub type DACC2DHR_R = crate::FieldReader<u16>;
11///Field `DACC2DHR` writer - DAC channel2 12-bit right-aligned data
12pub type DACC2DHR_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16, crate::Safe>;
13impl R {
14    ///Bits 0:11 - DAC channel1 12-bit right-aligned data
15    #[inline(always)]
16    pub fn dacc1dhr(&self) -> DACC1DHR_R {
17        DACC1DHR_R::new((self.bits & 0x0fff) as u16)
18    }
19    ///Bits 16:27 - DAC channel2 12-bit right-aligned data
20    #[inline(always)]
21    pub fn dacc2dhr(&self) -> DACC2DHR_R {
22        DACC2DHR_R::new(((self.bits >> 16) & 0x0fff) as u16)
23    }
24}
25impl core::fmt::Debug for R {
26    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
27        f.debug_struct("DHR12RD")
28            .field("dacc1dhr", &self.dacc1dhr())
29            .field("dacc2dhr", &self.dacc2dhr())
30            .finish()
31    }
32}
33impl W {
34    ///Bits 0:11 - DAC channel1 12-bit right-aligned data
35    #[inline(always)]
36    pub fn dacc1dhr(&mut self) -> DACC1DHR_W<DHR12RDrs> {
37        DACC1DHR_W::new(self, 0)
38    }
39    ///Bits 16:27 - DAC channel2 12-bit right-aligned data
40    #[inline(always)]
41    pub fn dacc2dhr(&mut self) -> DACC2DHR_W<DHR12RDrs> {
42        DACC2DHR_W::new(self, 16)
43    }
44}
45/**Dual DAC 12-bit right-aligned data holding register (DAC_DHR12RD), Bits 31:28 Reserved, Bits 15:12 Reserved
46
47You can [`read`](crate::Reg::read) this register and get [`dhr12rd::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dhr12rd::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/STM32F102.html#DAC:DHR12RD)*/
50pub struct DHR12RDrs;
51impl crate::RegisterSpec for DHR12RDrs {
52    type Ux = u32;
53}
54///`read()` method returns [`dhr12rd::R`](R) reader structure
55impl crate::Readable for DHR12RDrs {}
56///`write(|w| ..)` method takes [`dhr12rd::W`](W) writer structure
57impl crate::Writable for DHR12RDrs {
58    type Safety = crate::Unsafe;
59}
60///`reset()` method sets DHR12RD to value 0
61impl crate::Resettable for DHR12RDrs {}