va108xx/src/spia/ctrl1.rs

527 lines
15 KiB
Rust

#[doc = "Register `CTRL1` reader"]
pub struct R(crate::R<CTRL1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CTRL1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CTRL1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CTRL1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CTRL1` writer"]
pub struct W(crate::W<CTRL1_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CTRL1_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<CTRL1_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CTRL1_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `LBM` reader - Loop Back"]
pub struct LBM_R(crate::FieldReader<bool, bool>);
impl LBM_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
LBM_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LBM_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LBM` writer - Loop Back"]
pub struct LBM_W<'a> {
w: &'a mut W,
}
impl<'a> LBM_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 `ENABLE` reader - Enable"]
pub struct ENABLE_R(crate::FieldReader<bool, bool>);
impl ENABLE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
ENABLE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for ENABLE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `ENABLE` writer - Enable"]
pub struct ENABLE_W<'a> {
w: &'a mut W,
}
impl<'a> ENABLE_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 `MS` reader - Master/Slave (0:Master, 1:Slave)"]
pub struct MS_R(crate::FieldReader<bool, bool>);
impl MS_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
MS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MS_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MS` writer - Master/Slave (0:Master, 1:Slave)"]
pub struct MS_W<'a> {
w: &'a mut W,
}
impl<'a> MS_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 `SOD` reader - Slave output Disable"]
pub struct SOD_R(crate::FieldReader<bool, bool>);
impl SOD_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
SOD_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SOD_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SOD` writer - Slave output Disable"]
pub struct SOD_W<'a> {
w: &'a mut W,
}
impl<'a> SOD_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 = "Field `SS` reader - Slave Select"]
pub struct SS_R(crate::FieldReader<u8, u8>);
impl SS_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
SS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SS_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SS` writer - Slave Select"]
pub struct SS_W<'a> {
w: &'a mut W,
}
impl<'a> SS_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 << 4)) | ((value as u32 & 0x07) << 4);
self.w
}
}
#[doc = "Field `BLOCKMODE` reader - Block Mode Enable"]
pub struct BLOCKMODE_R(crate::FieldReader<bool, bool>);
impl BLOCKMODE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
BLOCKMODE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BLOCKMODE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BLOCKMODE` writer - Block Mode Enable"]
pub struct BLOCKMODE_W<'a> {
w: &'a mut W,
}
impl<'a> BLOCKMODE_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 `BMSTART` reader - Block Mode Start Status Enable"]
pub struct BMSTART_R(crate::FieldReader<bool, bool>);
impl BMSTART_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
BMSTART_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BMSTART_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BMSTART` writer - Block Mode Start Status Enable"]
pub struct BMSTART_W<'a> {
w: &'a mut W,
}
impl<'a> BMSTART_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 `BMSTALL` reader - Block Mode Stall Enable"]
pub struct BMSTALL_R(crate::FieldReader<bool, bool>);
impl BMSTALL_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
BMSTALL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BMSTALL_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BMSTALL` writer - Block Mode Stall Enable"]
pub struct BMSTALL_W<'a> {
w: &'a mut W,
}
impl<'a> BMSTALL_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 `MDLYCAP` reader - Master Delayed Capture Enable"]
pub struct MDLYCAP_R(crate::FieldReader<bool, bool>);
impl MDLYCAP_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
MDLYCAP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MDLYCAP_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MDLYCAP` writer - Master Delayed Capture Enable"]
pub struct MDLYCAP_W<'a> {
w: &'a mut W,
}
impl<'a> MDLYCAP_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 `MTXPAUSE` reader - Master Tx Pause Enable"]
pub struct MTXPAUSE_R(crate::FieldReader<bool, bool>);
impl MTXPAUSE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
MTXPAUSE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MTXPAUSE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MTXPAUSE` writer - Master Tx Pause Enable"]
pub struct MTXPAUSE_W<'a> {
w: &'a mut W,
}
impl<'a> MTXPAUSE_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
}
}
impl R {
#[doc = "Bit 0 - Loop Back"]
#[inline(always)]
pub fn lbm(&self) -> LBM_R {
LBM_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Enable"]
#[inline(always)]
pub fn enable(&self) -> ENABLE_R {
ENABLE_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Master/Slave (0:Master, 1:Slave)"]
#[inline(always)]
pub fn ms(&self) -> MS_R {
MS_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Slave output Disable"]
#[inline(always)]
pub fn sod(&self) -> SOD_R {
SOD_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bits 4:6 - Slave Select"]
#[inline(always)]
pub fn ss(&self) -> SS_R {
SS_R::new(((self.bits >> 4) & 0x07) as u8)
}
#[doc = "Bit 7 - Block Mode Enable"]
#[inline(always)]
pub fn blockmode(&self) -> BLOCKMODE_R {
BLOCKMODE_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 8 - Block Mode Start Status Enable"]
#[inline(always)]
pub fn bmstart(&self) -> BMSTART_R {
BMSTART_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - Block Mode Stall Enable"]
#[inline(always)]
pub fn bmstall(&self) -> BMSTALL_R {
BMSTALL_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 10 - Master Delayed Capture Enable"]
#[inline(always)]
pub fn mdlycap(&self) -> MDLYCAP_R {
MDLYCAP_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 11 - Master Tx Pause Enable"]
#[inline(always)]
pub fn mtxpause(&self) -> MTXPAUSE_R {
MTXPAUSE_R::new(((self.bits >> 11) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Loop Back"]
#[inline(always)]
pub fn lbm(&mut self) -> LBM_W {
LBM_W { w: self }
}
#[doc = "Bit 1 - Enable"]
#[inline(always)]
pub fn enable(&mut self) -> ENABLE_W {
ENABLE_W { w: self }
}
#[doc = "Bit 2 - Master/Slave (0:Master, 1:Slave)"]
#[inline(always)]
pub fn ms(&mut self) -> MS_W {
MS_W { w: self }
}
#[doc = "Bit 3 - Slave output Disable"]
#[inline(always)]
pub fn sod(&mut self) -> SOD_W {
SOD_W { w: self }
}
#[doc = "Bits 4:6 - Slave Select"]
#[inline(always)]
pub fn ss(&mut self) -> SS_W {
SS_W { w: self }
}
#[doc = "Bit 7 - Block Mode Enable"]
#[inline(always)]
pub fn blockmode(&mut self) -> BLOCKMODE_W {
BLOCKMODE_W { w: self }
}
#[doc = "Bit 8 - Block Mode Start Status Enable"]
#[inline(always)]
pub fn bmstart(&mut self) -> BMSTART_W {
BMSTART_W { w: self }
}
#[doc = "Bit 9 - Block Mode Stall Enable"]
#[inline(always)]
pub fn bmstall(&mut self) -> BMSTALL_W {
BMSTALL_W { w: self }
}
#[doc = "Bit 10 - Master Delayed Capture Enable"]
#[inline(always)]
pub fn mdlycap(&mut self) -> MDLYCAP_W {
MDLYCAP_W { w: self }
}
#[doc = "Bit 11 - Master Tx Pause Enable"]
#[inline(always)]
pub fn mtxpause(&mut self) -> MTXPAUSE_W {
MTXPAUSE_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 [ctrl1](index.html) module"]
pub struct CTRL1_SPEC;
impl crate::RegisterSpec for CTRL1_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [ctrl1::R](R) reader structure"]
impl crate::Readable for CTRL1_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [ctrl1::W](W) writer structure"]
impl crate::Writable for CTRL1_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CTRL1 to value 0"]
impl crate::Resettable for CTRL1_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}