pub type R = crate::R<CR2rs>;
pub type W = crate::W<CR2rs>;
pub type SADD_R = crate::FieldReader<u16>;
pub type SADD_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RD_WRN {
Write = 0,
Read = 1,
}
impl From<RD_WRN> for bool {
#[inline(always)]
fn from(variant: RD_WRN) -> Self {
variant as u8 != 0
}
}
pub type RD_WRN_R = crate::BitReader<RD_WRN>;
impl RD_WRN_R {
#[inline(always)]
pub const fn variant(&self) -> RD_WRN {
match self.bits {
false => RD_WRN::Write,
true => RD_WRN::Read,
}
}
#[inline(always)]
pub fn is_write(&self) -> bool {
*self == RD_WRN::Write
}
#[inline(always)]
pub fn is_read(&self) -> bool {
*self == RD_WRN::Read
}
}
pub type RD_WRN_W<'a, REG> = crate::BitWriter<'a, REG, RD_WRN>;
impl<'a, REG> RD_WRN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn write(self) -> &'a mut crate::W<REG> {
self.variant(RD_WRN::Write)
}
#[inline(always)]
pub fn read(self) -> &'a mut crate::W<REG> {
self.variant(RD_WRN::Read)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ADD10 {
Bit7 = 0,
Bit10 = 1,
}
impl From<ADD10> for bool {
#[inline(always)]
fn from(variant: ADD10) -> Self {
variant as u8 != 0
}
}
pub type ADD10_R = crate::BitReader<ADD10>;
impl ADD10_R {
#[inline(always)]
pub const fn variant(&self) -> ADD10 {
match self.bits {
false => ADD10::Bit7,
true => ADD10::Bit10,
}
}
#[inline(always)]
pub fn is_bit7(&self) -> bool {
*self == ADD10::Bit7
}
#[inline(always)]
pub fn is_bit10(&self) -> bool {
*self == ADD10::Bit10
}
}
pub type ADD10_W<'a, REG> = crate::BitWriter<'a, REG, ADD10>;
impl<'a, REG> ADD10_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn bit7(self) -> &'a mut crate::W<REG> {
self.variant(ADD10::Bit7)
}
#[inline(always)]
pub fn bit10(self) -> &'a mut crate::W<REG> {
self.variant(ADD10::Bit10)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HEAD10R {
Complete = 0,
Partial = 1,
}
impl From<HEAD10R> for bool {
#[inline(always)]
fn from(variant: HEAD10R) -> Self {
variant as u8 != 0
}
}
pub type HEAD10R_R = crate::BitReader<HEAD10R>;
impl HEAD10R_R {
#[inline(always)]
pub const fn variant(&self) -> HEAD10R {
match self.bits {
false => HEAD10R::Complete,
true => HEAD10R::Partial,
}
}
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == HEAD10R::Complete
}
#[inline(always)]
pub fn is_partial(&self) -> bool {
*self == HEAD10R::Partial
}
}
pub type HEAD10R_W<'a, REG> = crate::BitWriter<'a, REG, HEAD10R>;
impl<'a, REG> HEAD10R_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn complete(self) -> &'a mut crate::W<REG> {
self.variant(HEAD10R::Complete)
}
#[inline(always)]
pub fn partial(self) -> &'a mut crate::W<REG> {
self.variant(HEAD10R::Partial)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STARTR {
NoStart = 0,
Start = 1,
}
impl From<STARTR> for bool {
#[inline(always)]
fn from(variant: STARTR) -> Self {
variant as u8 != 0
}
}
pub type START_R = crate::BitReader<STARTR>;
impl START_R {
#[inline(always)]
pub const fn variant(&self) -> STARTR {
match self.bits {
false => STARTR::NoStart,
true => STARTR::Start,
}
}
#[inline(always)]
pub fn is_no_start(&self) -> bool {
*self == STARTR::NoStart
}
#[inline(always)]
pub fn is_start(&self) -> bool {
*self == STARTR::Start
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STARTW {
Start = 1,
}
impl From<STARTW> for bool {
#[inline(always)]
fn from(variant: STARTW) -> Self {
variant as u8 != 0
}
}
pub type START_W<'a, REG> = crate::BitWriter1S<'a, REG, STARTW>;
impl<'a, REG> START_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn start(self) -> &'a mut crate::W<REG> {
self.variant(STARTW::Start)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STOPR {
NoStop = 0,
Stop = 1,
}
impl From<STOPR> for bool {
#[inline(always)]
fn from(variant: STOPR) -> Self {
variant as u8 != 0
}
}
pub type STOP_R = crate::BitReader<STOPR>;
impl STOP_R {
#[inline(always)]
pub const fn variant(&self) -> STOPR {
match self.bits {
false => STOPR::NoStop,
true => STOPR::Stop,
}
}
#[inline(always)]
pub fn is_no_stop(&self) -> bool {
*self == STOPR::NoStop
}
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == STOPR::Stop
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STOPW {
Stop = 1,
}
impl From<STOPW> for bool {
#[inline(always)]
fn from(variant: STOPW) -> Self {
variant as u8 != 0
}
}
pub type STOP_W<'a, REG> = crate::BitWriter1S<'a, REG, STOPW>;
impl<'a, REG> STOP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn stop(self) -> &'a mut crate::W<REG> {
self.variant(STOPW::Stop)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NACKR {
Ack = 0,
Nack = 1,
}
impl From<NACKR> for bool {
#[inline(always)]
fn from(variant: NACKR) -> Self {
variant as u8 != 0
}
}
pub type NACK_R = crate::BitReader<NACKR>;
impl NACK_R {
#[inline(always)]
pub const fn variant(&self) -> NACKR {
match self.bits {
false => NACKR::Ack,
true => NACKR::Nack,
}
}
#[inline(always)]
pub fn is_ack(&self) -> bool {
*self == NACKR::Ack
}
#[inline(always)]
pub fn is_nack(&self) -> bool {
*self == NACKR::Nack
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NACKW {
Nack = 1,
}
impl From<NACKW> for bool {
#[inline(always)]
fn from(variant: NACKW) -> Self {
variant as u8 != 0
}
}
pub type NACK_W<'a, REG> = crate::BitWriter1S<'a, REG, NACKW>;
impl<'a, REG> NACK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn nack(self) -> &'a mut crate::W<REG> {
self.variant(NACKW::Nack)
}
}
pub type NBYTES_R = crate::FieldReader;
pub type NBYTES_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RELOAD {
Completed = 0,
NotCompleted = 1,
}
impl From<RELOAD> for bool {
#[inline(always)]
fn from(variant: RELOAD) -> Self {
variant as u8 != 0
}
}
pub type RELOAD_R = crate::BitReader<RELOAD>;
impl RELOAD_R {
#[inline(always)]
pub const fn variant(&self) -> RELOAD {
match self.bits {
false => RELOAD::Completed,
true => RELOAD::NotCompleted,
}
}
#[inline(always)]
pub fn is_completed(&self) -> bool {
*self == RELOAD::Completed
}
#[inline(always)]
pub fn is_not_completed(&self) -> bool {
*self == RELOAD::NotCompleted
}
}
pub type RELOAD_W<'a, REG> = crate::BitWriter<'a, REG, RELOAD>;
impl<'a, REG> RELOAD_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn completed(self) -> &'a mut crate::W<REG> {
self.variant(RELOAD::Completed)
}
#[inline(always)]
pub fn not_completed(self) -> &'a mut crate::W<REG> {
self.variant(RELOAD::NotCompleted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AUTOEND {
Software = 0,
Automatic = 1,
}
impl From<AUTOEND> for bool {
#[inline(always)]
fn from(variant: AUTOEND) -> Self {
variant as u8 != 0
}
}
pub type AUTOEND_R = crate::BitReader<AUTOEND>;
impl AUTOEND_R {
#[inline(always)]
pub const fn variant(&self) -> AUTOEND {
match self.bits {
false => AUTOEND::Software,
true => AUTOEND::Automatic,
}
}
#[inline(always)]
pub fn is_software(&self) -> bool {
*self == AUTOEND::Software
}
#[inline(always)]
pub fn is_automatic(&self) -> bool {
*self == AUTOEND::Automatic
}
}
pub type AUTOEND_W<'a, REG> = crate::BitWriter<'a, REG, AUTOEND>;
impl<'a, REG> AUTOEND_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn software(self) -> &'a mut crate::W<REG> {
self.variant(AUTOEND::Software)
}
#[inline(always)]
pub fn automatic(self) -> &'a mut crate::W<REG> {
self.variant(AUTOEND::Automatic)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PECBYTER {
NoPec = 0,
Pec = 1,
}
impl From<PECBYTER> for bool {
#[inline(always)]
fn from(variant: PECBYTER) -> Self {
variant as u8 != 0
}
}
pub type PECBYTE_R = crate::BitReader<PECBYTER>;
impl PECBYTE_R {
#[inline(always)]
pub const fn variant(&self) -> PECBYTER {
match self.bits {
false => PECBYTER::NoPec,
true => PECBYTER::Pec,
}
}
#[inline(always)]
pub fn is_no_pec(&self) -> bool {
*self == PECBYTER::NoPec
}
#[inline(always)]
pub fn is_pec(&self) -> bool {
*self == PECBYTER::Pec
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PECBYTEW {
Pec = 1,
}
impl From<PECBYTEW> for bool {
#[inline(always)]
fn from(variant: PECBYTEW) -> Self {
variant as u8 != 0
}
}
pub type PECBYTE_W<'a, REG> = crate::BitWriter1S<'a, REG, PECBYTEW>;
impl<'a, REG> PECBYTE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn pec(self) -> &'a mut crate::W<REG> {
self.variant(PECBYTEW::Pec)
}
}
impl R {
#[inline(always)]
pub fn sadd(&self) -> SADD_R {
SADD_R::new((self.bits & 0x03ff) as u16)
}
#[inline(always)]
pub fn rd_wrn(&self) -> RD_WRN_R {
RD_WRN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn add10(&self) -> ADD10_R {
ADD10_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn head10r(&self) -> HEAD10R_R {
HEAD10R_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn start(&self) -> START_R {
START_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn stop(&self) -> STOP_R {
STOP_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn nack(&self) -> NACK_R {
NACK_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn nbytes(&self) -> NBYTES_R {
NBYTES_R::new(((self.bits >> 16) & 0xff) as u8)
}
#[inline(always)]
pub fn reload(&self) -> RELOAD_R {
RELOAD_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn autoend(&self) -> AUTOEND_R {
AUTOEND_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn pecbyte(&self) -> PECBYTE_R {
PECBYTE_R::new(((self.bits >> 26) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR2")
.field("pecbyte", &self.pecbyte())
.field("autoend", &self.autoend())
.field("reload", &self.reload())
.field("nbytes", &self.nbytes())
.field("nack", &self.nack())
.field("stop", &self.stop())
.field("start", &self.start())
.field("head10r", &self.head10r())
.field("add10", &self.add10())
.field("rd_wrn", &self.rd_wrn())
.field("sadd", &self.sadd())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sadd(&mut self) -> SADD_W<CR2rs> {
SADD_W::new(self, 0)
}
#[inline(always)]
pub fn rd_wrn(&mut self) -> RD_WRN_W<CR2rs> {
RD_WRN_W::new(self, 10)
}
#[inline(always)]
pub fn add10(&mut self) -> ADD10_W<CR2rs> {
ADD10_W::new(self, 11)
}
#[inline(always)]
pub fn head10r(&mut self) -> HEAD10R_W<CR2rs> {
HEAD10R_W::new(self, 12)
}
#[inline(always)]
pub fn start(&mut self) -> START_W<CR2rs> {
START_W::new(self, 13)
}
#[inline(always)]
pub fn stop(&mut self) -> STOP_W<CR2rs> {
STOP_W::new(self, 14)
}
#[inline(always)]
pub fn nack(&mut self) -> NACK_W<CR2rs> {
NACK_W::new(self, 15)
}
#[inline(always)]
pub fn nbytes(&mut self) -> NBYTES_W<CR2rs> {
NBYTES_W::new(self, 16)
}
#[inline(always)]
pub fn reload(&mut self) -> RELOAD_W<CR2rs> {
RELOAD_W::new(self, 24)
}
#[inline(always)]
pub fn autoend(&mut self) -> AUTOEND_W<CR2rs> {
AUTOEND_W::new(self, 25)
}
#[inline(always)]
pub fn pecbyte(&mut self) -> PECBYTE_W<CR2rs> {
PECBYTE_W::new(self, 26)
}
}
pub struct CR2rs;
impl crate::RegisterSpec for CR2rs {
type Ux = u32;
}
impl crate::Readable for CR2rs {}
impl crate::Writable for CR2rs {
type Safety = crate::Unsafe;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0400_e000;
}
impl crate::Resettable for CR2rs {}