#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = "Possible values of the field `ADCAL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADCALR {
#[doc = "ADC calibration either not yet performed or completed"]
NOTCALIBRATING,
#[doc = "ADC calibration in progress"]
CALIBRATING,
}
impl ADCALR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADCALR::NOTCALIBRATING => false,
ADCALR::CALIBRATING => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADCALR {
match value {
false => ADCALR::NOTCALIBRATING,
true => ADCALR::CALIBRATING,
}
}
#[doc = "Checks if the value of the field is `NOTCALIBRATING`"]
#[inline(always)]
pub fn is_not_calibrating(&self) -> bool {
*self == ADCALR::NOTCALIBRATING
}
#[doc = "Checks if the value of the field is `CALIBRATING`"]
#[inline(always)]
pub fn is_calibrating(&self) -> bool {
*self == ADCALR::CALIBRATING
}
}
#[doc = "Values that can be written to the field `ADCAL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADCALW {
#[doc = "Start the ADC calibration sequence"]
STARTCALIBRATION,
}
impl ADCALW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
ADCALW::STARTCALIBRATION => true,
}
}
}
#[doc = r"Proxy"]
pub struct _ADCALW<'a> {
w: &'a mut W,
}
impl<'a> _ADCALW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADCALW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Start the ADC calibration sequence"]
#[inline(always)]
pub fn start_calibration(self) -> &'a mut W {
self.variant(ADCALW::STARTCALIBRATION)
}
#[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 &= !(0x01 << 31);
self.w.bits |= ((value as u32) & 0x01) << 31;
self.w
}
}
#[doc = "Possible values of the field `ADSTP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADSTPR {
#[doc = "No stop command active"]
NOTSTOPPING,
#[doc = "ADC stopping conversion"]
STOPPING,
}
impl ADSTPR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADSTPR::NOTSTOPPING => false,
ADSTPR::STOPPING => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADSTPR {
match value {
false => ADSTPR::NOTSTOPPING,
true => ADSTPR::STOPPING,
}
}
#[doc = "Checks if the value of the field is `NOTSTOPPING`"]
#[inline(always)]
pub fn is_not_stopping(&self) -> bool {
*self == ADSTPR::NOTSTOPPING
}
#[doc = "Checks if the value of the field is `STOPPING`"]
#[inline(always)]
pub fn is_stopping(&self) -> bool {
*self == ADSTPR::STOPPING
}
}
#[doc = "Values that can be written to the field `ADSTP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADSTPW {
#[doc = "Stop the active conversion"]
STOPCONVERSION,
}
impl ADSTPW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
ADSTPW::STOPCONVERSION => true,
}
}
}
#[doc = r"Proxy"]
pub struct _ADSTPW<'a> {
w: &'a mut W,
}
impl<'a> _ADSTPW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADSTPW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Stop the active conversion"]
#[inline(always)]
pub fn stop_conversion(self) -> &'a mut W {
self.variant(ADSTPW::STOPCONVERSION)
}
#[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 &= !(0x01 << 4);
self.w.bits |= ((value as u32) & 0x01) << 4;
self.w
}
}
#[doc = "Possible values of the field `ADSTART`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADSTARTR {
#[doc = "No conversion ongoing"]
NOTACTIVE,
#[doc = "ADC operating and may be converting"]
ACTIVE,
}
impl ADSTARTR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADSTARTR::NOTACTIVE => false,
ADSTARTR::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADSTARTR {
match value {
false => ADSTARTR::NOTACTIVE,
true => ADSTARTR::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `NOTACTIVE`"]
#[inline(always)]
pub fn is_not_active(&self) -> bool {
*self == ADSTARTR::NOTACTIVE
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline(always)]
pub fn is_active(&self) -> bool {
*self == ADSTARTR::ACTIVE
}
}
#[doc = "Values that can be written to the field `ADSTART`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADSTARTW {
#[doc = "Start the ADC conversion (may be delayed for hardware triggers)"]
STARTCONVERSION,
}
impl ADSTARTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
ADSTARTW::STARTCONVERSION => true,
}
}
}
#[doc = r"Proxy"]
pub struct _ADSTARTW<'a> {
w: &'a mut W,
}
impl<'a> _ADSTARTW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADSTARTW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Start the ADC conversion (may be delayed for hardware triggers)"]
#[inline(always)]
pub fn start_conversion(self) -> &'a mut W {
self.variant(ADSTARTW::STARTCONVERSION)
}
#[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 &= !(0x01 << 2);
self.w.bits |= ((value as u32) & 0x01) << 2;
self.w
}
}
#[doc = "Possible values of the field `ADDIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDISR {
#[doc = "No disable command active"]
NOTDISABLING,
#[doc = "ADC disabling"]
DISABLING,
}
impl ADDISR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADDISR::NOTDISABLING => false,
ADDISR::DISABLING => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADDISR {
match value {
false => ADDISR::NOTDISABLING,
true => ADDISR::DISABLING,
}
}
#[doc = "Checks if the value of the field is `NOTDISABLING`"]
#[inline(always)]
pub fn is_not_disabling(&self) -> bool {
*self == ADDISR::NOTDISABLING
}
#[doc = "Checks if the value of the field is `DISABLING`"]
#[inline(always)]
pub fn is_disabling(&self) -> bool {
*self == ADDISR::DISABLING
}
}
#[doc = "Values that can be written to the field `ADDIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDISW {
#[doc = "Disable the ADC"]
DISABLE,
}
impl ADDISW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
ADDISW::DISABLE => true,
}
}
}
#[doc = r"Proxy"]
pub struct _ADDISW<'a> {
w: &'a mut W,
}
impl<'a> _ADDISW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADDISW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Disable the ADC"]
#[inline(always)]
pub fn disable(self) -> &'a mut W {
self.variant(ADDISW::DISABLE)
}
#[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 &= !(0x01 << 1);
self.w.bits |= ((value as u32) & 0x01) << 1;
self.w
}
}
#[doc = "Possible values of the field `ADEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADENR {
#[doc = "ADC disabled"]
DISABLED,
#[doc = "ADC enabled"]
ENABLED,
}
impl ADENR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADENR::DISABLED => false,
ADENR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADENR {
match value {
false => ADENR::DISABLED,
true => ADENR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ADENR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ADENR::ENABLED
}
}
#[doc = "Values that can be written to the field `ADEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADENW {
#[doc = "Enable the ADC"]
ENABLED,
}
impl ADENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
ADENW::ENABLED => true,
}
}
}
#[doc = r"Proxy"]
pub struct _ADENW<'a> {
w: &'a mut W,
}
impl<'a> _ADENW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ADENW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Enable the ADC"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(ADENW::ENABLED)
}
#[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 &= !(0x01 << 0);
self.w.bits |= ((value as u32) & 0x01) << 0;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 31 - ADC calibration"]
#[inline(always)]
pub fn adcal(&self) -> ADCALR {
ADCALR::_from(((self.bits >> 31) & 0x01) != 0)
}
#[doc = "Bit 4 - ADC stop conversion command"]
#[inline(always)]
pub fn adstp(&self) -> ADSTPR {
ADSTPR::_from(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 2 - ADC start conversion command"]
#[inline(always)]
pub fn adstart(&self) -> ADSTARTR {
ADSTARTR::_from(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - ADC disable command"]
#[inline(always)]
pub fn addis(&self) -> ADDISR {
ADDISR::_from(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - ADC enable command"]
#[inline(always)]
pub fn aden(&self) -> ADENR {
ADENR::_from(((self.bits >> 0) & 0x01) != 0)
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 31 - ADC calibration"]
#[inline(always)]
pub fn adcal(&mut self) -> _ADCALW {
_ADCALW { w: self }
}
#[doc = "Bit 4 - ADC stop conversion command"]
#[inline(always)]
pub fn adstp(&mut self) -> _ADSTPW {
_ADSTPW { w: self }
}
#[doc = "Bit 2 - ADC start conversion command"]
#[inline(always)]
pub fn adstart(&mut self) -> _ADSTARTW {
_ADSTARTW { w: self }
}
#[doc = "Bit 1 - ADC disable command"]
#[inline(always)]
pub fn addis(&mut self) -> _ADDISW {
_ADDISW { w: self }
}
#[doc = "Bit 0 - ADC enable command"]
#[inline(always)]
pub fn aden(&mut self) -> _ADENW {
_ADENW { w: self }
}
}