1#[doc = "Reader of register OAR2"]
2pub type R = crate::R<u32, super::OAR2>;
3#[doc = "Writer for register OAR2"]
4pub type W = crate::W<u32, super::OAR2>;
5#[doc = "Register OAR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::OAR2 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `OA2`"]
14pub type OA2_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `OA2`"]
16pub struct OA2_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> OA2_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !(0x7f << 1)) | (((value as u32) & 0x7f) << 1);
24 self.w
25 }
26}
27#[doc = "Reader of field `OA2MSK`"]
28pub type OA2MSK_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `OA2MSK`"]
30pub struct OA2MSK_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> OA2MSK_W<'a> {
34 #[doc = r"Writes raw bits to the field"]
35 #[inline(always)]
36 pub unsafe fn bits(self, value: u8) -> &'a mut W {
37 self.w.bits = (self.w.bits & !(0x07 << 8)) | (((value as u32) & 0x07) << 8);
38 self.w
39 }
40}
41#[doc = "Reader of field `OA2EN`"]
42pub type OA2EN_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `OA2EN`"]
44pub struct OA2EN_W<'a> {
45 w: &'a mut W,
46}
47impl<'a> OA2EN_W<'a> {
48 #[doc = r"Sets the field bit"]
49 #[inline(always)]
50 pub fn set_bit(self) -> &'a mut W {
51 self.bit(true)
52 }
53 #[doc = r"Clears the field bit"]
54 #[inline(always)]
55 pub fn clear_bit(self) -> &'a mut W {
56 self.bit(false)
57 }
58 #[doc = r"Writes raw bits to the field"]
59 #[inline(always)]
60 pub fn bit(self, value: bool) -> &'a mut W {
61 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
62 self.w
63 }
64}
65impl R {
66 #[doc = "Bits 1:7 - Interface address"]
67 #[inline(always)]
68 pub fn oa2(&self) -> OA2_R {
69 OA2_R::new(((self.bits >> 1) & 0x7f) as u8)
70 }
71 #[doc = "Bits 8:10 - Own Address 2 masks"]
72 #[inline(always)]
73 pub fn oa2msk(&self) -> OA2MSK_R {
74 OA2MSK_R::new(((self.bits >> 8) & 0x07) as u8)
75 }
76 #[doc = "Bit 15 - Own Address 2 enable"]
77 #[inline(always)]
78 pub fn oa2en(&self) -> OA2EN_R {
79 OA2EN_R::new(((self.bits >> 15) & 0x01) != 0)
80 }
81}
82impl W {
83 #[doc = "Bits 1:7 - Interface address"]
84 #[inline(always)]
85 pub fn oa2(&mut self) -> OA2_W {
86 OA2_W { w: self }
87 }
88 #[doc = "Bits 8:10 - Own Address 2 masks"]
89 #[inline(always)]
90 pub fn oa2msk(&mut self) -> OA2MSK_W {
91 OA2MSK_W { w: self }
92 }
93 #[doc = "Bit 15 - Own Address 2 enable"]
94 #[inline(always)]
95 pub fn oa2en(&mut self) -> OA2EN_W {
96 OA2EN_W { w: self }
97 }
98}