#[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]
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 `FORCE_OPTLOAD`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FORCE_OPTLOADR {
#[doc = "Force option byte loading inactive"]
INACTIVE,
#[doc = "Force option byte loading active"]
ACTIVE,
}
impl FORCE_OPTLOADR {
#[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 {
FORCE_OPTLOADR::INACTIVE => false,
FORCE_OPTLOADR::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FORCE_OPTLOADR {
match value {
false => FORCE_OPTLOADR::INACTIVE,
true => FORCE_OPTLOADR::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `INACTIVE`"]
#[inline]
pub fn is_inactive(&self) -> bool {
*self == FORCE_OPTLOADR::INACTIVE
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline]
pub fn is_active(&self) -> bool {
*self == FORCE_OPTLOADR::ACTIVE
}
}
#[doc = "Possible values of the field `EOPIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EOPIER {
#[doc = "End of operation interrupt disabled"]
DISABLED,
#[doc = "End of operation interrupt enabled"]
ENABLED,
}
impl EOPIER {
#[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 {
EOPIER::DISABLED => false,
EOPIER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> EOPIER {
match value {
false => EOPIER::DISABLED,
true => EOPIER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == EOPIER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == EOPIER::ENABLED
}
}
#[doc = "Possible values of the field `ERRIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ERRIER {
#[doc = "Error interrupt generation disabled"]
DISABLED,
#[doc = "Error interrupt generation enabled"]
ENABLED,
}
impl ERRIER {
#[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 {
ERRIER::DISABLED => false,
ERRIER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> ERRIER {
match value {
false => ERRIER::DISABLED,
true => ERRIER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == ERRIER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == ERRIER::ENABLED
}
}
#[doc = "Possible values of the field `OPTWRE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPTWRER {
#[doc = "Option byte write enabled"]
DISABLED,
#[doc = "Option byte write disabled"]
ENABLED,
}
impl OPTWRER {
#[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 {
OPTWRER::DISABLED => false,
OPTWRER::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> OPTWRER {
match value {
false => OPTWRER::DISABLED,
true => OPTWRER::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == OPTWRER::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == OPTWRER::ENABLED
}
}
#[doc = "Possible values of the field `LOCK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LOCKR {
#[doc = "FLASH_CR register is unlocked"]
UNLOCKED,
#[doc = "FLASH_CR register is locked"]
LOCKED,
}
impl LOCKR {
#[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 {
LOCKR::UNLOCKED => false,
LOCKR::LOCKED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> LOCKR {
match value {
false => LOCKR::UNLOCKED,
true => LOCKR::LOCKED,
}
}
#[doc = "Checks if the value of the field is `UNLOCKED`"]
#[inline]
pub fn is_unlocked(&self) -> bool {
*self == LOCKR::UNLOCKED
}
#[doc = "Checks if the value of the field is `LOCKED`"]
#[inline]
pub fn is_locked(&self) -> bool {
*self == LOCKR::LOCKED
}
}
#[doc = "Possible values of the field `STRT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STRTR {
#[doc = "Trigger an erase operation"]
START,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl STRTR {
#[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 {
STRTR::START => true,
STRTR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> STRTR {
match value {
true => STRTR::START,
i => STRTR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `START`"]
#[inline]
pub fn is_start(&self) -> bool {
*self == STRTR::START
}
}
#[doc = "Possible values of the field `OPTER`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPTERR {
#[doc = "Erase option byte activated"]
OPTIONBYTEERASE,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl OPTERR {
#[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 {
OPTERR::OPTIONBYTEERASE => true,
OPTERR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> OPTERR {
match value {
true => OPTERR::OPTIONBYTEERASE,
i => OPTERR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `OPTIONBYTEERASE`"]
#[inline]
pub fn is_option_byte_erase(&self) -> bool {
*self == OPTERR::OPTIONBYTEERASE
}
}
#[doc = "Possible values of the field `OPTPG`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OPTPGR {
#[doc = "Program option byte activated"]
OPTIONBYTEPROGRAMMING,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl OPTPGR {
#[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 {
OPTPGR::OPTIONBYTEPROGRAMMING => true,
OPTPGR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> OPTPGR {
match value {
true => OPTPGR::OPTIONBYTEPROGRAMMING,
i => OPTPGR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `OPTIONBYTEPROGRAMMING`"]
#[inline]
pub fn is_option_byte_programming(&self) -> bool {
*self == OPTPGR::OPTIONBYTEPROGRAMMING
}
}
#[doc = "Possible values of the field `MER`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MERR {
#[doc = "Erase activated for all user sectors"]
MASSERASE,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl MERR {
#[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 {
MERR::MASSERASE => true,
MERR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> MERR {
match value {
true => MERR::MASSERASE,
i => MERR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `MASSERASE`"]
#[inline]
pub fn is_mass_erase(&self) -> bool {
*self == MERR::MASSERASE
}
}
#[doc = "Possible values of the field `PER`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PERR {
#[doc = "Erase activated for selected page"]
PAGEERASE,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl PERR {
#[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 {
PERR::PAGEERASE => true,
PERR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PERR {
match value {
true => PERR::PAGEERASE,
i => PERR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `PAGEERASE`"]
#[inline]
pub fn is_page_erase(&self) -> bool {
*self == PERR::PAGEERASE
}
}
#[doc = "Possible values of the field `PG`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PGR {
#[doc = "Flash programming activated"]
PROGRAM,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl PGR {
#[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 {
PGR::PROGRAM => true,
PGR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PGR {
match value {
true => PGR::PROGRAM,
i => PGR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `PROGRAM`"]
#[inline]
pub fn is_program(&self) -> bool {
*self == PGR::PROGRAM
}
}
#[doc = "Values that can be written to the field `FORCE_OPTLOAD`"]
pub enum FORCE_OPTLOADW {
#[doc = "Force option byte loading inactive"]
INACTIVE,
#[doc = "Force option byte loading active"]
ACTIVE,
}
impl FORCE_OPTLOADW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
FORCE_OPTLOADW::INACTIVE => false,
FORCE_OPTLOADW::ACTIVE => true,
}
}
}
#[doc = r" Proxy"]
pub struct _FORCE_OPTLOADW<'a> {
w: &'a mut W,
}
impl<'a> _FORCE_OPTLOADW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FORCE_OPTLOADW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Force option byte loading inactive"]
#[inline]
pub fn inactive(self) -> &'a mut W {
self.variant(FORCE_OPTLOADW::INACTIVE)
}
#[doc = "Force option byte loading active"]
#[inline]
pub fn active(self) -> &'a mut W {
self.variant(FORCE_OPTLOADW::ACTIVE)
}
#[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 = 13;
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 `EOPIE`"]
pub enum EOPIEW {
#[doc = "End of operation interrupt disabled"]
DISABLED,
#[doc = "End of operation interrupt enabled"]
ENABLED,
}
impl EOPIEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
EOPIEW::DISABLED => false,
EOPIEW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _EOPIEW<'a> {
w: &'a mut W,
}
impl<'a> _EOPIEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: EOPIEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "End of operation interrupt disabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(EOPIEW::DISABLED)
}
#[doc = "End of operation interrupt enabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(EOPIEW::ENABLED)
}
#[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 = 12;
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 `ERRIE`"]
pub enum ERRIEW {
#[doc = "Error interrupt generation disabled"]
DISABLED,
#[doc = "Error interrupt generation enabled"]
ENABLED,
}
impl ERRIEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
ERRIEW::DISABLED => false,
ERRIEW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _ERRIEW<'a> {
w: &'a mut W,
}
impl<'a> _ERRIEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: ERRIEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Error interrupt generation disabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(ERRIEW::DISABLED)
}
#[doc = "Error interrupt generation enabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(ERRIEW::ENABLED)
}
#[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 = 10;
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 `OPTWRE`"]
pub enum OPTWREW {
#[doc = "Option byte write enabled"]
DISABLED,
#[doc = "Option byte write disabled"]
ENABLED,
}
impl OPTWREW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
OPTWREW::DISABLED => false,
OPTWREW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _OPTWREW<'a> {
w: &'a mut W,
}
impl<'a> _OPTWREW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: OPTWREW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Option byte write enabled"]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(OPTWREW::DISABLED)
}
#[doc = "Option byte write disabled"]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(OPTWREW::ENABLED)
}
#[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 = 9;
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 `LOCK`"]
pub enum LOCKW {
#[doc = "FLASH_CR register is unlocked"]
UNLOCKED,
#[doc = "FLASH_CR register is locked"]
LOCKED,
}
impl LOCKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
LOCKW::UNLOCKED => false,
LOCKW::LOCKED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _LOCKW<'a> {
w: &'a mut W,
}
impl<'a> _LOCKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LOCKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "FLASH_CR register is unlocked"]
#[inline]
pub fn unlocked(self) -> &'a mut W {
self.variant(LOCKW::UNLOCKED)
}
#[doc = "FLASH_CR register is locked"]
#[inline]
pub fn locked(self) -> &'a mut W {
self.variant(LOCKW::LOCKED)
}
#[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 = 7;
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 `STRT`"]
pub enum STRTW {
#[doc = "Trigger an erase operation"]
START,
}
impl STRTW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
STRTW::START => true,
}
}
}
#[doc = r" Proxy"]
pub struct _STRTW<'a> {
w: &'a mut W,
}
impl<'a> _STRTW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: STRTW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Trigger an erase operation"]
#[inline]
pub fn start(self) -> &'a mut W {
self.variant(STRTW::START)
}
#[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 = 6;
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 `OPTER`"]
pub enum OPTERW {
#[doc = "Erase option byte activated"]
OPTIONBYTEERASE,
}
impl OPTERW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
OPTERW::OPTIONBYTEERASE => true,
}
}
}
#[doc = r" Proxy"]
pub struct _OPTERW<'a> {
w: &'a mut W,
}
impl<'a> _OPTERW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: OPTERW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Erase option byte activated"]
#[inline]
pub fn option_byte_erase(self) -> &'a mut W {
self.variant(OPTERW::OPTIONBYTEERASE)
}
#[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 = 5;
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 `OPTPG`"]
pub enum OPTPGW {
#[doc = "Program option byte activated"]
OPTIONBYTEPROGRAMMING,
}
impl OPTPGW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
OPTPGW::OPTIONBYTEPROGRAMMING => true,
}
}
}
#[doc = r" Proxy"]
pub struct _OPTPGW<'a> {
w: &'a mut W,
}
impl<'a> _OPTPGW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: OPTPGW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Program option byte activated"]
#[inline]
pub fn option_byte_programming(self) -> &'a mut W {
self.variant(OPTPGW::OPTIONBYTEPROGRAMMING)
}
#[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
}
}
#[doc = "Values that can be written to the field `MER`"]
pub enum MERW {
#[doc = "Erase activated for all user sectors"]
MASSERASE,
}
impl MERW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
MERW::MASSERASE => true,
}
}
}
#[doc = r" Proxy"]
pub struct _MERW<'a> {
w: &'a mut W,
}
impl<'a> _MERW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: MERW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Erase activated for all user sectors"]
#[inline]
pub fn mass_erase(self) -> &'a mut W {
self.variant(MERW::MASSERASE)
}
#[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 `PER`"]
pub enum PERW {
#[doc = "Erase activated for selected page"]
PAGEERASE,
}
impl PERW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
PERW::PAGEERASE => true,
}
}
}
#[doc = r" Proxy"]
pub struct _PERW<'a> {
w: &'a mut W,
}
impl<'a> _PERW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: PERW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Erase activated for selected page"]
#[inline]
pub fn page_erase(self) -> &'a mut W {
self.variant(PERW::PAGEERASE)
}
#[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 `PG`"]
pub enum PGW {
#[doc = "Flash programming activated"]
PROGRAM,
}
impl PGW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
PGW::PROGRAM => true,
}
}
}
#[doc = r" Proxy"]
pub struct _PGW<'a> {
w: &'a mut W,
}
impl<'a> _PGW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: PGW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Flash programming activated"]
#[inline]
pub fn program(self) -> &'a mut W {
self.variant(PGW::PROGRAM)
}
#[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
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 13 - Force option byte loading"]
#[inline]
pub fn force_optload(&self) -> FORCE_OPTLOADR {
FORCE_OPTLOADR::_from({
const MASK: bool = true;
const OFFSET: u8 = 13;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 12 - End of operation interrupt enable"]
#[inline]
pub fn eopie(&self) -> EOPIER {
EOPIER::_from({
const MASK: bool = true;
const OFFSET: u8 = 12;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 10 - Error interrupt enable"]
#[inline]
pub fn errie(&self) -> ERRIER {
ERRIER::_from({
const MASK: bool = true;
const OFFSET: u8 = 10;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 9 - Option bytes write enable"]
#[inline]
pub fn optwre(&self) -> OPTWRER {
OPTWRER::_from({
const MASK: bool = true;
const OFFSET: u8 = 9;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 7 - Lock"]
#[inline]
pub fn lock(&self) -> LOCKR {
LOCKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 6 - Start"]
#[inline]
pub fn strt(&self) -> STRTR {
STRTR::_from({
const MASK: bool = true;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 5 - Option byte erase"]
#[inline]
pub fn opter(&self) -> OPTERR {
OPTERR::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 4 - Option byte programming"]
#[inline]
pub fn optpg(&self) -> OPTPGR {
OPTPGR::_from({
const MASK: bool = true;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 2 - Mass erase"]
#[inline]
pub fn mer(&self) -> MERR {
MERR::_from({
const MASK: bool = true;
const OFFSET: u8 = 2;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 1 - Page erase"]
#[inline]
pub fn per(&self) -> PERR {
PERR::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 0 - Programming"]
#[inline]
pub fn pg(&self) -> PGR {
PGR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 128 }
}
#[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 13 - Force option byte loading"]
#[inline]
pub fn force_optload(&mut self) -> _FORCE_OPTLOADW {
_FORCE_OPTLOADW { w: self }
}
#[doc = "Bit 12 - End of operation interrupt enable"]
#[inline]
pub fn eopie(&mut self) -> _EOPIEW {
_EOPIEW { w: self }
}
#[doc = "Bit 10 - Error interrupt enable"]
#[inline]
pub fn errie(&mut self) -> _ERRIEW {
_ERRIEW { w: self }
}
#[doc = "Bit 9 - Option bytes write enable"]
#[inline]
pub fn optwre(&mut self) -> _OPTWREW {
_OPTWREW { w: self }
}
#[doc = "Bit 7 - Lock"]
#[inline]
pub fn lock(&mut self) -> _LOCKW {
_LOCKW { w: self }
}
#[doc = "Bit 6 - Start"]
#[inline]
pub fn strt(&mut self) -> _STRTW {
_STRTW { w: self }
}
#[doc = "Bit 5 - Option byte erase"]
#[inline]
pub fn opter(&mut self) -> _OPTERW {
_OPTERW { w: self }
}
#[doc = "Bit 4 - Option byte programming"]
#[inline]
pub fn optpg(&mut self) -> _OPTPGW {
_OPTPGW { w: self }
}
#[doc = "Bit 2 - Mass erase"]
#[inline]
pub fn mer(&mut self) -> _MERW {
_MERW { w: self }
}
#[doc = "Bit 1 - Page erase"]
#[inline]
pub fn per(&mut self) -> _PERW {
_PERW { w: self }
}
#[doc = "Bit 0 - Programming"]
#[inline]
pub fn pg(&mut self) -> _PGW {
_PGW { w: self }
}
}