#[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CR1` writer"]
pub struct W(crate::W<CR1_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CR1_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<CR1_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CR1_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `BIDIMODE` reader - Bidirectional data mode enable"]
pub struct BIDIMODE_R(crate::FieldReader<bool, bool>);
impl BIDIMODE_R {
pub(crate) fn new(bits: bool) -> Self {
BIDIMODE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BIDIMODE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BIDIMODE` writer - Bidirectional data mode enable"]
pub struct BIDIMODE_W<'a> {
w: &'a mut W,
}
impl<'a> BIDIMODE_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 << 15)) | ((value as u32 & 0x01) << 15);
self.w
}
}
#[doc = "Field `BIDIOE` reader - Output enable in bidirectional mode"]
pub struct BIDIOE_R(crate::FieldReader<bool, bool>);
impl BIDIOE_R {
pub(crate) fn new(bits: bool) -> Self {
BIDIOE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BIDIOE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BIDIOE` writer - Output enable in bidirectional mode"]
pub struct BIDIOE_W<'a> {
w: &'a mut W,
}
impl<'a> BIDIOE_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 << 14)) | ((value as u32 & 0x01) << 14);
self.w
}
}
#[doc = "Field `CRCEN` reader - Hardware CRC calculation enable"]
pub struct CRCEN_R(crate::FieldReader<bool, bool>);
impl CRCEN_R {
pub(crate) fn new(bits: bool) -> Self {
CRCEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CRCEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CRCEN` writer - Hardware CRC calculation enable"]
pub struct CRCEN_W<'a> {
w: &'a mut W,
}
impl<'a> CRCEN_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 << 13)) | ((value as u32 & 0x01) << 13);
self.w
}
}
#[doc = "Field `CRCNEXT` reader - CRC transfer next"]
pub struct CRCNEXT_R(crate::FieldReader<bool, bool>);
impl CRCNEXT_R {
pub(crate) fn new(bits: bool) -> Self {
CRCNEXT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CRCNEXT_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CRCNEXT` writer - CRC transfer next"]
pub struct CRCNEXT_W<'a> {
w: &'a mut W,
}
impl<'a> CRCNEXT_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 << 12)) | ((value as u32 & 0x01) << 12);
self.w
}
}
#[doc = "Field `DFF` reader - Data frame format"]
pub struct DFF_R(crate::FieldReader<bool, bool>);
impl DFF_R {
pub(crate) fn new(bits: bool) -> Self {
DFF_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for DFF_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DFF` writer - Data frame format"]
pub struct DFF_W<'a> {
w: &'a mut W,
}
impl<'a> DFF_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 << 11)) | ((value as u32 & 0x01) << 11);
self.w
}
}
#[doc = "Field `RXONLY` reader - Receive only"]
pub struct RXONLY_R(crate::FieldReader<bool, bool>);
impl RXONLY_R {
pub(crate) fn new(bits: bool) -> Self {
RXONLY_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RXONLY_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RXONLY` writer - Receive only"]
pub struct RXONLY_W<'a> {
w: &'a mut W,
}
impl<'a> RXONLY_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 << 10)) | ((value as u32 & 0x01) << 10);
self.w
}
}
#[doc = "Field `SSM` reader - Software slave management"]
pub struct SSM_R(crate::FieldReader<bool, bool>);
impl SSM_R {
pub(crate) fn new(bits: bool) -> Self {
SSM_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SSM_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SSM` writer - Software slave management"]
pub struct SSM_W<'a> {
w: &'a mut W,
}
impl<'a> SSM_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 << 9)) | ((value as u32 & 0x01) << 9);
self.w
}
}
#[doc = "Field `SSI` reader - Internal slave select"]
pub struct SSI_R(crate::FieldReader<bool, bool>);
impl SSI_R {
pub(crate) fn new(bits: bool) -> Self {
SSI_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SSI_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SSI` writer - Internal slave select"]
pub struct SSI_W<'a> {
w: &'a mut W,
}
impl<'a> SSI_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 << 8)) | ((value as u32 & 0x01) << 8);
self.w
}
}
#[doc = "Field `LSBFIRST` reader - Frame format"]
pub struct LSBFIRST_R(crate::FieldReader<bool, bool>);
impl LSBFIRST_R {
pub(crate) fn new(bits: bool) -> Self {
LSBFIRST_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSBFIRST_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSBFIRST` writer - Frame format"]
pub struct LSBFIRST_W<'a> {
w: &'a mut W,
}
impl<'a> LSBFIRST_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 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "Field `SPE` reader - SPI enable"]
pub struct SPE_R(crate::FieldReader<bool, bool>);
impl SPE_R {
pub(crate) fn new(bits: bool) -> Self {
SPE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SPE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SPE` writer - SPI enable"]
pub struct SPE_W<'a> {
w: &'a mut W,
}
impl<'a> SPE_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 << 6)) | ((value as u32 & 0x01) << 6);
self.w
}
}
#[doc = "Field `BR` reader - Baud rate control"]
pub struct BR_R(crate::FieldReader<u8, u8>);
impl BR_R {
pub(crate) fn new(bits: u8) -> Self {
BR_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BR_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BR` writer - Baud rate control"]
pub struct BR_W<'a> {
w: &'a mut W,
}
impl<'a> BR_W<'a> {
#[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 & !(0x07 << 3)) | ((value as u32 & 0x07) << 3);
self.w
}
}
#[doc = "Field `MSTR` reader - Master selection"]
pub struct MSTR_R(crate::FieldReader<bool, bool>);
impl MSTR_R {
pub(crate) fn new(bits: bool) -> Self {
MSTR_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MSTR_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MSTR` writer - Master selection"]
pub struct MSTR_W<'a> {
w: &'a mut W,
}
impl<'a> MSTR_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 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Field `CPOL` reader - Clock polarity"]
pub struct CPOL_R(crate::FieldReader<bool, bool>);
impl CPOL_R {
pub(crate) fn new(bits: bool) -> Self {
CPOL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CPOL_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CPOL` writer - Clock polarity"]
pub struct CPOL_W<'a> {
w: &'a mut W,
}
impl<'a> CPOL_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 = "Field `CPHA` reader - Clock phase"]
pub struct CPHA_R(crate::FieldReader<bool, bool>);
impl CPHA_R {
pub(crate) fn new(bits: bool) -> Self {
CPHA_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CPHA_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CPHA` writer - Clock phase"]
pub struct CPHA_W<'a> {
w: &'a mut W,
}
impl<'a> CPHA_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
}
}
impl R {
#[doc = "Bit 15 - Bidirectional data mode enable"]
#[inline(always)]
pub fn bidimode(&self) -> BIDIMODE_R {
BIDIMODE_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 14 - Output enable in bidirectional mode"]
#[inline(always)]
pub fn bidioe(&self) -> BIDIOE_R {
BIDIOE_R::new(((self.bits >> 14) & 0x01) != 0)
}
#[doc = "Bit 13 - Hardware CRC calculation enable"]
#[inline(always)]
pub fn crcen(&self) -> CRCEN_R {
CRCEN_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 12 - CRC transfer next"]
#[inline(always)]
pub fn crcnext(&self) -> CRCNEXT_R {
CRCNEXT_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 11 - Data frame format"]
#[inline(always)]
pub fn dff(&self) -> DFF_R {
DFF_R::new(((self.bits >> 11) & 0x01) != 0)
}
#[doc = "Bit 10 - Receive only"]
#[inline(always)]
pub fn rxonly(&self) -> RXONLY_R {
RXONLY_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 9 - Software slave management"]
#[inline(always)]
pub fn ssm(&self) -> SSM_R {
SSM_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - Internal slave select"]
#[inline(always)]
pub fn ssi(&self) -> SSI_R {
SSI_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 7 - Frame format"]
#[inline(always)]
pub fn lsbfirst(&self) -> LSBFIRST_R {
LSBFIRST_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 6 - SPI enable"]
#[inline(always)]
pub fn spe(&self) -> SPE_R {
SPE_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bits 3:5 - Baud rate control"]
#[inline(always)]
pub fn br(&self) -> BR_R {
BR_R::new(((self.bits >> 3) & 0x07) as u8)
}
#[doc = "Bit 2 - Master selection"]
#[inline(always)]
pub fn mstr(&self) -> MSTR_R {
MSTR_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Clock polarity"]
#[inline(always)]
pub fn cpol(&self) -> CPOL_R {
CPOL_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Clock phase"]
#[inline(always)]
pub fn cpha(&self) -> CPHA_R {
CPHA_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 15 - Bidirectional data mode enable"]
#[inline(always)]
pub fn bidimode(&mut self) -> BIDIMODE_W {
BIDIMODE_W { w: self }
}
#[doc = "Bit 14 - Output enable in bidirectional mode"]
#[inline(always)]
pub fn bidioe(&mut self) -> BIDIOE_W {
BIDIOE_W { w: self }
}
#[doc = "Bit 13 - Hardware CRC calculation enable"]
#[inline(always)]
pub fn crcen(&mut self) -> CRCEN_W {
CRCEN_W { w: self }
}
#[doc = "Bit 12 - CRC transfer next"]
#[inline(always)]
pub fn crcnext(&mut self) -> CRCNEXT_W {
CRCNEXT_W { w: self }
}
#[doc = "Bit 11 - Data frame format"]
#[inline(always)]
pub fn dff(&mut self) -> DFF_W {
DFF_W { w: self }
}
#[doc = "Bit 10 - Receive only"]
#[inline(always)]
pub fn rxonly(&mut self) -> RXONLY_W {
RXONLY_W { w: self }
}
#[doc = "Bit 9 - Software slave management"]
#[inline(always)]
pub fn ssm(&mut self) -> SSM_W {
SSM_W { w: self }
}
#[doc = "Bit 8 - Internal slave select"]
#[inline(always)]
pub fn ssi(&mut self) -> SSI_W {
SSI_W { w: self }
}
#[doc = "Bit 7 - Frame format"]
#[inline(always)]
pub fn lsbfirst(&mut self) -> LSBFIRST_W {
LSBFIRST_W { w: self }
}
#[doc = "Bit 6 - SPI enable"]
#[inline(always)]
pub fn spe(&mut self) -> SPE_W {
SPE_W { w: self }
}
#[doc = "Bits 3:5 - Baud rate control"]
#[inline(always)]
pub fn br(&mut self) -> BR_W {
BR_W { w: self }
}
#[doc = "Bit 2 - Master selection"]
#[inline(always)]
pub fn mstr(&mut self) -> MSTR_W {
MSTR_W { w: self }
}
#[doc = "Bit 1 - Clock polarity"]
#[inline(always)]
pub fn cpol(&mut self) -> CPOL_W {
CPOL_W { w: self }
}
#[doc = "Bit 0 - Clock phase"]
#[inline(always)]
pub fn cpha(&mut self) -> CPHA_W {
CPHA_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 = "control register 1\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 [cr1](index.html) module"]
pub struct CR1_SPEC;
impl crate::RegisterSpec for CR1_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [cr1::R](R) reader structure"]
impl crate::Readable for CR1_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr1::W](W) writer structure"]
impl crate::Writable for CR1_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CR1 to value 0"]
impl crate::Resettable for CR1_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}