s32k118.rs/src/pcc/pcc_cmp0.rs

143 lines
3.8 KiB
Rust

#[doc = "Reader of register PCC_CMP0"]
pub type R = crate::R<u32, super::PCC_CMP0>;
#[doc = "Writer for register PCC_CMP0"]
pub type W = crate::W<u32, super::PCC_CMP0>;
#[doc = "Register PCC_CMP0 `reset()`'s with value 0x8000_0000"]
impl crate::ResetValue for super::PCC_CMP0 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x8000_0000
}
}
#[doc = "Clock Gate Control\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CGC_A {
#[doc = "0: Clock disabled"]
_0 = 0,
#[doc = "1: Clock enabled. The current clock selection and divider options are locked."]
_1 = 1,
}
impl From<CGC_A> for bool {
#[inline(always)]
fn from(variant: CGC_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `CGC`"]
pub type CGC_R = crate::R<bool, CGC_A>;
impl CGC_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CGC_A {
match self.bits {
false => CGC_A::_0,
true => CGC_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == CGC_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == CGC_A::_1
}
}
#[doc = "Write proxy for field `CGC`"]
pub struct CGC_W<'a> {
w: &'a mut W,
}
impl<'a> CGC_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CGC_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Clock disabled"]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(CGC_A::_0)
}
#[doc = "Clock enabled. The current clock selection and divider options are locked."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(CGC_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
self.w
}
}
#[doc = "Present\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PR_A {
#[doc = "0: Peripheral is not present."]
_0 = 0,
#[doc = "1: Peripheral is present."]
_1 = 1,
}
impl From<PR_A> for bool {
#[inline(always)]
fn from(variant: PR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `PR`"]
pub type PR_R = crate::R<bool, PR_A>;
impl PR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PR_A {
match self.bits {
false => PR_A::_0,
true => PR_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == PR_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == PR_A::_1
}
}
impl R {
#[doc = "Bit 30 - Clock Gate Control"]
#[inline(always)]
pub fn cgc(&self) -> CGC_R {
CGC_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 31 - Present"]
#[inline(always)]
pub fn pr(&self) -> PR_R {
PR_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 30 - Clock Gate Control"]
#[inline(always)]
pub fn cgc(&mut self) -> CGC_W {
CGC_W { w: self }
}
}