#[doc = "Reader of register ISR"]
pub type R = crate::R<u32, super::ISR>;
#[doc = "Writer for register ISR"]
pub type W = crate::W<u32, super::ISR>;
#[doc = "Register ISR `reset()`'s with value 0"]
impl crate::ResetValue for super::ISR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "ADC ready\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADRDY_A {
#[doc = "0: ADC not yet ready to start conversion"]
NOTREADY,
#[doc = "1: ADC ready to start conversion"]
READY,
}
impl From<ADRDY_A> for bool {
#[inline(always)]
fn from(variant: ADRDY_A) -> Self {
match variant {
ADRDY_A::NOTREADY => false,
ADRDY_A::READY => true,
}
}
}
#[doc = "Reader of field `ADRDY`"]
pub type ADRDY_R = crate::R<bool, ADRDY_A>;
impl ADRDY_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ADRDY_A {
match self.bits {
false => ADRDY_A::NOTREADY,
true => ADRDY_A::READY,
}
}
#[doc = "Checks if the value of the field is `NOTREADY`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == ADRDY_A::NOTREADY
}
#[doc = "Checks if the value of the field is `READY`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == ADRDY_A::READY
}
}
#[doc = "ADC ready\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADRDY_AW {
#[doc = "1: Clear the ADC ready flag"]
CLEAR,
}
impl From<ADRDY_AW> for bool {
#[inline(always)]
fn from(variant: ADRDY_AW) -> Self {
match variant {
ADRDY_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `ADRDY`"]
pub struct ADRDY_W<'a> {
w: &'a mut W,
}
impl<'a> ADRDY_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADRDY_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the ADC ready flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(ADRDY_AW::CLEAR)
}
#[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 = "End of sampling flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOSMP_A {
#[doc = "0: Not at the end of the samplings phase"]
NOTATEND,
#[doc = "1: End of sampling phase reached"]
ATEND,
}
impl From<EOSMP_A> for bool {
#[inline(always)]
fn from(variant: EOSMP_A) -> Self {
match variant {
EOSMP_A::NOTATEND => false,
EOSMP_A::ATEND => true,
}
}
}
#[doc = "Reader of field `EOSMP`"]
pub type EOSMP_R = crate::R<bool, EOSMP_A>;
impl EOSMP_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EOSMP_A {
match self.bits {
false => EOSMP_A::NOTATEND,
true => EOSMP_A::ATEND,
}
}
#[doc = "Checks if the value of the field is `NOTATEND`"]
#[inline(always)]
pub fn is_not_at_end(&self) -> bool {
*self == EOSMP_A::NOTATEND
}
#[doc = "Checks if the value of the field is `ATEND`"]
#[inline(always)]
pub fn is_at_end(&self) -> bool {
*self == EOSMP_A::ATEND
}
}
#[doc = "End of sampling flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOSMP_AW {
#[doc = "1: Clear the sampling phase flag"]
CLEAR,
}
impl From<EOSMP_AW> for bool {
#[inline(always)]
fn from(variant: EOSMP_AW) -> Self {
match variant {
EOSMP_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `EOSMP`"]
pub struct EOSMP_W<'a> {
w: &'a mut W,
}
impl<'a> EOSMP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EOSMP_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the sampling phase flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(EOSMP_AW::CLEAR)
}
#[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 = "End of conversion flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOC_A {
#[doc = "0: Channel conversion is not complete"]
NOTCOMPLETE,
#[doc = "1: Channel conversion complete"]
COMPLETE,
}
impl From<EOC_A> for bool {
#[inline(always)]
fn from(variant: EOC_A) -> Self {
match variant {
EOC_A::NOTCOMPLETE => false,
EOC_A::COMPLETE => true,
}
}
}
#[doc = "Reader of field `EOC`"]
pub type EOC_R = crate::R<bool, EOC_A>;
impl EOC_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EOC_A {
match self.bits {
false => EOC_A::NOTCOMPLETE,
true => EOC_A::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == EOC_A::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == EOC_A::COMPLETE
}
}
#[doc = "End of conversion flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOC_AW {
#[doc = "1: Clear the channel conversion flag"]
CLEAR,
}
impl From<EOC_AW> for bool {
#[inline(always)]
fn from(variant: EOC_AW) -> Self {
match variant {
EOC_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `EOC`"]
pub struct EOC_W<'a> {
w: &'a mut W,
}
impl<'a> EOC_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EOC_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the channel conversion flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(EOC_AW::CLEAR)
}
#[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 = "End of sequence flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOS_A {
#[doc = "0: Conversion sequence is not complete"]
NOTCOMPLETE,
#[doc = "1: Conversion sequence complete"]
COMPLETE,
}
impl From<EOS_A> for bool {
#[inline(always)]
fn from(variant: EOS_A) -> Self {
match variant {
EOS_A::NOTCOMPLETE => false,
EOS_A::COMPLETE => true,
}
}
}
#[doc = "Reader of field `EOS`"]
pub type EOS_R = crate::R<bool, EOS_A>;
impl EOS_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EOS_A {
match self.bits {
false => EOS_A::NOTCOMPLETE,
true => EOS_A::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == EOS_A::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == EOS_A::COMPLETE
}
}
#[doc = "End of sequence flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOS_AW {
#[doc = "1: Clear the conversion sequence flag"]
CLEAR,
}
impl From<EOS_AW> for bool {
#[inline(always)]
fn from(variant: EOS_AW) -> Self {
match variant {
EOS_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `EOS`"]
pub struct EOS_W<'a> {
w: &'a mut W,
}
impl<'a> EOS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EOS_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the conversion sequence flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(EOS_AW::CLEAR)
}
#[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 = "ADC overrun\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OVR_A {
#[doc = "0: No overrun occurred"]
NOOVERRUN,
#[doc = "1: Overrun occurred"]
OVERRUN,
}
impl From<OVR_A> for bool {
#[inline(always)]
fn from(variant: OVR_A) -> Self {
match variant {
OVR_A::NOOVERRUN => false,
OVR_A::OVERRUN => true,
}
}
}
#[doc = "Reader of field `OVR`"]
pub type OVR_R = crate::R<bool, OVR_A>;
impl OVR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> OVR_A {
match self.bits {
false => OVR_A::NOOVERRUN,
true => OVR_A::OVERRUN,
}
}
#[doc = "Checks if the value of the field is `NOOVERRUN`"]
#[inline(always)]
pub fn is_no_overrun(&self) -> bool {
*self == OVR_A::NOOVERRUN
}
#[doc = "Checks if the value of the field is `OVERRUN`"]
#[inline(always)]
pub fn is_overrun(&self) -> bool {
*self == OVR_A::OVERRUN
}
}
#[doc = "ADC overrun\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OVR_AW {
#[doc = "1: Clear the overrun flag"]
CLEAR,
}
impl From<OVR_AW> for bool {
#[inline(always)]
fn from(variant: OVR_AW) -> Self {
match variant {
OVR_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `OVR`"]
pub struct OVR_W<'a> {
w: &'a mut W,
}
impl<'a> OVR_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: OVR_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the overrun flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(OVR_AW::CLEAR)
}
#[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 = "Analog watchdog flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AWD_A {
#[doc = "0: No analog watchdog event occurred"]
NOEVENT,
#[doc = "1: Analog watchdog event occurred"]
EVENT,
}
impl From<AWD_A> for bool {
#[inline(always)]
fn from(variant: AWD_A) -> Self {
match variant {
AWD_A::NOEVENT => false,
AWD_A::EVENT => true,
}
}
}
#[doc = "Reader of field `AWD`"]
pub type AWD_R = crate::R<bool, AWD_A>;
impl AWD_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> AWD_A {
match self.bits {
false => AWD_A::NOEVENT,
true => AWD_A::EVENT,
}
}
#[doc = "Checks if the value of the field is `NOEVENT`"]
#[inline(always)]
pub fn is_no_event(&self) -> bool {
*self == AWD_A::NOEVENT
}
#[doc = "Checks if the value of the field is `EVENT`"]
#[inline(always)]
pub fn is_event(&self) -> bool {
*self == AWD_A::EVENT
}
}
#[doc = "Analog watchdog flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum AWD_AW {
#[doc = "1: Clear the analog watchdog event flag"]
CLEAR,
}
impl From<AWD_AW> for bool {
#[inline(always)]
fn from(variant: AWD_AW) -> Self {
match variant {
AWD_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `AWD`"]
pub struct AWD_W<'a> {
w: &'a mut W,
}
impl<'a> AWD_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: AWD_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the analog watchdog event flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(AWD_AW::CLEAR)
}
#[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 = "End Of Calibration flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOCAL_A {
#[doc = "0: Calibration is not complete"]
NOTCOMPLETE,
#[doc = "1: Calibration complete"]
COMPLETE,
}
impl From<EOCAL_A> for bool {
#[inline(always)]
fn from(variant: EOCAL_A) -> Self {
match variant {
EOCAL_A::NOTCOMPLETE => false,
EOCAL_A::COMPLETE => true,
}
}
}
#[doc = "Reader of field `EOCAL`"]
pub type EOCAL_R = crate::R<bool, EOCAL_A>;
impl EOCAL_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EOCAL_A {
match self.bits {
false => EOCAL_A::NOTCOMPLETE,
true => EOCAL_A::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == EOCAL_A::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == EOCAL_A::COMPLETE
}
}
#[doc = "End Of Calibration flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOCAL_AW {
#[doc = "1: Clear the calibration flag"]
CLEAR,
}
impl From<EOCAL_AW> for bool {
#[inline(always)]
fn from(variant: EOCAL_AW) -> Self {
match variant {
EOCAL_AW::CLEAR => true,
}
}
}
#[doc = "Write proxy for field `EOCAL`"]
pub struct EOCAL_W<'a> {
w: &'a mut W,
}
impl<'a> EOCAL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EOCAL_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clear the calibration flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(EOCAL_AW::CLEAR)
}
#[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 - ADC ready"]
#[inline(always)]
pub fn adrdy(&self) -> ADRDY_R {
ADRDY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - End of sampling flag"]
#[inline(always)]
pub fn eosmp(&self) -> EOSMP_R {
EOSMP_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - End of conversion flag"]
#[inline(always)]
pub fn eoc(&self) -> EOC_R {
EOC_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - End of sequence flag"]
#[inline(always)]
pub fn eos(&self) -> EOS_R {
EOS_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - ADC overrun"]
#[inline(always)]
pub fn ovr(&self) -> OVR_R {
OVR_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 7 - Analog watchdog flag"]
#[inline(always)]
pub fn awd(&self) -> AWD_R {
AWD_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 11 - End Of Calibration flag"]
#[inline(always)]
pub fn eocal(&self) -> EOCAL_R {
EOCAL_R::new(((self.bits >> 11) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - ADC ready"]
#[inline(always)]
pub fn adrdy(&mut self) -> ADRDY_W {
ADRDY_W { w: self }
}
#[doc = "Bit 1 - End of sampling flag"]
#[inline(always)]
pub fn eosmp(&mut self) -> EOSMP_W {
EOSMP_W { w: self }
}
#[doc = "Bit 2 - End of conversion flag"]
#[inline(always)]
pub fn eoc(&mut self) -> EOC_W {
EOC_W { w: self }
}
#[doc = "Bit 3 - End of sequence flag"]
#[inline(always)]
pub fn eos(&mut self) -> EOS_W {
EOS_W { w: self }
}
#[doc = "Bit 4 - ADC overrun"]
#[inline(always)]
pub fn ovr(&mut self) -> OVR_W {
OVR_W { w: self }
}
#[doc = "Bit 7 - Analog watchdog flag"]
#[inline(always)]
pub fn awd(&mut self) -> AWD_W {
AWD_W { w: self }
}
#[doc = "Bit 11 - End Of Calibration flag"]
#[inline(always)]
pub fn eocal(&mut self) -> EOCAL_W {
EOCAL_W { w: self }
}
}