#[doc = "Reader of register CONFIG"]
pub type R = crate::R<u8, super::CONFIG>;
#[doc = "Writer for register CONFIG"]
pub type W = crate::W<u8, super::CONFIG>;
#[doc = "Register CONFIG `reset()`'s with value 0xbb"]
impl crate::ResetValue for super::CONFIG {
type Type = u8;
#[inline(always)]
fn reset_value() -> Self::Type {
0xbb
}
}
#[doc = "Possible values of the field `PER`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PER_A {
#[doc = "8 clock cycles"]
CYC8,
#[doc = "16 clock cycles"]
CYC16,
#[doc = "32 clock cycles"]
CYC32,
#[doc = "64 clock cycles"]
CYC64,
#[doc = "128 clock cycles"]
CYC128,
#[doc = "256 clock cycles"]
CYC256,
#[doc = "512 clock cycles"]
CYC512,
#[doc = "1024 clock cycles"]
CYC1024,
#[doc = "2048 clock cycles"]
CYC2048,
#[doc = "4096 clock cycles"]
CYC4096,
#[doc = "8192 clock cycles"]
CYC8192,
#[doc = "16384 clock cycles"]
CYC16384,
}
impl crate::ToBits<u8> for PER_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PER_A::CYC8 => 0,
PER_A::CYC16 => 1,
PER_A::CYC32 => 2,
PER_A::CYC64 => 3,
PER_A::CYC128 => 4,
PER_A::CYC256 => 5,
PER_A::CYC512 => 6,
PER_A::CYC1024 => 7,
PER_A::CYC2048 => 8,
PER_A::CYC4096 => 9,
PER_A::CYC8192 => 10,
PER_A::CYC16384 => 11,
}
}
}
#[doc = "Reader of field `PER`"]
pub type PER_R = crate::R<u8, PER_A>;
impl PER_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, PER_A> {
use crate::Variant::*;
match self.bits {
0 => Val(PER_A::CYC8),
1 => Val(PER_A::CYC16),
2 => Val(PER_A::CYC32),
3 => Val(PER_A::CYC64),
4 => Val(PER_A::CYC128),
5 => Val(PER_A::CYC256),
6 => Val(PER_A::CYC512),
7 => Val(PER_A::CYC1024),
8 => Val(PER_A::CYC2048),
9 => Val(PER_A::CYC4096),
10 => Val(PER_A::CYC8192),
11 => Val(PER_A::CYC16384),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `CYC8`"]
#[inline(always)]
pub fn is_cyc8(&self) -> bool {
*self == PER_A::CYC8
}
#[doc = "Checks if the value of the field is `CYC16`"]
#[inline(always)]
pub fn is_cyc16(&self) -> bool {
*self == PER_A::CYC16
}
#[doc = "Checks if the value of the field is `CYC32`"]
#[inline(always)]
pub fn is_cyc32(&self) -> bool {
*self == PER_A::CYC32
}
#[doc = "Checks if the value of the field is `CYC64`"]
#[inline(always)]
pub fn is_cyc64(&self) -> bool {
*self == PER_A::CYC64
}
#[doc = "Checks if the value of the field is `CYC128`"]
#[inline(always)]
pub fn is_cyc128(&self) -> bool {
*self == PER_A::CYC128
}
#[doc = "Checks if the value of the field is `CYC256`"]
#[inline(always)]
pub fn is_cyc256(&self) -> bool {
*self == PER_A::CYC256
}
#[doc = "Checks if the value of the field is `CYC512`"]
#[inline(always)]
pub fn is_cyc512(&self) -> bool {
*self == PER_A::CYC512
}
#[doc = "Checks if the value of the field is `CYC1024`"]
#[inline(always)]
pub fn is_cyc1024(&self) -> bool {
*self == PER_A::CYC1024
}
#[doc = "Checks if the value of the field is `CYC2048`"]
#[inline(always)]
pub fn is_cyc2048(&self) -> bool {
*self == PER_A::CYC2048
}
#[doc = "Checks if the value of the field is `CYC4096`"]
#[inline(always)]
pub fn is_cyc4096(&self) -> bool {
*self == PER_A::CYC4096
}
#[doc = "Checks if the value of the field is `CYC8192`"]
#[inline(always)]
pub fn is_cyc8192(&self) -> bool {
*self == PER_A::CYC8192
}
#[doc = "Checks if the value of the field is `CYC16384`"]
#[inline(always)]
pub fn is_cyc16384(&self) -> bool {
*self == PER_A::CYC16384
}
}
#[doc = "Write proxy for field `PER`"]
pub struct PER_W<'a> {
w: &'a mut W,
}
impl<'a> PER_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PER_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "8 clock cycles"]
#[inline(always)]
pub fn cyc8(self) -> &'a mut W {
self.variant(PER_A::CYC8)
}
#[doc = "16 clock cycles"]
#[inline(always)]
pub fn cyc16(self) -> &'a mut W {
self.variant(PER_A::CYC16)
}
#[doc = "32 clock cycles"]
#[inline(always)]
pub fn cyc32(self) -> &'a mut W {
self.variant(PER_A::CYC32)
}
#[doc = "64 clock cycles"]
#[inline(always)]
pub fn cyc64(self) -> &'a mut W {
self.variant(PER_A::CYC64)
}
#[doc = "128 clock cycles"]
#[inline(always)]
pub fn cyc128(self) -> &'a mut W {
self.variant(PER_A::CYC128)
}
#[doc = "256 clock cycles"]
#[inline(always)]
pub fn cyc256(self) -> &'a mut W {
self.variant(PER_A::CYC256)
}
#[doc = "512 clock cycles"]
#[inline(always)]
pub fn cyc512(self) -> &'a mut W {
self.variant(PER_A::CYC512)
}
#[doc = "1024 clock cycles"]
#[inline(always)]
pub fn cyc1024(self) -> &'a mut W {
self.variant(PER_A::CYC1024)
}
#[doc = "2048 clock cycles"]
#[inline(always)]
pub fn cyc2048(self) -> &'a mut W {
self.variant(PER_A::CYC2048)
}
#[doc = "4096 clock cycles"]
#[inline(always)]
pub fn cyc4096(self) -> &'a mut W {
self.variant(PER_A::CYC4096)
}
#[doc = "8192 clock cycles"]
#[inline(always)]
pub fn cyc8192(self) -> &'a mut W {
self.variant(PER_A::CYC8192)
}
#[doc = "16384 clock cycles"]
#[inline(always)]
pub fn cyc16384(self) -> &'a mut W {
self.variant(PER_A::CYC16384)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u8) & 0x0f);
self.w
}
}
#[doc = "Possible values of the field `WINDOW`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WINDOW_A {
#[doc = "8 clock cycles"]
CYC8,
#[doc = "16 clock cycles"]
CYC16,
#[doc = "32 clock cycles"]
CYC32,
#[doc = "64 clock cycles"]
CYC64,
#[doc = "128 clock cycles"]
CYC128,
#[doc = "256 clock cycles"]
CYC256,
#[doc = "512 clock cycles"]
CYC512,
#[doc = "1024 clock cycles"]
CYC1024,
#[doc = "2048 clock cycles"]
CYC2048,
#[doc = "4096 clock cycles"]
CYC4096,
#[doc = "8192 clock cycles"]
CYC8192,
#[doc = "16384 clock cycles"]
CYC16384,
}
impl crate::ToBits<u8> for WINDOW_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
WINDOW_A::CYC8 => 0,
WINDOW_A::CYC16 => 1,
WINDOW_A::CYC32 => 2,
WINDOW_A::CYC64 => 3,
WINDOW_A::CYC128 => 4,
WINDOW_A::CYC256 => 5,
WINDOW_A::CYC512 => 6,
WINDOW_A::CYC1024 => 7,
WINDOW_A::CYC2048 => 8,
WINDOW_A::CYC4096 => 9,
WINDOW_A::CYC8192 => 10,
WINDOW_A::CYC16384 => 11,
}
}
}
#[doc = "Reader of field `WINDOW`"]
pub type WINDOW_R = crate::R<u8, WINDOW_A>;
impl WINDOW_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, WINDOW_A> {
use crate::Variant::*;
match self.bits {
0 => Val(WINDOW_A::CYC8),
1 => Val(WINDOW_A::CYC16),
2 => Val(WINDOW_A::CYC32),
3 => Val(WINDOW_A::CYC64),
4 => Val(WINDOW_A::CYC128),
5 => Val(WINDOW_A::CYC256),
6 => Val(WINDOW_A::CYC512),
7 => Val(WINDOW_A::CYC1024),
8 => Val(WINDOW_A::CYC2048),
9 => Val(WINDOW_A::CYC4096),
10 => Val(WINDOW_A::CYC8192),
11 => Val(WINDOW_A::CYC16384),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `CYC8`"]
#[inline(always)]
pub fn is_cyc8(&self) -> bool {
*self == WINDOW_A::CYC8
}
#[doc = "Checks if the value of the field is `CYC16`"]
#[inline(always)]
pub fn is_cyc16(&self) -> bool {
*self == WINDOW_A::CYC16
}
#[doc = "Checks if the value of the field is `CYC32`"]
#[inline(always)]
pub fn is_cyc32(&self) -> bool {
*self == WINDOW_A::CYC32
}
#[doc = "Checks if the value of the field is `CYC64`"]
#[inline(always)]
pub fn is_cyc64(&self) -> bool {
*self == WINDOW_A::CYC64
}
#[doc = "Checks if the value of the field is `CYC128`"]
#[inline(always)]
pub fn is_cyc128(&self) -> bool {
*self == WINDOW_A::CYC128
}
#[doc = "Checks if the value of the field is `CYC256`"]
#[inline(always)]
pub fn is_cyc256(&self) -> bool {
*self == WINDOW_A::CYC256
}
#[doc = "Checks if the value of the field is `CYC512`"]
#[inline(always)]
pub fn is_cyc512(&self) -> bool {
*self == WINDOW_A::CYC512
}
#[doc = "Checks if the value of the field is `CYC1024`"]
#[inline(always)]
pub fn is_cyc1024(&self) -> bool {
*self == WINDOW_A::CYC1024
}
#[doc = "Checks if the value of the field is `CYC2048`"]
#[inline(always)]
pub fn is_cyc2048(&self) -> bool {
*self == WINDOW_A::CYC2048
}
#[doc = "Checks if the value of the field is `CYC4096`"]
#[inline(always)]
pub fn is_cyc4096(&self) -> bool {
*self == WINDOW_A::CYC4096
}
#[doc = "Checks if the value of the field is `CYC8192`"]
#[inline(always)]
pub fn is_cyc8192(&self) -> bool {
*self == WINDOW_A::CYC8192
}
#[doc = "Checks if the value of the field is `CYC16384`"]
#[inline(always)]
pub fn is_cyc16384(&self) -> bool {
*self == WINDOW_A::CYC16384
}
}
#[doc = "Write proxy for field `WINDOW`"]
pub struct WINDOW_W<'a> {
w: &'a mut W,
}
impl<'a> WINDOW_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: WINDOW_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "8 clock cycles"]
#[inline(always)]
pub fn cyc8(self) -> &'a mut W {
self.variant(WINDOW_A::CYC8)
}
#[doc = "16 clock cycles"]
#[inline(always)]
pub fn cyc16(self) -> &'a mut W {
self.variant(WINDOW_A::CYC16)
}
#[doc = "32 clock cycles"]
#[inline(always)]
pub fn cyc32(self) -> &'a mut W {
self.variant(WINDOW_A::CYC32)
}
#[doc = "64 clock cycles"]
#[inline(always)]
pub fn cyc64(self) -> &'a mut W {
self.variant(WINDOW_A::CYC64)
}
#[doc = "128 clock cycles"]
#[inline(always)]
pub fn cyc128(self) -> &'a mut W {
self.variant(WINDOW_A::CYC128)
}
#[doc = "256 clock cycles"]
#[inline(always)]
pub fn cyc256(self) -> &'a mut W {
self.variant(WINDOW_A::CYC256)
}
#[doc = "512 clock cycles"]
#[inline(always)]
pub fn cyc512(self) -> &'a mut W {
self.variant(WINDOW_A::CYC512)
}
#[doc = "1024 clock cycles"]
#[inline(always)]
pub fn cyc1024(self) -> &'a mut W {
self.variant(WINDOW_A::CYC1024)
}
#[doc = "2048 clock cycles"]
#[inline(always)]
pub fn cyc2048(self) -> &'a mut W {
self.variant(WINDOW_A::CYC2048)
}
#[doc = "4096 clock cycles"]
#[inline(always)]
pub fn cyc4096(self) -> &'a mut W {
self.variant(WINDOW_A::CYC4096)
}
#[doc = "8192 clock cycles"]
#[inline(always)]
pub fn cyc8192(self) -> &'a mut W {
self.variant(WINDOW_A::CYC8192)
}
#[doc = "16384 clock cycles"]
#[inline(always)]
pub fn cyc16384(self) -> &'a mut W {
self.variant(WINDOW_A::CYC16384)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u8) & 0x0f) << 4);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Time-Out Period"]
#[inline(always)]
pub fn per(&self) -> PER_R {
PER_R::new((self.bits & 0x0f) as u8)
}
#[doc = "Bits 4:7 - Window Mode Time-Out Period"]
#[inline(always)]
pub fn window(&self) -> WINDOW_R {
WINDOW_R::new(((self.bits >> 4) & 0x0f) as u8)
}
}
impl W {
#[doc = "Bits 0:3 - Time-Out Period"]
#[inline(always)]
pub fn per(&mut self) -> PER_W {
PER_W { w: self }
}
#[doc = "Bits 4:7 - Window Mode Time-Out Period"]
#[inline(always)]
pub fn window(&mut self) -> WINDOW_W {
WINDOW_W { w: self }
}
}