#[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::SMPR1 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = r"Value of the field"]
pub struct SMP9R {
bits: u8,
}
impl SMP9R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP9W<'a> {
w: &'a mut W,
}
impl<'a> _SMP9W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 27);
self.w.bits |= ((value as u32) & 0x07) << 27;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP8R {
bits: u8,
}
impl SMP8R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP8W<'a> {
w: &'a mut W,
}
impl<'a> _SMP8W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 24);
self.w.bits |= ((value as u32) & 0x07) << 24;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP7R {
bits: u8,
}
impl SMP7R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP7W<'a> {
w: &'a mut W,
}
impl<'a> _SMP7W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 21);
self.w.bits |= ((value as u32) & 0x07) << 21;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP6R {
bits: u8,
}
impl SMP6R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP6W<'a> {
w: &'a mut W,
}
impl<'a> _SMP6W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 18);
self.w.bits |= ((value as u32) & 0x07) << 18;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP5R {
bits: u8,
}
impl SMP5R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP5W<'a> {
w: &'a mut W,
}
impl<'a> _SMP5W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 15);
self.w.bits |= ((value as u32) & 0x07) << 15;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP4R {
bits: u8,
}
impl SMP4R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP4W<'a> {
w: &'a mut W,
}
impl<'a> _SMP4W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 12);
self.w.bits |= ((value as u32) & 0x07) << 12;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP3R {
bits: u8,
}
impl SMP3R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP3W<'a> {
w: &'a mut W,
}
impl<'a> _SMP3W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 9);
self.w.bits |= ((value as u32) & 0x07) << 9;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP2R {
bits: u8,
}
impl SMP2R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP2W<'a> {
w: &'a mut W,
}
impl<'a> _SMP2W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 6);
self.w.bits |= ((value as u32) & 0x07) << 6;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP1R {
bits: u8,
}
impl SMP1R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP1W<'a> {
w: &'a mut W,
}
impl<'a> _SMP1W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 3);
self.w.bits |= ((value as u32) & 0x07) << 3;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMPPLUSR {
bits: bool,
}
impl SMPPLUSR {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r"Proxy"]
pub struct _SMPPLUSW<'a> {
w: &'a mut W,
}
impl<'a> _SMPPLUSW<'a> {
#[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 &= !(0x01 << 31);
self.w.bits |= ((value as u32) & 0x01) << 31;
self.w
}
}
#[doc = r"Value of the field"]
pub struct SMP0R {
bits: u8,
}
impl SMP0R {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r"Proxy"]
pub struct _SMP0W<'a> {
w: &'a mut W,
}
impl<'a> _SMP0W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits &= !(0x07 << 0);
self.w.bits |= ((value as u32) & 0x07) << 0;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 27:29 - SMP9"]
#[inline(always)]
pub fn smp9(&self) -> SMP9R {
let bits = ((self.bits >> 27) & 0x07) as u8;
SMP9R { bits }
}
#[doc = "Bits 24:26 - SMP8"]
#[inline(always)]
pub fn smp8(&self) -> SMP8R {
let bits = ((self.bits >> 24) & 0x07) as u8;
SMP8R { bits }
}
#[doc = "Bits 21:23 - SMP7"]
#[inline(always)]
pub fn smp7(&self) -> SMP7R {
let bits = ((self.bits >> 21) & 0x07) as u8;
SMP7R { bits }
}
#[doc = "Bits 18:20 - SMP6"]
#[inline(always)]
pub fn smp6(&self) -> SMP6R {
let bits = ((self.bits >> 18) & 0x07) as u8;
SMP6R { bits }
}
#[doc = "Bits 15:17 - SMP5"]
#[inline(always)]
pub fn smp5(&self) -> SMP5R {
let bits = ((self.bits >> 15) & 0x07) as u8;
SMP5R { bits }
}
#[doc = "Bits 12:14 - SMP4"]
#[inline(always)]
pub fn smp4(&self) -> SMP4R {
let bits = ((self.bits >> 12) & 0x07) as u8;
SMP4R { bits }
}
#[doc = "Bits 9:11 - SMP3"]
#[inline(always)]
pub fn smp3(&self) -> SMP3R {
let bits = ((self.bits >> 9) & 0x07) as u8;
SMP3R { bits }
}
#[doc = "Bits 6:8 - SMP2"]
#[inline(always)]
pub fn smp2(&self) -> SMP2R {
let bits = ((self.bits >> 6) & 0x07) as u8;
SMP2R { bits }
}
#[doc = "Bits 3:5 - SMP1"]
#[inline(always)]
pub fn smp1(&self) -> SMP1R {
let bits = ((self.bits >> 3) & 0x07) as u8;
SMP1R { bits }
}
#[doc = "Bit 31 - Addition of one clock cycle to the sampling time"]
#[inline(always)]
pub fn smpplus(&self) -> SMPPLUSR {
let bits = ((self.bits >> 31) & 0x01) != 0;
SMPPLUSR { bits }
}
#[doc = "Bits 0:2 - SMP0"]
#[inline(always)]
pub fn smp0(&self) -> SMP0R {
let bits = ((self.bits >> 0) & 0x07) as u8;
SMP0R { bits }
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 27:29 - SMP9"]
#[inline(always)]
pub fn smp9(&mut self) -> _SMP9W {
_SMP9W { w: self }
}
#[doc = "Bits 24:26 - SMP8"]
#[inline(always)]
pub fn smp8(&mut self) -> _SMP8W {
_SMP8W { w: self }
}
#[doc = "Bits 21:23 - SMP7"]
#[inline(always)]
pub fn smp7(&mut self) -> _SMP7W {
_SMP7W { w: self }
}
#[doc = "Bits 18:20 - SMP6"]
#[inline(always)]
pub fn smp6(&mut self) -> _SMP6W {
_SMP6W { w: self }
}
#[doc = "Bits 15:17 - SMP5"]
#[inline(always)]
pub fn smp5(&mut self) -> _SMP5W {
_SMP5W { w: self }
}
#[doc = "Bits 12:14 - SMP4"]
#[inline(always)]
pub fn smp4(&mut self) -> _SMP4W {
_SMP4W { w: self }
}
#[doc = "Bits 9:11 - SMP3"]
#[inline(always)]
pub fn smp3(&mut self) -> _SMP3W {
_SMP3W { w: self }
}
#[doc = "Bits 6:8 - SMP2"]
#[inline(always)]
pub fn smp2(&mut self) -> _SMP2W {
_SMP2W { w: self }
}
#[doc = "Bits 3:5 - SMP1"]
#[inline(always)]
pub fn smp1(&mut self) -> _SMP1W {
_SMP1W { w: self }
}
#[doc = "Bit 31 - Addition of one clock cycle to the sampling time"]
#[inline(always)]
pub fn smpplus(&mut self) -> _SMPPLUSW {
_SMPPLUSW { w: self }
}
#[doc = "Bits 0:2 - SMP0"]
#[inline(always)]
pub fn smp0(&mut self) -> _SMP0W {
_SMP0W { w: self }
}
}