pub type R = crate::R<CR1rs>;
pub type W = crate::W<CR1rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PE {
Disabled = 0,
Enabled = 1,
}
impl From<PE> for bool {
#[inline(always)]
fn from(variant: PE) -> Self {
variant as u8 != 0
}
}
pub type PE_R = crate::BitReader<PE>;
impl PE_R {
#[inline(always)]
pub const fn variant(&self) -> PE {
match self.bits {
false => PE::Disabled,
true => PE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PE::Enabled
}
}
pub type PE_W<'a, REG> = crate::BitWriter<'a, REG, PE>;
impl<'a, REG> PE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SMBUS {
I2c = 0,
Smbus = 1,
}
impl From<SMBUS> for bool {
#[inline(always)]
fn from(variant: SMBUS) -> Self {
variant as u8 != 0
}
}
pub type SMBUS_R = crate::BitReader<SMBUS>;
impl SMBUS_R {
#[inline(always)]
pub const fn variant(&self) -> SMBUS {
match self.bits {
false => SMBUS::I2c,
true => SMBUS::Smbus,
}
}
#[inline(always)]
pub fn is_i2c(&self) -> bool {
*self == SMBUS::I2c
}
#[inline(always)]
pub fn is_smbus(&self) -> bool {
*self == SMBUS::Smbus
}
}
pub type SMBUS_W<'a, REG> = crate::BitWriter<'a, REG, SMBUS>;
impl<'a, REG> SMBUS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn i2c(self) -> &'a mut crate::W<REG> {
self.variant(SMBUS::I2c)
}
#[inline(always)]
pub fn smbus(self) -> &'a mut crate::W<REG> {
self.variant(SMBUS::Smbus)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SMBTYPE {
Device = 0,
Host = 1,
}
impl From<SMBTYPE> for bool {
#[inline(always)]
fn from(variant: SMBTYPE) -> Self {
variant as u8 != 0
}
}
pub type SMBTYPE_R = crate::BitReader<SMBTYPE>;
impl SMBTYPE_R {
#[inline(always)]
pub const fn variant(&self) -> SMBTYPE {
match self.bits {
false => SMBTYPE::Device,
true => SMBTYPE::Host,
}
}
#[inline(always)]
pub fn is_device(&self) -> bool {
*self == SMBTYPE::Device
}
#[inline(always)]
pub fn is_host(&self) -> bool {
*self == SMBTYPE::Host
}
}
pub type SMBTYPE_W<'a, REG> = crate::BitWriter<'a, REG, SMBTYPE>;
impl<'a, REG> SMBTYPE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn device(self) -> &'a mut crate::W<REG> {
self.variant(SMBTYPE::Device)
}
#[inline(always)]
pub fn host(self) -> &'a mut crate::W<REG> {
self.variant(SMBTYPE::Host)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENARP {
Disabled = 0,
Enabled = 1,
}
impl From<ENARP> for bool {
#[inline(always)]
fn from(variant: ENARP) -> Self {
variant as u8 != 0
}
}
pub type ENARP_R = crate::BitReader<ENARP>;
impl ENARP_R {
#[inline(always)]
pub const fn variant(&self) -> ENARP {
match self.bits {
false => ENARP::Disabled,
true => ENARP::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENARP::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENARP::Enabled
}
}
pub type ENARP_W<'a, REG> = crate::BitWriter<'a, REG, ENARP>;
impl<'a, REG> ENARP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENARP::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENARP::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENPEC {
Disabled = 0,
Enabled = 1,
}
impl From<ENPEC> for bool {
#[inline(always)]
fn from(variant: ENPEC) -> Self {
variant as u8 != 0
}
}
pub type ENPEC_R = crate::BitReader<ENPEC>;
impl ENPEC_R {
#[inline(always)]
pub const fn variant(&self) -> ENPEC {
match self.bits {
false => ENPEC::Disabled,
true => ENPEC::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENPEC::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENPEC::Enabled
}
}
pub type ENPEC_W<'a, REG> = crate::BitWriter<'a, REG, ENPEC>;
impl<'a, REG> ENPEC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENPEC::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENPEC::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENGC {
Disabled = 0,
Enabled = 1,
}
impl From<ENGC> for bool {
#[inline(always)]
fn from(variant: ENGC) -> Self {
variant as u8 != 0
}
}
pub type ENGC_R = crate::BitReader<ENGC>;
impl ENGC_R {
#[inline(always)]
pub const fn variant(&self) -> ENGC {
match self.bits {
false => ENGC::Disabled,
true => ENGC::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENGC::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENGC::Enabled
}
}
pub type ENGC_W<'a, REG> = crate::BitWriter<'a, REG, ENGC>;
impl<'a, REG> ENGC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENGC::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENGC::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NOSTRETCH {
Enabled = 0,
Disabled = 1,
}
impl From<NOSTRETCH> for bool {
#[inline(always)]
fn from(variant: NOSTRETCH) -> Self {
variant as u8 != 0
}
}
pub type NOSTRETCH_R = crate::BitReader<NOSTRETCH>;
impl NOSTRETCH_R {
#[inline(always)]
pub const fn variant(&self) -> NOSTRETCH {
match self.bits {
false => NOSTRETCH::Enabled,
true => NOSTRETCH::Disabled,
}
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == NOSTRETCH::Enabled
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == NOSTRETCH::Disabled
}
}
pub type NOSTRETCH_W<'a, REG> = crate::BitWriter<'a, REG, NOSTRETCH>;
impl<'a, REG> NOSTRETCH_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(NOSTRETCH::Enabled)
}
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(NOSTRETCH::Disabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum START {
NoStart = 0,
Start = 1,
}
impl From<START> for bool {
#[inline(always)]
fn from(variant: START) -> Self {
variant as u8 != 0
}
}
pub type START_R = crate::BitReader<START>;
impl START_R {
#[inline(always)]
pub const fn variant(&self) -> START {
match self.bits {
false => START::NoStart,
true => START::Start,
}
}
#[inline(always)]
pub fn is_no_start(&self) -> bool {
*self == START::NoStart
}
#[inline(always)]
pub fn is_start(&self) -> bool {
*self == START::Start
}
}
pub type START_W<'a, REG> = crate::BitWriter<'a, REG, START>;
impl<'a, REG> START_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn no_start(self) -> &'a mut crate::W<REG> {
self.variant(START::NoStart)
}
#[inline(always)]
pub fn start(self) -> &'a mut crate::W<REG> {
self.variant(START::Start)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STOP {
NoStop = 0,
Stop = 1,
}
impl From<STOP> for bool {
#[inline(always)]
fn from(variant: STOP) -> Self {
variant as u8 != 0
}
}
pub type STOP_R = crate::BitReader<STOP>;
impl STOP_R {
#[inline(always)]
pub const fn variant(&self) -> STOP {
match self.bits {
false => STOP::NoStop,
true => STOP::Stop,
}
}
#[inline(always)]
pub fn is_no_stop(&self) -> bool {
*self == STOP::NoStop
}
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == STOP::Stop
}
}
pub type STOP_W<'a, REG> = crate::BitWriter<'a, REG, STOP>;
impl<'a, REG> STOP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn no_stop(self) -> &'a mut crate::W<REG> {
self.variant(STOP::NoStop)
}
#[inline(always)]
pub fn stop(self) -> &'a mut crate::W<REG> {
self.variant(STOP::Stop)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ACK {
Nak = 0,
Ack = 1,
}
impl From<ACK> for bool {
#[inline(always)]
fn from(variant: ACK) -> Self {
variant as u8 != 0
}
}
pub type ACK_R = crate::BitReader<ACK>;
impl ACK_R {
#[inline(always)]
pub const fn variant(&self) -> ACK {
match self.bits {
false => ACK::Nak,
true => ACK::Ack,
}
}
#[inline(always)]
pub fn is_nak(&self) -> bool {
*self == ACK::Nak
}
#[inline(always)]
pub fn is_ack(&self) -> bool {
*self == ACK::Ack
}
}
pub type ACK_W<'a, REG> = crate::BitWriter<'a, REG, ACK>;
impl<'a, REG> ACK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn nak(self) -> &'a mut crate::W<REG> {
self.variant(ACK::Nak)
}
#[inline(always)]
pub fn ack(self) -> &'a mut crate::W<REG> {
self.variant(ACK::Ack)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum POS {
Current = 0,
Next = 1,
}
impl From<POS> for bool {
#[inline(always)]
fn from(variant: POS) -> Self {
variant as u8 != 0
}
}
pub type POS_R = crate::BitReader<POS>;
impl POS_R {
#[inline(always)]
pub const fn variant(&self) -> POS {
match self.bits {
false => POS::Current,
true => POS::Next,
}
}
#[inline(always)]
pub fn is_current(&self) -> bool {
*self == POS::Current
}
#[inline(always)]
pub fn is_next(&self) -> bool {
*self == POS::Next
}
}
pub type POS_W<'a, REG> = crate::BitWriter<'a, REG, POS>;
impl<'a, REG> POS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn current(self) -> &'a mut crate::W<REG> {
self.variant(POS::Current)
}
#[inline(always)]
pub fn next(self) -> &'a mut crate::W<REG> {
self.variant(POS::Next)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PEC {
Disabled = 0,
Enabled = 1,
}
impl From<PEC> for bool {
#[inline(always)]
fn from(variant: PEC) -> Self {
variant as u8 != 0
}
}
pub type PEC_R = crate::BitReader<PEC>;
impl PEC_R {
#[inline(always)]
pub const fn variant(&self) -> PEC {
match self.bits {
false => PEC::Disabled,
true => PEC::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PEC::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PEC::Enabled
}
}
pub type PEC_W<'a, REG> = crate::BitWriter<'a, REG, PEC>;
impl<'a, REG> PEC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PEC::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PEC::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ALERT {
Release = 0,
Drive = 1,
}
impl From<ALERT> for bool {
#[inline(always)]
fn from(variant: ALERT) -> Self {
variant as u8 != 0
}
}
pub type ALERT_R = crate::BitReader<ALERT>;
impl ALERT_R {
#[inline(always)]
pub const fn variant(&self) -> ALERT {
match self.bits {
false => ALERT::Release,
true => ALERT::Drive,
}
}
#[inline(always)]
pub fn is_release(&self) -> bool {
*self == ALERT::Release
}
#[inline(always)]
pub fn is_drive(&self) -> bool {
*self == ALERT::Drive
}
}
pub type ALERT_W<'a, REG> = crate::BitWriter<'a, REG, ALERT>;
impl<'a, REG> ALERT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn release(self) -> &'a mut crate::W<REG> {
self.variant(ALERT::Release)
}
#[inline(always)]
pub fn drive(self) -> &'a mut crate::W<REG> {
self.variant(ALERT::Drive)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SWRST {
NotReset = 0,
Reset = 1,
}
impl From<SWRST> for bool {
#[inline(always)]
fn from(variant: SWRST) -> Self {
variant as u8 != 0
}
}
pub type SWRST_R = crate::BitReader<SWRST>;
impl SWRST_R {
#[inline(always)]
pub const fn variant(&self) -> SWRST {
match self.bits {
false => SWRST::NotReset,
true => SWRST::Reset,
}
}
#[inline(always)]
pub fn is_not_reset(&self) -> bool {
*self == SWRST::NotReset
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == SWRST::Reset
}
}
pub type SWRST_W<'a, REG> = crate::BitWriter<'a, REG, SWRST>;
impl<'a, REG> SWRST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_reset(self) -> &'a mut crate::W<REG> {
self.variant(SWRST::NotReset)
}
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(SWRST::Reset)
}
}
impl R {
#[inline(always)]
pub fn pe(&self) -> PE_R {
PE_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn smbus(&self) -> SMBUS_R {
SMBUS_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn smbtype(&self) -> SMBTYPE_R {
SMBTYPE_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn enarp(&self) -> ENARP_R {
ENARP_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn enpec(&self) -> ENPEC_R {
ENPEC_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn engc(&self) -> ENGC_R {
ENGC_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn nostretch(&self) -> NOSTRETCH_R {
NOSTRETCH_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn start(&self) -> START_R {
START_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn stop(&self) -> STOP_R {
STOP_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn ack(&self) -> ACK_R {
ACK_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn pos(&self) -> POS_R {
POS_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn pec(&self) -> PEC_R {
PEC_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn alert(&self) -> ALERT_R {
ALERT_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn swrst(&self) -> SWRST_R {
SWRST_R::new(((self.bits >> 15) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR1")
.field("swrst", &self.swrst())
.field("alert", &self.alert())
.field("pec", &self.pec())
.field("pos", &self.pos())
.field("ack", &self.ack())
.field("stop", &self.stop())
.field("start", &self.start())
.field("nostretch", &self.nostretch())
.field("engc", &self.engc())
.field("enpec", &self.enpec())
.field("enarp", &self.enarp())
.field("smbtype", &self.smbtype())
.field("smbus", &self.smbus())
.field("pe", &self.pe())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn pe(&mut self) -> PE_W<CR1rs> {
PE_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn smbus(&mut self) -> SMBUS_W<CR1rs> {
SMBUS_W::new(self, 1)
}
#[inline(always)]
#[must_use]
pub fn smbtype(&mut self) -> SMBTYPE_W<CR1rs> {
SMBTYPE_W::new(self, 3)
}
#[inline(always)]
#[must_use]
pub fn enarp(&mut self) -> ENARP_W<CR1rs> {
ENARP_W::new(self, 4)
}
#[inline(always)]
#[must_use]
pub fn enpec(&mut self) -> ENPEC_W<CR1rs> {
ENPEC_W::new(self, 5)
}
#[inline(always)]
#[must_use]
pub fn engc(&mut self) -> ENGC_W<CR1rs> {
ENGC_W::new(self, 6)
}
#[inline(always)]
#[must_use]
pub fn nostretch(&mut self) -> NOSTRETCH_W<CR1rs> {
NOSTRETCH_W::new(self, 7)
}
#[inline(always)]
#[must_use]
pub fn start(&mut self) -> START_W<CR1rs> {
START_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn stop(&mut self) -> STOP_W<CR1rs> {
STOP_W::new(self, 9)
}
#[inline(always)]
#[must_use]
pub fn ack(&mut self) -> ACK_W<CR1rs> {
ACK_W::new(self, 10)
}
#[inline(always)]
#[must_use]
pub fn pos(&mut self) -> POS_W<CR1rs> {
POS_W::new(self, 11)
}
#[inline(always)]
#[must_use]
pub fn pec(&mut self) -> PEC_W<CR1rs> {
PEC_W::new(self, 12)
}
#[inline(always)]
#[must_use]
pub fn alert(&mut self) -> ALERT_W<CR1rs> {
ALERT_W::new(self, 13)
}
#[inline(always)]
#[must_use]
pub fn swrst(&mut self) -> SWRST_W<CR1rs> {
SWRST_W::new(self, 15)
}
}
pub struct CR1rs;
impl crate::RegisterSpec for CR1rs {
type Ux = u32;
}
impl crate::Readable for CR1rs {}
impl crate::Writable for CR1rs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CR1rs {
const RESET_VALUE: u32 = 0;
}