#[doc = "Reader of register ASMR"]
pub type R = crate::R<u32, super::ASMR>;
#[doc = "Writer for register ASMR"]
pub type W = crate::W<u32, super::ASMR>;
#[doc = "Register ASMR `reset()`'s with value 0"]
impl crate::ResetValue for super::ASMR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Enable Gate\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum ENGT_A {
#[doc = "0: No conversion requests are issued"]
VALUE1 = 0,
#[doc = "1: Conversion requests are issued if at least one pending bit is set"]
VALUE2 = 1,
#[doc = "2: Conversion requests are issued if at least one pending bit is set and REQGTx = 1."]
VALUE3 = 2,
#[doc = "3: Conversion requests are issued if at least one pending bit is set and REQGTx = 0."]
VALUE4 = 3,
}
impl From<ENGT_A> for u8 {
#[inline(always)]
fn from(variant: ENGT_A) -> Self {
variant as _
}
}
#[doc = "Reader of field `ENGT`"]
pub type ENGT_R = crate::R<u8, ENGT_A>;
impl ENGT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ENGT_A {
match self.bits {
0 => ENGT_A::VALUE1,
1 => ENGT_A::VALUE2,
2 => ENGT_A::VALUE3,
3 => ENGT_A::VALUE4,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == ENGT_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == ENGT_A::VALUE2
}
#[doc = "Checks if the value of the field is `VALUE3`"]
#[inline(always)]
pub fn is_value3(&self) -> bool {
*self == ENGT_A::VALUE3
}
#[doc = "Checks if the value of the field is `VALUE4`"]
#[inline(always)]
pub fn is_value4(&self) -> bool {
*self == ENGT_A::VALUE4
}
}
#[doc = "Write proxy for field `ENGT`"]
pub struct ENGT_W<'a> {
w: &'a mut W,
}
impl<'a> ENGT_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ENGT_A) -> &'a mut W {
{
self.bits(variant.into())
}
}
#[doc = "No conversion requests are issued"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(ENGT_A::VALUE1)
}
#[doc = "Conversion requests are issued if at least one pending bit is set"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(ENGT_A::VALUE2)
}
#[doc = "Conversion requests are issued if at least one pending bit is set and REQGTx = 1."]
#[inline(always)]
pub fn value3(self) -> &'a mut W {
self.variant(ENGT_A::VALUE3)
}
#[doc = "Conversion requests are issued if at least one pending bit is set and REQGTx = 0."]
#[inline(always)]
pub fn value4(self) -> &'a mut W {
self.variant(ENGT_A::VALUE4)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
self.w
}
}
#[doc = "Enable External Trigger\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ENTR_A {
#[doc = "0: External trigger disabled"]
VALUE1 = 0,
#[doc = "1: The selected edge at the selected trigger input signal REQTR generates the load event"]
VALUE2 = 1,
}
impl From<ENTR_A> for bool {
#[inline(always)]
fn from(variant: ENTR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `ENTR`"]
pub type ENTR_R = crate::R<bool, ENTR_A>;
impl ENTR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ENTR_A {
match self.bits {
false => ENTR_A::VALUE1,
true => ENTR_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == ENTR_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == ENTR_A::VALUE2
}
}
#[doc = "Write proxy for field `ENTR`"]
pub struct ENTR_W<'a> {
w: &'a mut W,
}
impl<'a> ENTR_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ENTR_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "External trigger disabled"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(ENTR_A::VALUE1)
}
#[doc = "The selected edge at the selected trigger input signal REQTR generates the load event"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(ENTR_A::VALUE2)
}
#[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 = "Enable Source Interrupt\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ENSI_A {
#[doc = "0: No request source interrupt"]
VALUE1 = 0,
#[doc = "1: A request source interrupt is generated upon a request source event (last pending conversion is finished)"]
VALUE2 = 1,
}
impl From<ENSI_A> for bool {
#[inline(always)]
fn from(variant: ENSI_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `ENSI`"]
pub type ENSI_R = crate::R<bool, ENSI_A>;
impl ENSI_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ENSI_A {
match self.bits {
false => ENSI_A::VALUE1,
true => ENSI_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == ENSI_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == ENSI_A::VALUE2
}
}
#[doc = "Write proxy for field `ENSI`"]
pub struct ENSI_W<'a> {
w: &'a mut W,
}
impl<'a> ENSI_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ENSI_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No request source interrupt"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(ENSI_A::VALUE1)
}
#[doc = "A request source interrupt is generated upon a request source event (last pending conversion is finished)"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(ENSI_A::VALUE2)
}
#[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 = "Autoscan Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SCAN_A {
#[doc = "0: No autoscan"]
VALUE1 = 0,
#[doc = "1: Autoscan functionality enabled: a request source event automatically generates a load event"]
VALUE2 = 1,
}
impl From<SCAN_A> for bool {
#[inline(always)]
fn from(variant: SCAN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `SCAN`"]
pub type SCAN_R = crate::R<bool, SCAN_A>;
impl SCAN_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SCAN_A {
match self.bits {
false => SCAN_A::VALUE1,
true => SCAN_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == SCAN_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == SCAN_A::VALUE2
}
}
#[doc = "Write proxy for field `SCAN`"]
pub struct SCAN_W<'a> {
w: &'a mut W,
}
impl<'a> SCAN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SCAN_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No autoscan"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(SCAN_A::VALUE1)
}
#[doc = "Autoscan functionality enabled: a request source event automatically generates a load event"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(SCAN_A::VALUE2)
}
#[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 = "Autoscan Source Load Event Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LDM_A {
#[doc = "0: Overwrite mode: Copy all bits from the select registers to the pending registers upon a load event"]
VALUE1 = 0,
#[doc = "1: Combine mode: Set all pending bits that are set in the select registers upon a load event (logic OR)"]
VALUE2 = 1,
}
impl From<LDM_A> for bool {
#[inline(always)]
fn from(variant: LDM_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `LDM`"]
pub type LDM_R = crate::R<bool, LDM_A>;
impl LDM_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LDM_A {
match self.bits {
false => LDM_A::VALUE1,
true => LDM_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == LDM_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == LDM_A::VALUE2
}
}
#[doc = "Write proxy for field `LDM`"]
pub struct LDM_W<'a> {
w: &'a mut W,
}
impl<'a> LDM_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LDM_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Overwrite mode: Copy all bits from the select registers to the pending registers upon a load event"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(LDM_A::VALUE1)
}
#[doc = "Combine mode: Set all pending bits that are set in the select registers upon a load event (logic OR)"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(LDM_A::VALUE2)
}
#[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 = "Request Gate Level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum REQGT_A {
#[doc = "0: The gate input is low"]
VALUE1 = 0,
#[doc = "1: The gate input is high"]
VALUE2 = 1,
}
impl From<REQGT_A> for bool {
#[inline(always)]
fn from(variant: REQGT_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `REQGT`"]
pub type REQGT_R = crate::R<bool, REQGT_A>;
impl REQGT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> REQGT_A {
match self.bits {
false => REQGT_A::VALUE1,
true => REQGT_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == REQGT_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == REQGT_A::VALUE2
}
}
#[doc = "Clear Pending Bits\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CLRPND_AW {
#[doc = "0: No action"]
VALUE1 = 0,
#[doc = "1: The bits in register GxASPNDx are cleared"]
VALUE2 = 1,
}
impl From<CLRPND_AW> for bool {
#[inline(always)]
fn from(variant: CLRPND_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Write proxy for field `CLRPND`"]
pub struct CLRPND_W<'a> {
w: &'a mut W,
}
impl<'a> CLRPND_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CLRPND_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No action"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(CLRPND_AW::VALUE1)
}
#[doc = "The bits in register GxASPNDx are cleared"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(CLRPND_AW::VALUE2)
}
#[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 = "Generate Load Event\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LDEV_AW {
#[doc = "0: No action"]
VALUE1 = 0,
#[doc = "1: A load event is generated"]
VALUE2 = 1,
}
impl From<LDEV_AW> for bool {
#[inline(always)]
fn from(variant: LDEV_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Write proxy for field `LDEV`"]
pub struct LDEV_W<'a> {
w: &'a mut W,
}
impl<'a> LDEV_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LDEV_AW) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "No action"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(LDEV_AW::VALUE1)
}
#[doc = "A load event is generated"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(LDEV_AW::VALUE2)
}
#[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 = "Repeat Disable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RPTDIS_A {
#[doc = "0: A cancelled conversion is repeated"]
VALUE1 = 0,
#[doc = "1: A cancelled conversion is discarded"]
VALUE2 = 1,
}
impl From<RPTDIS_A> for bool {
#[inline(always)]
fn from(variant: RPTDIS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `RPTDIS`"]
pub type RPTDIS_R = crate::R<bool, RPTDIS_A>;
impl RPTDIS_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RPTDIS_A {
match self.bits {
false => RPTDIS_A::VALUE1,
true => RPTDIS_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
*self == RPTDIS_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
*self == RPTDIS_A::VALUE2
}
}
#[doc = "Write proxy for field `RPTDIS`"]
pub struct RPTDIS_W<'a> {
w: &'a mut W,
}
impl<'a> RPTDIS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RPTDIS_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "A cancelled conversion is repeated"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(RPTDIS_A::VALUE1)
}
#[doc = "A cancelled conversion is discarded"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(RPTDIS_A::VALUE2)
}
#[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 << 16)) | (((value as u32) & 0x01) << 16);
self.w
}
}
impl R {
#[doc = "Bits 0:1 - Enable Gate"]
#[inline(always)]
pub fn engt(&self) -> ENGT_R {
ENGT_R::new((self.bits & 0x03) as u8)
}
#[doc = "Bit 2 - Enable External Trigger"]
#[inline(always)]
pub fn entr(&self) -> ENTR_R {
ENTR_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Enable Source Interrupt"]
#[inline(always)]
pub fn ensi(&self) -> ENSI_R {
ENSI_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Autoscan Enable"]
#[inline(always)]
pub fn scan(&self) -> SCAN_R {
SCAN_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Autoscan Source Load Event Mode"]
#[inline(always)]
pub fn ldm(&self) -> LDM_R {
LDM_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 7 - Request Gate Level"]
#[inline(always)]
pub fn reqgt(&self) -> REQGT_R {
REQGT_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 16 - Repeat Disable"]
#[inline(always)]
pub fn rptdis(&self) -> RPTDIS_R {
RPTDIS_R::new(((self.bits >> 16) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:1 - Enable Gate"]
#[inline(always)]
pub fn engt(&mut self) -> ENGT_W {
ENGT_W { w: self }
}
#[doc = "Bit 2 - Enable External Trigger"]
#[inline(always)]
pub fn entr(&mut self) -> ENTR_W {
ENTR_W { w: self }
}
#[doc = "Bit 3 - Enable Source Interrupt"]
#[inline(always)]
pub fn ensi(&mut self) -> ENSI_W {
ENSI_W { w: self }
}
#[doc = "Bit 4 - Autoscan Enable"]
#[inline(always)]
pub fn scan(&mut self) -> SCAN_W {
SCAN_W { w: self }
}
#[doc = "Bit 5 - Autoscan Source Load Event Mode"]
#[inline(always)]
pub fn ldm(&mut self) -> LDM_W {
LDM_W { w: self }
}
#[doc = "Bit 8 - Clear Pending Bits"]
#[inline(always)]
pub fn clrpnd(&mut self) -> CLRPND_W {
CLRPND_W { w: self }
}
#[doc = "Bit 9 - Generate Load Event"]
#[inline(always)]
pub fn ldev(&mut self) -> LDEV_W {
LDEV_W { w: self }
}
#[doc = "Bit 16 - Repeat Disable"]
#[inline(always)]
pub fn rptdis(&mut self) -> RPTDIS_W {
RPTDIS_W { w: self }
}
}