#[doc = "Reader of register CTR"]
pub type R = crate::R<u32, super::CTR>;
#[doc = "Writer for register CTR"]
pub type W = crate::W<u32, super::CTR>;
#[doc = "Register CTR `reset()`'s with value 0"]
impl crate::ResetValue for super::CTR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `CLK_EN`"]
pub type CLK_EN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CLK_EN`"]
pub struct CLK_EN_W<'a> {
w: &'a mut W,
}
impl<'a> CLK_EN_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 = "Reader of field `RX_LSB_FIRST`"]
pub type RX_LSB_FIRST_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RX_LSB_FIRST`"]
pub struct RX_LSB_FIRST_W<'a> {
w: &'a mut W,
}
impl<'a> RX_LSB_FIRST_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 = "Reader of field `TX_LSB_FIRST`"]
pub type TX_LSB_FIRST_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TX_LSB_FIRST`"]
pub struct TX_LSB_FIRST_W<'a> {
w: &'a mut W,
}
impl<'a> TX_LSB_FIRST_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 = "Reader of field `TRANS_START`"]
pub type TRANS_START_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TRANS_START`"]
pub struct TRANS_START_W<'a> {
w: &'a mut W,
}
impl<'a> TRANS_START_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 = "Reader of field `MS_MODE`"]
pub type MS_MODE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MS_MODE`"]
pub struct MS_MODE_W<'a> {
w: &'a mut W,
}
impl<'a> MS_MODE_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 = "Reader of field `SAMPLE_SCL_LEVEL`"]
pub type SAMPLE_SCL_LEVEL_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SAMPLE_SCL_LEVEL`"]
pub struct SAMPLE_SCL_LEVEL_W<'a> {
w: &'a mut W,
}
impl<'a> SAMPLE_SCL_LEVEL_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 = "Reader of field `SCL_FORCE_OUT`"]
pub type SCL_FORCE_OUT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SCL_FORCE_OUT`"]
pub struct SCL_FORCE_OUT_W<'a> {
w: &'a mut W,
}
impl<'a> SCL_FORCE_OUT_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 = "Reader of field `SDA_FORCE_OUT`"]
pub type SDA_FORCE_OUT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SDA_FORCE_OUT`"]
pub struct SDA_FORCE_OUT_W<'a> {
w: &'a mut W,
}
impl<'a> SDA_FORCE_OUT_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 8"]
#[inline(always)]
pub fn clk_en(&self) -> CLK_EN_R {
CLK_EN_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 7"]
#[inline(always)]
pub fn rx_lsb_first(&self) -> RX_LSB_FIRST_R {
RX_LSB_FIRST_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 6"]
#[inline(always)]
pub fn tx_lsb_first(&self) -> TX_LSB_FIRST_R {
TX_LSB_FIRST_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5"]
#[inline(always)]
pub fn trans_start(&self) -> TRANS_START_R {
TRANS_START_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 4"]
#[inline(always)]
pub fn ms_mode(&self) -> MS_MODE_R {
MS_MODE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 2"]
#[inline(always)]
pub fn sample_scl_level(&self) -> SAMPLE_SCL_LEVEL_R {
SAMPLE_SCL_LEVEL_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1"]
#[inline(always)]
pub fn scl_force_out(&self) -> SCL_FORCE_OUT_R {
SCL_FORCE_OUT_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0"]
#[inline(always)]
pub fn sda_force_out(&self) -> SDA_FORCE_OUT_R {
SDA_FORCE_OUT_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 8"]
#[inline(always)]
pub fn clk_en(&mut self) -> CLK_EN_W {
CLK_EN_W { w: self }
}
#[doc = "Bit 7"]
#[inline(always)]
pub fn rx_lsb_first(&mut self) -> RX_LSB_FIRST_W {
RX_LSB_FIRST_W { w: self }
}
#[doc = "Bit 6"]
#[inline(always)]
pub fn tx_lsb_first(&mut self) -> TX_LSB_FIRST_W {
TX_LSB_FIRST_W { w: self }
}
#[doc = "Bit 5"]
#[inline(always)]
pub fn trans_start(&mut self) -> TRANS_START_W {
TRANS_START_W { w: self }
}
#[doc = "Bit 4"]
#[inline(always)]
pub fn ms_mode(&mut self) -> MS_MODE_W {
MS_MODE_W { w: self }
}
#[doc = "Bit 2"]
#[inline(always)]
pub fn sample_scl_level(&mut self) -> SAMPLE_SCL_LEVEL_W {
SAMPLE_SCL_LEVEL_W { w: self }
}
#[doc = "Bit 1"]
#[inline(always)]
pub fn scl_force_out(&mut self) -> SCL_FORCE_OUT_W {
SCL_FORCE_OUT_W { w: self }
}
#[doc = "Bit 0"]
#[inline(always)]
pub fn sda_force_out(&mut self) -> SDA_FORCE_OUT_W {
SDA_FORCE_OUT_W { w: self }
}
}