diff options
Diffstat (limited to 'src/can0/gfc.rs')
| -rw-r--r-- | src/can0/gfc.rs | 354 |
1 files changed, 354 insertions, 0 deletions
diff --git a/src/can0/gfc.rs b/src/can0/gfc.rs new file mode 100644 index 0000000..803cfe5 --- /dev/null +++ b/src/can0/gfc.rs @@ -0,0 +1,354 @@ +#[doc = "Register `GFC` reader"] +pub struct R(crate::R<GFC_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<GFC_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<GFC_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<GFC_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `GFC` writer"] +pub struct W(crate::W<GFC_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<GFC_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<GFC_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<GFC_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `RRFE` reader - Reject Remote Frames Extended"] +pub struct RRFE_R(crate::FieldReader<bool, bool>); +impl RRFE_R { + pub(crate) fn new(bits: bool) -> Self { + RRFE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RRFE_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RRFE` writer - Reject Remote Frames Extended"] +pub struct RRFE_W<'a> { + w: &'a mut W, +} +impl<'a> RRFE_W<'a> { + #[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) | (value as u32 & 0x01); + self.w + } +} +#[doc = "Field `RRFS` reader - Reject Remote Frames Standard"] +pub struct RRFS_R(crate::FieldReader<bool, bool>); +impl RRFS_R { + pub(crate) fn new(bits: bool) -> Self { + RRFS_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for RRFS_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `RRFS` writer - Reject Remote Frames Standard"] +pub struct RRFS_W<'a> { + w: &'a mut W, +} +impl<'a> RRFS_W<'a> { + #[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 << 1)) | ((value as u32 & 0x01) << 1); + self.w + } +} +#[doc = "Accept Non-matching Frames Extended\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum ANFE_A { + #[doc = "0: Accept in Rx FIFO 0"] + RXF0 = 0, + #[doc = "1: Accept in Rx FIFO 1"] + RXF1 = 1, + #[doc = "2: Reject"] + REJECT = 2, +} +impl From<ANFE_A> for u8 { + #[inline(always)] + fn from(variant: ANFE_A) -> Self { + variant as _ + } +} +#[doc = "Field `ANFE` reader - Accept Non-matching Frames Extended"] +pub struct ANFE_R(crate::FieldReader<u8, ANFE_A>); +impl ANFE_R { + pub(crate) fn new(bits: u8) -> Self { + ANFE_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option<ANFE_A> { + match self.bits { + 0 => Some(ANFE_A::RXF0), + 1 => Some(ANFE_A::RXF1), + 2 => Some(ANFE_A::REJECT), + _ => None, + } + } + #[doc = "Checks if the value of the field is `RXF0`"] + #[inline(always)] + pub fn is_rxf0(&self) -> bool { + **self == ANFE_A::RXF0 + } + #[doc = "Checks if the value of the field is `RXF1`"] + #[inline(always)] + pub fn is_rxf1(&self) -> bool { + **self == ANFE_A::RXF1 + } + #[doc = "Checks if the value of the field is `REJECT`"] + #[inline(always)] + pub fn is_reject(&self) -> bool { + **self == ANFE_A::REJECT + } +} +impl core::ops::Deref for ANFE_R { + type Target = crate::FieldReader<u8, ANFE_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ANFE` writer - Accept Non-matching Frames Extended"] +pub struct ANFE_W<'a> { + w: &'a mut W, +} +impl<'a> ANFE_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: ANFE_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Accept in Rx FIFO 0"] + #[inline(always)] + pub fn rxf0(self) -> &'a mut W { + self.variant(ANFE_A::RXF0) + } + #[doc = "Accept in Rx FIFO 1"] + #[inline(always)] + pub fn rxf1(self) -> &'a mut W { + self.variant(ANFE_A::RXF1) + } + #[doc = "Reject"] + #[inline(always)] + pub fn reject(self) -> &'a mut W { + self.variant(ANFE_A::REJECT) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u32 & 0x03) << 2); + self.w + } +} +#[doc = "Accept Non-matching Frames Standard\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(u8)] +pub enum ANFS_A { + #[doc = "0: Accept in Rx FIFO 0"] + RXF0 = 0, + #[doc = "1: Accept in Rx FIFO 1"] + RXF1 = 1, + #[doc = "2: Reject"] + REJECT = 2, +} +impl From<ANFS_A> for u8 { + #[inline(always)] + fn from(variant: ANFS_A) -> Self { + variant as _ + } +} +#[doc = "Field `ANFS` reader - Accept Non-matching Frames Standard"] +pub struct ANFS_R(crate::FieldReader<u8, ANFS_A>); +impl ANFS_R { + pub(crate) fn new(bits: u8) -> Self { + ANFS_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> Option<ANFS_A> { + match self.bits { + 0 => Some(ANFS_A::RXF0), + 1 => Some(ANFS_A::RXF1), + 2 => Some(ANFS_A::REJECT), + _ => None, + } + } + #[doc = "Checks if the value of the field is `RXF0`"] + #[inline(always)] + pub fn is_rxf0(&self) -> bool { + **self == ANFS_A::RXF0 + } + #[doc = "Checks if the value of the field is `RXF1`"] + #[inline(always)] + pub fn is_rxf1(&self) -> bool { + **self == ANFS_A::RXF1 + } + #[doc = "Checks if the value of the field is `REJECT`"] + #[inline(always)] + pub fn is_reject(&self) -> bool { + **self == ANFS_A::REJECT + } +} +impl core::ops::Deref for ANFS_R { + type Target = crate::FieldReader<u8, ANFS_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ANFS` writer - Accept Non-matching Frames Standard"] +pub struct ANFS_W<'a> { + w: &'a mut W, +} +impl<'a> ANFS_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: ANFS_A) -> &'a mut W { + unsafe { self.bits(variant.into()) } + } + #[doc = "Accept in Rx FIFO 0"] + #[inline(always)] + pub fn rxf0(self) -> &'a mut W { + self.variant(ANFS_A::RXF0) + } + #[doc = "Accept in Rx FIFO 1"] + #[inline(always)] + pub fn rxf1(self) -> &'a mut W { + self.variant(ANFS_A::RXF1) + } + #[doc = "Reject"] + #[inline(always)] + pub fn reject(self) -> &'a mut W { + self.variant(ANFS_A::REJECT) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u32 & 0x03) << 4); + self.w + } +} +impl R { + #[doc = "Bit 0 - Reject Remote Frames Extended"] + #[inline(always)] + pub fn rrfe(&self) -> RRFE_R { + RRFE_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Reject Remote Frames Standard"] + #[inline(always)] + pub fn rrfs(&self) -> RRFS_R { + RRFS_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bits 2:3 - Accept Non-matching Frames Extended"] + #[inline(always)] + pub fn anfe(&self) -> ANFE_R { + ANFE_R::new(((self.bits >> 2) & 0x03) as u8) + } + #[doc = "Bits 4:5 - Accept Non-matching Frames Standard"] + #[inline(always)] + pub fn anfs(&self) -> ANFS_R { + ANFS_R::new(((self.bits >> 4) & 0x03) as u8) + } +} +impl W { + #[doc = "Bit 0 - Reject Remote Frames Extended"] + #[inline(always)] + pub fn rrfe(&mut self) -> RRFE_W { + RRFE_W { w: self } + } + #[doc = "Bit 1 - Reject Remote Frames Standard"] + #[inline(always)] + pub fn rrfs(&mut self) -> RRFS_W { + RRFS_W { w: self } + } + #[doc = "Bits 2:3 - Accept Non-matching Frames Extended"] + #[inline(always)] + pub fn anfe(&mut self) -> ANFE_W { + ANFE_W { w: self } + } + #[doc = "Bits 4:5 - Accept Non-matching Frames Standard"] + #[inline(always)] + pub fn anfs(&mut self) -> ANFS_W { + ANFS_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Global Filter Configuration\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [gfc](index.html) module"] +pub struct GFC_SPEC; +impl crate::RegisterSpec for GFC_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [gfc::R](R) reader structure"] +impl crate::Readable for GFC_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [gfc::W](W) writer structure"] +impl crate::Writable for GFC_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets GFC to value 0"] +impl crate::Resettable for GFC_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} |
