#[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::PLLSAI1CFGR {
#[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 = r" Value of the field"]
pub struct PLLSAI1RR {
bits: u8,
}
impl PLLSAI1RR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct PLLSAI1RENR {
bits: bool,
}
impl PLLSAI1RENR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[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"]
pub struct PLLSAI1QR {
bits: u8,
}
impl PLLSAI1QR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct PLLSAI1QENR {
bits: bool,
}
impl PLLSAI1QENR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[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"]
pub struct PLLSAI1PR {
bits: bool,
}
impl PLLSAI1PR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[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"]
pub struct PLLSAI1PENR {
bits: bool,
}
impl PLLSAI1PENR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[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"]
pub struct PLLSAI1NR {
bits: u8,
}
impl PLLSAI1NR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct PLLSAI1PDIVR {
bits: u8,
}
impl PLLSAI1PDIVR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1RW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1RW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 25;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1RENW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1RENW<'a> {
#[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 = 24;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1QW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1QW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 3;
const OFFSET: u8 = 21;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1QENW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1QENW<'a> {
#[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 = 20;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1PW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1PW<'a> {
#[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 = 17;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1PENW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1PENW<'a> {
#[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 = 16;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1NW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1NW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 127;
const OFFSET: u8 = 8;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = r" Proxy"]
pub struct _PLLSAI1PDIVW<'a> {
w: &'a mut W,
}
impl<'a> _PLLSAI1PDIVW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
const MASK: u8 = 31;
const OFFSET: u8 = 27;
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 25:26 - PLLSAI1 division factor for PLLADC1CLK (ADC clock)"]
#[inline]
pub fn pllsai1r(&self) -> PLLSAI1RR {
let bits = {
const MASK: u8 = 3;
const OFFSET: u8 = 25;
((self.bits >> OFFSET) & MASK as u32) as u8
};
PLLSAI1RR { bits }
}
#[doc = "Bit 24 - PLLSAI1 PLLADC1CLK output enable"]
#[inline]
pub fn pllsai1ren(&self) -> PLLSAI1RENR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 24;
((self.bits >> OFFSET) & MASK as u32) != 0
};
PLLSAI1RENR { bits }
}
#[doc = "Bits 21:22 - SAI1PLL division factor for PLLUSB2CLK (48 MHz clock)"]
#[inline]
pub fn pllsai1q(&self) -> PLLSAI1QR {
let bits = {
const MASK: u8 = 3;
const OFFSET: u8 = 21;
((self.bits >> OFFSET) & MASK as u32) as u8
};
PLLSAI1QR { bits }
}
#[doc = "Bit 20 - SAI1PLL PLLUSB2CLK output enable"]
#[inline]
pub fn pllsai1qen(&self) -> PLLSAI1QENR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) != 0
};
PLLSAI1QENR { bits }
}
#[doc = "Bit 17 - SAI1PLL division factor for PLLSAI1CLK (SAI1 or SAI2 clock)"]
#[inline]
pub fn pllsai1p(&self) -> PLLSAI1PR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 17;
((self.bits >> OFFSET) & MASK as u32) != 0
};
PLLSAI1PR { bits }
}
#[doc = "Bit 16 - SAI1PLL PLLSAI1CLK output enable"]
#[inline]
pub fn pllsai1pen(&self) -> PLLSAI1PENR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) != 0
};
PLLSAI1PENR { bits }
}
#[doc = "Bits 8:14 - SAI1PLL multiplication factor for VCO"]
#[inline]
pub fn pllsai1n(&self) -> PLLSAI1NR {
let bits = {
const MASK: u8 = 127;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) as u8
};
PLLSAI1NR { bits }
}
#[doc = "Bits 27:31 - PLLSAI1 division factor for PLLSAI1CLK"]
#[inline]
pub fn pllsai1pdiv(&self) -> PLLSAI1PDIVR {
let bits = {
const MASK: u8 = 31;
const OFFSET: u8 = 27;
((self.bits >> OFFSET) & MASK as u32) as u8
};
PLLSAI1PDIVR { bits }
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 4096 }
}
#[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 25:26 - PLLSAI1 division factor for PLLADC1CLK (ADC clock)"]
#[inline]
pub fn pllsai1r(&mut self) -> _PLLSAI1RW {
_PLLSAI1RW { w: self }
}
#[doc = "Bit 24 - PLLSAI1 PLLADC1CLK output enable"]
#[inline]
pub fn pllsai1ren(&mut self) -> _PLLSAI1RENW {
_PLLSAI1RENW { w: self }
}
#[doc = "Bits 21:22 - SAI1PLL division factor for PLLUSB2CLK (48 MHz clock)"]
#[inline]
pub fn pllsai1q(&mut self) -> _PLLSAI1QW {
_PLLSAI1QW { w: self }
}
#[doc = "Bit 20 - SAI1PLL PLLUSB2CLK output enable"]
#[inline]
pub fn pllsai1qen(&mut self) -> _PLLSAI1QENW {
_PLLSAI1QENW { w: self }
}
#[doc = "Bit 17 - SAI1PLL division factor for PLLSAI1CLK (SAI1 or SAI2 clock)"]
#[inline]
pub fn pllsai1p(&mut self) -> _PLLSAI1PW {
_PLLSAI1PW { w: self }
}
#[doc = "Bit 16 - SAI1PLL PLLSAI1CLK output enable"]
#[inline]
pub fn pllsai1pen(&mut self) -> _PLLSAI1PENW {
_PLLSAI1PENW { w: self }
}
#[doc = "Bits 8:14 - SAI1PLL multiplication factor for VCO"]
#[inline]
pub fn pllsai1n(&mut self) -> _PLLSAI1NW {
_PLLSAI1NW { w: self }
}
#[doc = "Bits 27:31 - PLLSAI1 division factor for PLLSAI1CLK"]
#[inline]
pub fn pllsai1pdiv(&mut self) -> _PLLSAI1PDIVW {
_PLLSAI1PDIVW { w: self }
}
}