#[doc = "Writer for register US_CR_SPI_MODE"]
pub type W = crate::W<u32, super::US_CR_SPI_MODE>;
#[doc = "Register US_CR_SPI_MODE `reset()`'s with value 0"]
impl crate::ResetValue for super::US_CR_SPI_MODE {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Write proxy for field `RSTRX`"]
pub struct RSTRX_W<'a> {
w: &'a mut W,
}
impl<'a> RSTRX_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 = "Write proxy for field `RSTTX`"]
pub struct RSTTX_W<'a> {
w: &'a mut W,
}
impl<'a> RSTTX_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 << 3)) | (((value as u32) & 0x01) << 3);
self.w
}
}
#[doc = "Write proxy for field `RXEN`"]
pub struct RXEN_W<'a> {
w: &'a mut W,
}
impl<'a> RXEN_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 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Write proxy for field `RXDIS`"]
pub struct RXDIS_W<'a> {
w: &'a mut W,
}
impl<'a> RXDIS_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 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
#[doc = "Write proxy for field `TXEN`"]
pub struct TXEN_W<'a> {
w: &'a mut W,
}
impl<'a> TXEN_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 = "Write proxy for field `TXDIS`"]
pub struct TXDIS_W<'a> {
w: &'a mut W,
}
impl<'a> TXDIS_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 = "Write proxy for field `RSTSTA`"]
pub struct RSTSTA_W<'a> {
w: &'a mut W,
}
impl<'a> RSTSTA_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 = "Write proxy for field `FCS`"]
pub struct FCS_W<'a> {
w: &'a mut W,
}
impl<'a> FCS_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 << 18)) | (((value as u32) & 0x01) << 18);
self.w
}
}
#[doc = "Write proxy for field `RCS`"]
pub struct RCS_W<'a> {
w: &'a mut W,
}
impl<'a> RCS_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 << 19)) | (((value as u32) & 0x01) << 19);
self.w
}
}
impl W {
#[doc = "Bit 2 - Reset Receiver"]
#[inline(always)]
pub fn rstrx(&mut self) -> RSTRX_W {
RSTRX_W { w: self }
}
#[doc = "Bit 3 - Reset Transmitter"]
#[inline(always)]
pub fn rsttx(&mut self) -> RSTTX_W {
RSTTX_W { w: self }
}
#[doc = "Bit 4 - Receiver Enable"]
#[inline(always)]
pub fn rxen(&mut self) -> RXEN_W {
RXEN_W { w: self }
}
#[doc = "Bit 5 - Receiver Disable"]
#[inline(always)]
pub fn rxdis(&mut self) -> RXDIS_W {
RXDIS_W { w: self }
}
#[doc = "Bit 6 - Transmitter Enable"]
#[inline(always)]
pub fn txen(&mut self) -> TXEN_W {
TXEN_W { w: self }
}
#[doc = "Bit 7 - Transmitter Disable"]
#[inline(always)]
pub fn txdis(&mut self) -> TXDIS_W {
TXDIS_W { w: self }
}
#[doc = "Bit 8 - Reset Status Bits"]
#[inline(always)]
pub fn rststa(&mut self) -> RSTSTA_W {
RSTSTA_W { w: self }
}
#[doc = "Bit 18 - Force SPI Chip Select"]
#[inline(always)]
pub fn fcs(&mut self) -> FCS_W {
FCS_W { w: self }
}
#[doc = "Bit 19 - Release SPI Chip Select"]
#[inline(always)]
pub fn rcs(&mut self) -> RCS_W {
RCS_W { w: self }
}
}