#[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::DFSR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = "Possible values of the field `HALTED`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HALTEDR {
#[doc = "No active halt request debug event"]
_0,
#[doc = "Halt request debug event active"]
_1,
}
impl HALTEDR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
HALTEDR::_0 => false,
HALTEDR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> HALTEDR {
match value {
false => HALTEDR::_0,
true => HALTEDR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == HALTEDR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == HALTEDR::_1
}
}
#[doc = "Possible values of the field `BKPT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BKPTR {
#[doc = "No current breakpoint debug event"]
_0,
#[doc = "At least one current breakpoint debug event"]
_1,
}
impl BKPTR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
BKPTR::_0 => false,
BKPTR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> BKPTR {
match value {
false => BKPTR::_0,
true => BKPTR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == BKPTR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == BKPTR::_1
}
}
#[doc = "Possible values of the field `DWTTRAP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DWTTRAPR {
#[doc = "No current debug events generated by the DWT"]
_0,
#[doc = "At least one current debug event generated by the DWT"]
_1,
}
impl DWTTRAPR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
DWTTRAPR::_0 => false,
DWTTRAPR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> DWTTRAPR {
match value {
false => DWTTRAPR::_0,
true => DWTTRAPR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == DWTTRAPR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == DWTTRAPR::_1
}
}
#[doc = "Possible values of the field `VCATCH`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VCATCHR {
#[doc = "No Vector catch triggered"]
_0,
#[doc = "Vector catch triggered"]
_1,
}
impl VCATCHR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
VCATCHR::_0 => false,
VCATCHR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> VCATCHR {
match value {
false => VCATCHR::_0,
true => VCATCHR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == VCATCHR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == VCATCHR::_1
}
}
#[doc = "Possible values of the field `EXTERNAL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EXTERNALR {
#[doc = "No EDBGRQ debug event"]
_0,
#[doc = "EDBGRQ debug event"]
_1,
}
impl EXTERNALR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
EXTERNALR::_0 => false,
EXTERNALR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> EXTERNALR {
match value {
false => EXTERNALR::_0,
true => EXTERNALR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == EXTERNALR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == EXTERNALR::_1
}
}
#[doc = "Values that can be written to the field `HALTED`"]
pub enum HALTEDW {
#[doc = "No active halt request debug event"]
_0,
#[doc = "Halt request debug event active"]
_1,
}
impl HALTEDW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
HALTEDW::_0 => false,
HALTEDW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _HALTEDW<'a> {
w: &'a mut W,
}
impl<'a> _HALTEDW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HALTEDW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No active halt request debug event"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(HALTEDW::_0)
}
#[doc = "Halt request debug event active"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(HALTEDW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `BKPT`"]
pub enum BKPTW {
#[doc = "No current breakpoint debug event"]
_0,
#[doc = "At least one current breakpoint debug event"]
_1,
}
impl BKPTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
BKPTW::_0 => false,
BKPTW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _BKPTW<'a> {
w: &'a mut W,
}
impl<'a> _BKPTW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: BKPTW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No current breakpoint debug event"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(BKPTW::_0)
}
#[doc = "At least one current breakpoint debug event"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(BKPTW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 1;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `DWTTRAP`"]
pub enum DWTTRAPW {
#[doc = "No current debug events generated by the DWT"]
_0,
#[doc = "At least one current debug event generated by the DWT"]
_1,
}
impl DWTTRAPW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
DWTTRAPW::_0 => false,
DWTTRAPW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _DWTTRAPW<'a> {
w: &'a mut W,
}
impl<'a> _DWTTRAPW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: DWTTRAPW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No current debug events generated by the DWT"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(DWTTRAPW::_0)
}
#[doc = "At least one current debug event generated by the DWT"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(DWTTRAPW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 2;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `VCATCH`"]
pub enum VCATCHW {
#[doc = "No Vector catch triggered"]
_0,
#[doc = "Vector catch triggered"]
_1,
}
impl VCATCHW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
VCATCHW::_0 => false,
VCATCHW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _VCATCHW<'a> {
w: &'a mut W,
}
impl<'a> _VCATCHW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: VCATCHW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No Vector catch triggered"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(VCATCHW::_0)
}
#[doc = "Vector catch triggered"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(VCATCHW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 3;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `EXTERNAL`"]
pub enum EXTERNALW {
#[doc = "No EDBGRQ debug event"]
_0,
#[doc = "EDBGRQ debug event"]
_1,
}
impl EXTERNALW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
EXTERNALW::_0 => false,
EXTERNALW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _EXTERNALW<'a> {
w: &'a mut W,
}
impl<'a> _EXTERNALW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: EXTERNALW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "No EDBGRQ debug event"]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(EXTERNALW::_0)
}
#[doc = "EDBGRQ debug event"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(EXTERNALW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 4;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - no description available"]
#[inline]
pub fn halted(&self) -> HALTEDR {
HALTEDR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 1 - no description available"]
#[inline]
pub fn bkpt(&self) -> BKPTR {
BKPTR::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 2 - no description available"]
#[inline]
pub fn dwttrap(&self) -> DWTTRAPR {
DWTTRAPR::_from({
const MASK: bool = true;
const OFFSET: u8 = 2;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 3 - no description available"]
#[inline]
pub fn vcatch(&self) -> VCATCHR {
VCATCHR::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 4 - no description available"]
#[inline]
pub fn external(&self) -> EXTERNALR {
EXTERNALR::_from({
const MASK: bool = true;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - no description available"]
#[inline]
pub fn halted(&mut self) -> _HALTEDW {
_HALTEDW { w: self }
}
#[doc = "Bit 1 - no description available"]
#[inline]
pub fn bkpt(&mut self) -> _BKPTW {
_BKPTW { w: self }
}
#[doc = "Bit 2 - no description available"]
#[inline]
pub fn dwttrap(&mut self) -> _DWTTRAPW {
_DWTTRAPW { w: self }
}
#[doc = "Bit 3 - no description available"]
#[inline]
pub fn vcatch(&mut self) -> _VCATCHW {
_VCATCHW { w: self }
}
#[doc = "Bit 4 - no description available"]
#[inline]
pub fn external(&mut self) -> _EXTERNALW {
_EXTERNALW { w: self }
}
}