1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
#[doc = "Reader of register CANIF%s_ARB2"] pub type R = crate::R<u32, super::CANIF_ARB2>; #[doc = "Writer for register CANIF%s_ARB2"] pub type W = crate::W<u32, super::CANIF_ARB2>; #[doc = "Register CANIF%s_ARB2 `reset()`'s with value 0"] impl crate::ResetValue for super::CANIF_ARB2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `ID_28_16`"] pub type ID_28_16_R = crate::R<u16, u16>; #[doc = "Write proxy for field `ID_28_16`"] pub struct ID_28_16_W<'a> { w: &'a mut W, } impl<'a> ID_28_16_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u16) -> &'a mut W { self.w.bits = (self.w.bits & !0x1fff) | ((value as u32) & 0x1fff); self.w } } #[doc = "Message direction.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum DIR_A { #[doc = "0: Direction = receive. On TXRQST, a Remote Frame with the identifier of this Message Object is transmitted. On reception of a Data Frame with matching identifier, that message is stored in this Message Object"] RECEIVE, #[doc = "1: Direction = transmit. On TXRQST, the respective Message Object is transmitted as a Data Frame. On reception of a Remote Frame with matching identifier, the TXRQST bit of this Message Object is set (if RMTEN = one)"] TRANSMIT, } impl From<DIR_A> for bool { #[inline(always)] fn from(variant: DIR_A) -> Self { match variant { DIR_A::RECEIVE => false, DIR_A::TRANSMIT => true, } } } #[doc = "Reader of field `DIR`"] pub type DIR_R = crate::R<bool, DIR_A>; impl DIR_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> DIR_A { match self.bits { false => DIR_A::RECEIVE, true => DIR_A::TRANSMIT, } } #[doc = "Checks if the value of the field is `RECEIVE`"] #[inline(always)] pub fn is_receive(&self) -> bool { *self == DIR_A::RECEIVE } #[doc = "Checks if the value of the field is `TRANSMIT`"] #[inline(always)] pub fn is_transmit(&self) -> bool { *self == DIR_A::TRANSMIT } } #[doc = "Write proxy for field `DIR`"] pub struct DIR_W<'a> { w: &'a mut W, } impl<'a> DIR_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: DIR_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Direction = receive. On TXRQST, a Remote Frame with the identifier of this Message Object is transmitted. On reception of a Data Frame with matching identifier, that message is stored in this Message Object"] #[inline(always)] pub fn receive(self) -> &'a mut W { self.variant(DIR_A::RECEIVE) } #[doc = "Direction = transmit. On TXRQST, the respective Message Object is transmitted as a Data Frame. On reception of a Remote Frame with matching identifier, the TXRQST bit of this Message Object is set (if RMTEN = one)"] #[inline(always)] pub fn transmit(self) -> &'a mut W { self.variant(DIR_A::TRANSMIT) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13); self.w } } #[doc = "Extend identifier.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum XTD_A { #[doc = "0: The 11-bit standard identifier will be used for this message object"] _11_BIT_STANDARD_, #[doc = "1: The 29-bit extended identifier will be used for this message object"] _29_BIT_EXTENDED_, } impl From<XTD_A> for bool { #[inline(always)] fn from(variant: XTD_A) -> Self { match variant { XTD_A::_11_BIT_STANDARD_ => false, XTD_A::_29_BIT_EXTENDED_ => true, } } } #[doc = "Reader of field `XTD`"] pub type XTD_R = crate::R<bool, XTD_A>; impl XTD_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> XTD_A { match self.bits { false => XTD_A::_11_BIT_STANDARD_, true => XTD_A::_29_BIT_EXTENDED_, } } #[doc = "Checks if the value of the field is `_11_BIT_STANDARD_`"] #[inline(always)] pub fn is_11_bit_standard_(&self) -> bool { *self == XTD_A::_11_BIT_STANDARD_ } #[doc = "Checks if the value of the field is `_29_BIT_EXTENDED_`"] #[inline(always)] pub fn is_29_bit_extended_(&self) -> bool { *self == XTD_A::_29_BIT_EXTENDED_ } } #[doc = "Write proxy for field `XTD`"] pub struct XTD_W<'a> { w: &'a mut W, } impl<'a> XTD_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: XTD_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "The 11-bit standard identifier will be used for this message object"] #[inline(always)] pub fn _11_bit_standard_(self) -> &'a mut W { self.variant(XTD_A::_11_BIT_STANDARD_) } #[doc = "The 29-bit extended identifier will be used for this message object"] #[inline(always)] pub fn _29_bit_extended_(self) -> &'a mut W { self.variant(XTD_A::_29_BIT_EXTENDED_) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14); self.w } } #[doc = "Message valid The CPU must reset the MSGVAL bit of all unused Messages Objects during the initialization before it resets bit INIT in the CAN Control Register. This bit must also be reset before the identifier ID28:0, the control bits XTD, DIR, or the Data Length Code DLC3:0 are modified, or if the Messages Object is no longer required.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum MSGVAL_A { #[doc = "0: The message object is ignored by the message handler"] IGNORE, #[doc = "1: The message object is configured and should be considered by the message handler"] CONFIGURED, } impl From<MSGVAL_A> for bool { #[inline(always)] fn from(variant: MSGVAL_A) -> Self { match variant { MSGVAL_A::IGNORE => false, MSGVAL_A::CONFIGURED => true, } } } #[doc = "Reader of field `MSGVAL`"] pub type MSGVAL_R = crate::R<bool, MSGVAL_A>; impl MSGVAL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> MSGVAL_A { match self.bits { false => MSGVAL_A::IGNORE, true => MSGVAL_A::CONFIGURED, } } #[doc = "Checks if the value of the field is `IGNORE`"] #[inline(always)] pub fn is_ignore(&self) -> bool { *self == MSGVAL_A::IGNORE } #[doc = "Checks if the value of the field is `CONFIGURED`"] #[inline(always)] pub fn is_configured(&self) -> bool { *self == MSGVAL_A::CONFIGURED } } #[doc = "Write proxy for field `MSGVAL`"] pub struct MSGVAL_W<'a> { w: &'a mut W, } impl<'a> MSGVAL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: MSGVAL_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "The message object is ignored by the message handler"] #[inline(always)] pub fn ignore(self) -> &'a mut W { self.variant(MSGVAL_A::IGNORE) } #[doc = "The message object is configured and should be considered by the message handler"] #[inline(always)] pub fn configured(self) -> &'a mut W { self.variant(MSGVAL_A::CONFIGURED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15); self.w } } impl R { #[doc = "Bits 0:12 - Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)."] #[inline(always)] pub fn id_28_16(&self) -> ID_28_16_R { ID_28_16_R::new((self.bits & 0x1fff) as u16) } #[doc = "Bit 13 - Message direction."] #[inline(always)] pub fn dir(&self) -> DIR_R { DIR_R::new(((self.bits >> 13) & 0x01) != 0) } #[doc = "Bit 14 - Extend identifier."] #[inline(always)] pub fn xtd(&self) -> XTD_R { XTD_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 15 - Message valid The CPU must reset the MSGVAL bit of all unused Messages Objects during the initialization before it resets bit INIT in the CAN Control Register. This bit must also be reset before the identifier ID28:0, the control bits XTD, DIR, or the Data Length Code DLC3:0 are modified, or if the Messages Object is no longer required."] #[inline(always)] pub fn msgval(&self) -> MSGVAL_R { MSGVAL_R::new(((self.bits >> 15) & 0x01) != 0) } } impl W { #[doc = "Bits 0:12 - Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)."] #[inline(always)] pub fn id_28_16(&mut self) -> ID_28_16_W { ID_28_16_W { w: self } } #[doc = "Bit 13 - Message direction."] #[inline(always)] pub fn dir(&mut self) -> DIR_W { DIR_W { w: self } } #[doc = "Bit 14 - Extend identifier."] #[inline(always)] pub fn xtd(&mut self) -> XTD_W { XTD_W { w: self } } #[doc = "Bit 15 - Message valid The CPU must reset the MSGVAL bit of all unused Messages Objects during the initialization before it resets bit INIT in the CAN Control Register. This bit must also be reset before the identifier ID28:0, the control bits XTD, DIR, or the Data Length Code DLC3:0 are modified, or if the Messages Object is no longer required."] #[inline(always)] pub fn msgval(&mut self) -> MSGVAL_W { MSGVAL_W { w: self } } }