stm32f1_staging/stm32f102/dac/
dhr8rd.rs

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