pub type R = crate::R<ICSCRrs>;
pub type W = crate::W<ICSCRrs>;
pub type HSI16CAL_R = crate::FieldReader;
pub type HSI16TRIM_R = crate::FieldReader;
pub type HSI16TRIM_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MSIRANGE {
Range0 = 0,
Range1 = 1,
Range2 = 2,
Range3 = 3,
Range4 = 4,
Range5 = 5,
Range6 = 6,
Range7 = 7,
}
impl From<MSIRANGE> for u8 {
#[inline(always)]
fn from(variant: MSIRANGE) -> Self {
variant as _
}
}
impl crate::FieldSpec for MSIRANGE {
type Ux = u8;
}
impl crate::IsEnum for MSIRANGE {}
pub type MSIRANGE_R = crate::FieldReader<MSIRANGE>;
impl MSIRANGE_R {
#[inline(always)]
pub const fn variant(&self) -> MSIRANGE {
match self.bits {
0 => MSIRANGE::Range0,
1 => MSIRANGE::Range1,
2 => MSIRANGE::Range2,
3 => MSIRANGE::Range3,
4 => MSIRANGE::Range4,
5 => MSIRANGE::Range5,
6 => MSIRANGE::Range6,
7 => MSIRANGE::Range7,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_range0(&self) -> bool {
*self == MSIRANGE::Range0
}
#[inline(always)]
pub fn is_range1(&self) -> bool {
*self == MSIRANGE::Range1
}
#[inline(always)]
pub fn is_range2(&self) -> bool {
*self == MSIRANGE::Range2
}
#[inline(always)]
pub fn is_range3(&self) -> bool {
*self == MSIRANGE::Range3
}
#[inline(always)]
pub fn is_range4(&self) -> bool {
*self == MSIRANGE::Range4
}
#[inline(always)]
pub fn is_range5(&self) -> bool {
*self == MSIRANGE::Range5
}
#[inline(always)]
pub fn is_range6(&self) -> bool {
*self == MSIRANGE::Range6
}
#[inline(always)]
pub fn is_range7(&self) -> bool {
*self == MSIRANGE::Range7
}
}
pub type MSIRANGE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MSIRANGE, crate::Safe>;
impl<'a, REG> MSIRANGE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn range0(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range0)
}
#[inline(always)]
pub fn range1(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range1)
}
#[inline(always)]
pub fn range2(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range2)
}
#[inline(always)]
pub fn range3(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range3)
}
#[inline(always)]
pub fn range4(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range4)
}
#[inline(always)]
pub fn range5(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range5)
}
#[inline(always)]
pub fn range6(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range6)
}
#[inline(always)]
pub fn range7(self) -> &'a mut crate::W<REG> {
self.variant(MSIRANGE::Range7)
}
}
pub type MSICAL_R = crate::FieldReader;
pub type MSITRIM_R = crate::FieldReader;
pub type MSITRIM_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
impl R {
#[inline(always)]
pub fn hsi16cal(&self) -> HSI16CAL_R {
HSI16CAL_R::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn hsi16trim(&self) -> HSI16TRIM_R {
HSI16TRIM_R::new(((self.bits >> 8) & 0x1f) as u8)
}
#[inline(always)]
pub fn msirange(&self) -> MSIRANGE_R {
MSIRANGE_R::new(((self.bits >> 13) & 7) as u8)
}
#[inline(always)]
pub fn msical(&self) -> MSICAL_R {
MSICAL_R::new(((self.bits >> 16) & 0xff) as u8)
}
#[inline(always)]
pub fn msitrim(&self) -> MSITRIM_R {
MSITRIM_R::new(((self.bits >> 24) & 0xff) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ICSCR")
.field("msitrim", &self.msitrim())
.field("msical", &self.msical())
.field("msirange", &self.msirange())
.field("hsi16trim", &self.hsi16trim())
.field("hsi16cal", &self.hsi16cal())
.finish()
}
}
impl W {
#[inline(always)]
pub fn hsi16trim(&mut self) -> HSI16TRIM_W<ICSCRrs> {
HSI16TRIM_W::new(self, 8)
}
#[inline(always)]
pub fn msirange(&mut self) -> MSIRANGE_W<ICSCRrs> {
MSIRANGE_W::new(self, 13)
}
#[inline(always)]
pub fn msitrim(&mut self) -> MSITRIM_W<ICSCRrs> {
MSITRIM_W::new(self, 24)
}
}
pub struct ICSCRrs;
impl crate::RegisterSpec for ICSCRrs {
type Ux = u32;
}
impl crate::Readable for ICSCRrs {}
impl crate::Writable for ICSCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for ICSCRrs {
const RESET_VALUE: u32 = 0xb000;
}