#[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::PIO1_11 {
#[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 `FUNC`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FUNCR {
#[doc = "PIO1_11."]
PIO1_11,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl FUNCR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
FUNCR::PIO1_11 => 0,
FUNCR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> FUNCR {
match value {
0 => FUNCR::PIO1_11,
i => FUNCR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `PIO1_11`"]
#[inline]
pub fn is_pio1_11(&self) -> bool {
*self == FUNCR::PIO1_11
}
}
#[doc = "Possible values of the field `MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MODER {
#[doc = "Inactive (no pull-down/pull-up resistor enabled)."]
INACTIVE,
#[doc = "Pull-down resistor enabled."]
PULL_DOWN,
#[doc = "Pull-up resistor enabled."]
PULL_UP,
#[doc = "Repeater mode."]
REPEATER,
}
impl MODER {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
MODER::INACTIVE => 0,
MODER::PULL_DOWN => 1,
MODER::PULL_UP => 2,
MODER::REPEATER => 3,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> MODER {
match value {
0 => MODER::INACTIVE,
1 => MODER::PULL_DOWN,
2 => MODER::PULL_UP,
3 => MODER::REPEATER,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `INACTIVE`"]
#[inline]
pub fn is_inactive(&self) -> bool {
*self == MODER::INACTIVE
}
#[doc = "Checks if the value of the field is `PULL_DOWN`"]
#[inline]
pub fn is_pull_down(&self) -> bool {
*self == MODER::PULL_DOWN
}
#[doc = "Checks if the value of the field is `PULL_UP`"]
#[inline]
pub fn is_pull_up(&self) -> bool {
*self == MODER::PULL_UP
}
#[doc = "Checks if the value of the field is `REPEATER`"]
#[inline]
pub fn is_repeater(&self) -> bool {
*self == MODER::REPEATER
}
}
#[doc = "Possible values of the field `HYS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum HYSR {
#[doc = "Disable."]
DISABLED,
#[doc = "Enable."]
ENABLED,
}
impl HYSR {
#[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 {
HYSR::DISABLED => false,
HYSR::ENABLED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> HYSR {
match value {
false => HYSR::DISABLED,
true => HYSR::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == HYSR::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline]
pub fn is_enabled(&self) -> bool {
*self == HYSR::ENABLED
}
}
#[doc = "Possible values of the field `INV`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INVR {
#[doc = "Input not inverted (HIGH on pin reads as 1, LOW on pin reads as 0)."]
NOT_INVERTED,
#[doc = "Input inverted (HIGH on pin reads as 0, LOW on pin reads as 1)."]
INVERTED,
}
impl INVR {
#[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 {
INVR::NOT_INVERTED => false,
INVR::INVERTED => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> INVR {
match value {
false => INVR::NOT_INVERTED,
true => INVR::INVERTED,
}
}
#[doc = "Checks if the value of the field is `NOT_INVERTED`"]
#[inline]
pub fn is_not_inverted(&self) -> bool {
*self == INVR::NOT_INVERTED
}
#[doc = "Checks if the value of the field is `INVERTED`"]
#[inline]
pub fn is_inverted(&self) -> bool {
*self == INVR::INVERTED
}
}
#[doc = "Possible values of the field `OD`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ODR {
#[doc = "Disable."]
DISABLED,
#[doc = "Open-drain mode enabled. This is not a true open-drain mode. Input cannot be pulled up above VDD."]
OPEN_DRAIN,
}
impl ODR {
#[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 {
ODR::DISABLED => false,
ODR::OPEN_DRAIN => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> ODR {
match value {
false => ODR::DISABLED,
true => ODR::OPEN_DRAIN,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline]
pub fn is_disabled(&self) -> bool {
*self == ODR::DISABLED
}
#[doc = "Checks if the value of the field is `OPEN_DRAIN`"]
#[inline]
pub fn is_open_drain(&self) -> bool {
*self == ODR::OPEN_DRAIN
}
}
#[doc = "Values that can be written to the field `FUNC`"]
pub enum FUNCW {
#[doc = "PIO1_11."]
PIO1_11,
}
impl FUNCW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
FUNCW::PIO1_11 => 0,
}
}
}
#[doc = r" Proxy"]
pub struct _FUNCW<'a> {
w: &'a mut W,
}
impl<'a> _FUNCW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: FUNCW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "PIO1_11."]
#[inline]
pub fn pio1_11(self) -> &'a mut W {
self.variant(FUNCW::PIO1_11)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 7;
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 `MODE`"]
pub enum MODEW {
#[doc = "Inactive (no pull-down/pull-up resistor enabled)."]
INACTIVE,
#[doc = "Pull-down resistor enabled."]
PULL_DOWN,
#[doc = "Pull-up resistor enabled."]
PULL_UP,
#[doc = "Repeater mode."]
REPEATER,
}
impl MODEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> u8 {
match *self {
MODEW::INACTIVE => 0,
MODEW::PULL_DOWN => 1,
MODEW::PULL_UP => 2,
MODEW::REPEATER => 3,
}
}
}
#[doc = r" Proxy"]
pub struct _MODEW<'a> {
w: &'a mut W,
}
impl<'a> _MODEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: MODEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "Inactive (no pull-down/pull-up resistor enabled)."]
#[inline]
pub fn inactive(self) -> &'a mut W {
self.variant(MODEW::INACTIVE)
}
#[doc = "Pull-down resistor enabled."]
#[inline]
pub fn pull_down(self) -> &'a mut W {
self.variant(MODEW::PULL_DOWN)
}
#[doc = "Pull-up resistor enabled."]
#[inline]
pub fn pull_up(self) -> &'a mut W {
self.variant(MODEW::PULL_UP)
}
#[doc = "Repeater mode."]
#[inline]
pub fn repeater(self) -> &'a mut W {
self.variant(MODEW::REPEATER)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
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 `HYS`"]
pub enum HYSW {
#[doc = "Disable."]
DISABLED,
#[doc = "Enable."]
ENABLED,
}
impl HYSW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
HYSW::DISABLED => false,
HYSW::ENABLED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _HYSW<'a> {
w: &'a mut W,
}
impl<'a> _HYSW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: HYSW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Disable."]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(HYSW::DISABLED)
}
#[doc = "Enable."]
#[inline]
pub fn enabled(self) -> &'a mut W {
self.variant(HYSW::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 = 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 `INV`"]
pub enum INVW {
#[doc = "Input not inverted (HIGH on pin reads as 1, LOW on pin reads as 0)."]
NOT_INVERTED,
#[doc = "Input inverted (HIGH on pin reads as 0, LOW on pin reads as 1)."]
INVERTED,
}
impl INVW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
INVW::NOT_INVERTED => false,
INVW::INVERTED => true,
}
}
}
#[doc = r" Proxy"]
pub struct _INVW<'a> {
w: &'a mut W,
}
impl<'a> _INVW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: INVW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Input not inverted (HIGH on pin reads as 1, LOW on pin reads as 0)."]
#[inline]
pub fn not_inverted(self) -> &'a mut W {
self.variant(INVW::NOT_INVERTED)
}
#[doc = "Input inverted (HIGH on pin reads as 0, LOW on pin reads as 1)."]
#[inline]
pub fn inverted(self) -> &'a mut W {
self.variant(INVW::INVERTED)
}
#[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 `OD`"]
pub enum ODW {
#[doc = "Disable."]
DISABLED,
#[doc = "Open-drain mode enabled. This is not a true open-drain mode. Input cannot be pulled up above VDD."]
OPEN_DRAIN,
}
impl ODW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
ODW::DISABLED => false,
ODW::OPEN_DRAIN => true,
}
}
}
#[doc = r" Proxy"]
pub struct _ODW<'a> {
w: &'a mut W,
}
impl<'a> _ODW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: ODW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Disable."]
#[inline]
pub fn disabled(self) -> &'a mut W {
self.variant(ODW::DISABLED)
}
#[doc = "Open-drain mode enabled. This is not a true open-drain mode. Input cannot be pulled up above VDD."]
#[inline]
pub fn open_drain(self) -> &'a mut W {
self.variant(ODW::OPEN_DRAIN)
}
#[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
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:2 - Selects pin function. Values 0x1 to 0x7 are reserved."]
#[inline]
pub fn func(&self) -> FUNCR {
FUNCR::_from({
const MASK: u8 = 7;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
#[inline]
pub fn mode(&self) -> MODER {
MODER::_from({
const MASK: u8 = 3;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) as u8
})
}
#[doc = "Bit 5 - Hysteresis."]
#[inline]
pub fn hys(&self) -> HYSR {
HYSR::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 6 - Invert input"]
#[inline]
pub fn inv(&self) -> INVR {
INVR::_from({
const MASK: bool = true;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 10 - Open-drain mode."]
#[inline]
pub fn od(&self) -> ODR {
ODR::_from({
const MASK: bool = true;
const OFFSET: u8 = 10;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 144 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:2 - Selects pin function. Values 0x1 to 0x7 are reserved."]
#[inline]
pub fn func(&mut self) -> _FUNCW {
_FUNCW { w: self }
}
#[doc = "Bits 3:4 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
#[inline]
pub fn mode(&mut self) -> _MODEW {
_MODEW { w: self }
}
#[doc = "Bit 5 - Hysteresis."]
#[inline]
pub fn hys(&mut self) -> _HYSW {
_HYSW { w: self }
}
#[doc = "Bit 6 - Invert input"]
#[inline]
pub fn inv(&mut self) -> _INVW {
_INVW { w: self }
}
#[doc = "Bit 10 - Open-drain mode."]
#[inline]
pub fn od(&mut self) -> _ODW {
_ODW { w: self }
}
}