pub type R = crate::R<AFRLrs>;
pub type W = crate::W<AFRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ALTERNATE_FUNCTION {
Af0 = 0,
Af1 = 1,
Af2 = 2,
Af3 = 3,
Af4 = 4,
Af5 = 5,
Af6 = 6,
Af7 = 7,
}
impl From<ALTERNATE_FUNCTION> for u8 {
#[inline(always)]
fn from(variant: ALTERNATE_FUNCTION) -> Self {
variant as _
}
}
impl crate::FieldSpec for ALTERNATE_FUNCTION {
type Ux = u8;
}
impl crate::IsEnum for ALTERNATE_FUNCTION {}
pub type AFR_R = crate::FieldReader<ALTERNATE_FUNCTION>;
impl AFR_R {
#[inline(always)]
pub const fn variant(&self) -> Option<ALTERNATE_FUNCTION> {
match self.bits {
0 => Some(ALTERNATE_FUNCTION::Af0),
1 => Some(ALTERNATE_FUNCTION::Af1),
2 => Some(ALTERNATE_FUNCTION::Af2),
3 => Some(ALTERNATE_FUNCTION::Af3),
4 => Some(ALTERNATE_FUNCTION::Af4),
5 => Some(ALTERNATE_FUNCTION::Af5),
6 => Some(ALTERNATE_FUNCTION::Af6),
7 => Some(ALTERNATE_FUNCTION::Af7),
_ => None,
}
}
#[inline(always)]
pub fn is_af0(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af0
}
#[inline(always)]
pub fn is_af1(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af1
}
#[inline(always)]
pub fn is_af2(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af2
}
#[inline(always)]
pub fn is_af3(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af3
}
#[inline(always)]
pub fn is_af4(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af4
}
#[inline(always)]
pub fn is_af5(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af5
}
#[inline(always)]
pub fn is_af6(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af6
}
#[inline(always)]
pub fn is_af7(&self) -> bool {
*self == ALTERNATE_FUNCTION::Af7
}
}
pub type AFR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, ALTERNATE_FUNCTION>;
impl<'a, REG> AFR_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn af0(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af0)
}
#[inline(always)]
pub fn af1(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af1)
}
#[inline(always)]
pub fn af2(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af2)
}
#[inline(always)]
pub fn af3(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af3)
}
#[inline(always)]
pub fn af4(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af4)
}
#[inline(always)]
pub fn af5(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af5)
}
#[inline(always)]
pub fn af6(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af6)
}
#[inline(always)]
pub fn af7(self) -> &'a mut crate::W<REG> {
self.variant(ALTERNATE_FUNCTION::Af7)
}
}
impl R {
#[inline(always)]
pub fn afr(&self, n: u8) -> AFR_R {
#[allow(clippy::no_effect)]
[(); 8][n as usize];
AFR_R::new(((self.bits >> (n * 4)) & 0x0f) as u8)
}
#[inline(always)]
pub fn afr_iter(&self) -> impl Iterator<Item = AFR_R> + '_ {
(0..8).map(move |n| AFR_R::new(((self.bits >> (n * 4)) & 0x0f) as u8))
}
#[inline(always)]
pub fn afrel0(&self) -> AFR_R {
AFR_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel1(&self) -> AFR_R {
AFR_R::new(((self.bits >> 4) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel2(&self) -> AFR_R {
AFR_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel3(&self) -> AFR_R {
AFR_R::new(((self.bits >> 12) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel4(&self) -> AFR_R {
AFR_R::new(((self.bits >> 16) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel5(&self) -> AFR_R {
AFR_R::new(((self.bits >> 20) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel6(&self) -> AFR_R {
AFR_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn afrel7(&self) -> AFR_R {
AFR_R::new(((self.bits >> 28) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AFRL")
.field("afrel0", &self.afrel0())
.field("afrel1", &self.afrel1())
.field("afrel2", &self.afrel2())
.field("afrel3", &self.afrel3())
.field("afrel4", &self.afrel4())
.field("afrel5", &self.afrel5())
.field("afrel6", &self.afrel6())
.field("afrel7", &self.afrel7())
.finish()
}
}
impl W {
#[inline(always)]
pub fn afr(&mut self, n: u8) -> AFR_W<AFRLrs> {
#[allow(clippy::no_effect)]
[(); 8][n as usize];
AFR_W::new(self, n * 4)
}
#[inline(always)]
pub fn afrel0(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 0)
}
#[inline(always)]
pub fn afrel1(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 4)
}
#[inline(always)]
pub fn afrel2(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 8)
}
#[inline(always)]
pub fn afrel3(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 12)
}
#[inline(always)]
pub fn afrel4(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 16)
}
#[inline(always)]
pub fn afrel5(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 20)
}
#[inline(always)]
pub fn afrel6(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 24)
}
#[inline(always)]
pub fn afrel7(&mut self) -> AFR_W<AFRLrs> {
AFR_W::new(self, 28)
}
}
pub struct AFRLrs;
impl crate::RegisterSpec for AFRLrs {
type Ux = u32;
}
impl crate::Readable for AFRLrs {}
impl crate::Writable for AFRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AFRLrs {}