1#[doc = "Register `IC_ACK_GENERAL_CALL` reader"]
2pub type R = crate::R<IC_ACK_GENERAL_CALL_SPEC>;
3#[doc = "Register `IC_ACK_GENERAL_CALL` writer"]
4pub type W = crate::W<IC_ACK_GENERAL_CALL_SPEC>;
5#[doc = "Field `ACK_GEN_CALL` reader - ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe)."]
6pub type ACK_GEN_CALL_R = crate::BitReader<ACK_GEN_CALL_A>;
7#[doc = "ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe).
89Value on reset: 1"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum ACK_GEN_CALL_A {
12#[doc = "0: Generate NACK for a General Call"]
13DISABLED = 0,
14#[doc = "1: Generate ACK for a General Call"]
15ENABLED = 1,
16}
17impl From<ACK_GEN_CALL_A> for bool {
18#[inline(always)]
19fn from(variant: ACK_GEN_CALL_A) -> Self {
20 variant as u8 != 0
21}
22}
23impl ACK_GEN_CALL_R {
24#[doc = "Get enumerated values variant"]
25 #[inline(always)]
26pub const fn variant(&self) -> ACK_GEN_CALL_A {
27match self.bits {
28false => ACK_GEN_CALL_A::DISABLED,
29true => ACK_GEN_CALL_A::ENABLED,
30 }
31 }
32#[doc = "Generate NACK for a General Call"]
33 #[inline(always)]
34pub fn is_disabled(&self) -> bool {
35*self == ACK_GEN_CALL_A::DISABLED
36 }
37#[doc = "Generate ACK for a General Call"]
38 #[inline(always)]
39pub fn is_enabled(&self) -> bool {
40*self == ACK_GEN_CALL_A::ENABLED
41 }
42}
43#[doc = "Field `ACK_GEN_CALL` writer - ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe)."]
44pub type ACK_GEN_CALL_W<'a, REG> = crate::BitWriter<'a, REG, ACK_GEN_CALL_A>;
45impl<'a, REG> ACK_GEN_CALL_W<'a, REG>
46where
47REG: crate::Writable + crate::RegisterSpec,
48{
49#[doc = "Generate NACK for a General Call"]
50 #[inline(always)]
51pub fn disabled(self) -> &'a mut crate::W<REG> {
52self.variant(ACK_GEN_CALL_A::DISABLED)
53 }
54#[doc = "Generate ACK for a General Call"]
55 #[inline(always)]
56pub fn enabled(self) -> &'a mut crate::W<REG> {
57self.variant(ACK_GEN_CALL_A::ENABLED)
58 }
59}
60impl R {
61#[doc = "Bit 0 - ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe)."]
62 #[inline(always)]
63pub fn ack_gen_call(&self) -> ACK_GEN_CALL_R {
64 ACK_GEN_CALL_R::new((self.bits & 1) != 0)
65 }
66}
67impl W {
68#[doc = "Bit 0 - ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe)."]
69 #[inline(always)]
70 #[must_use]
71pub fn ack_gen_call(&mut self) -> ACK_GEN_CALL_W<IC_ACK_GENERAL_CALL_SPEC> {
72 ACK_GEN_CALL_W::new(self, 0)
73 }
74#[doc = r" Writes raw bits to the register."]
75 #[doc = r""]
76 #[doc = r" # Safety"]
77 #[doc = r""]
78 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
79 #[inline(always)]
80pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
81self.bits = bits;
82self
83}
84}
85#[doc = "I2C ACK General Call Register
8687 The register controls whether DW_apb_i2c responds with a ACK or NACK when it receives an I2C General Call address.
8889 This register is applicable only when the DW_apb_i2c is in slave mode.
9091You can [`read`](crate::generic::Reg::read) this register and get [`ic_ack_general_call::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ic_ack_general_call::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
92pub struct IC_ACK_GENERAL_CALL_SPEC;
93impl crate::RegisterSpec for IC_ACK_GENERAL_CALL_SPEC {
94type Ux = u32;
95}
96#[doc = "`read()` method returns [`ic_ack_general_call::R`](R) reader structure"]
97impl crate::Readable for IC_ACK_GENERAL_CALL_SPEC {}
98#[doc = "`write(|w| ..)` method takes [`ic_ack_general_call::W`](W) writer structure"]
99impl crate::Writable for IC_ACK_GENERAL_CALL_SPEC {
100const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
101const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
102}
103#[doc = "`reset()` method sets IC_ACK_GENERAL_CALL to value 0x01"]
104impl crate::Resettable for IC_ACK_GENERAL_CALL_SPEC {
105const RESET_VALUE: u32 = 0x01;
106}