#[doc = "Register `CR2` reader"]
pub struct R(crate::R<CR2_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR2_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR2_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR2_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CR2` writer"]
pub struct W(crate::W<CR2_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CR2_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CR2_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CR2_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `CCPC` reader - Capture/compare preloaded control"]
pub struct CCPC_R(crate::FieldReader<bool, bool>);
impl CCPC_R {
pub(crate) fn new(bits: bool) -> Self {
CCPC_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CCPC_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CCPC` writer - Capture/compare preloaded control"]
pub struct CCPC_W<'a> {
w: &'a mut W,
}
impl<'a> CCPC_W<'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 = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
#[doc = "Field `CCUS` reader - Capture/compare control update selection"]
pub struct CCUS_R(crate::FieldReader<bool, bool>);
impl CCUS_R {
pub(crate) fn new(bits: bool) -> Self {
CCUS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CCUS_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CCUS` writer - Capture/compare control update selection"]
pub struct CCUS_W<'a> {
w: &'a mut W,
}
impl<'a> CCUS_W<'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 = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Field `CCDS` reader - Capture/compare DMA selection"]
pub struct CCDS_R(crate::FieldReader<bool, bool>);
impl CCDS_R {
pub(crate) fn new(bits: bool) -> Self {
CCDS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for CCDS_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CCDS` writer - Capture/compare DMA selection"]
pub struct CCDS_W<'a> {
w: &'a mut W,
}
impl<'a> CCDS_W<'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 = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
self.w
}
}
#[doc = "Field `MMS` reader - Master mode selection"]
pub struct MMS_R(crate::FieldReader<u8, u8>);
impl MMS_R {
pub(crate) fn new(bits: u8) -> Self {
MMS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for MMS_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MMS` writer - Master mode selection"]
pub struct MMS_W<'a> {
w: &'a mut W,
}
impl<'a> MMS_W<'a> {
#[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 & !(0x07 << 4)) | ((value as u32 & 0x07) << 4);
self.w
}
}
#[doc = "Field `TI1S` reader - TI1 selection"]
pub struct TI1S_R(crate::FieldReader<bool, bool>);
impl TI1S_R {
pub(crate) fn new(bits: bool) -> Self {
TI1S_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for TI1S_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TI1S` writer - TI1 selection"]
pub struct TI1S_W<'a> {
w: &'a mut W,
}
impl<'a> TI1S_W<'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 = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "Field `OIS1` reader - Output Idle state 1"]
pub struct OIS1_R(crate::FieldReader<bool, bool>);
impl OIS1_R {
pub(crate) fn new(bits: bool) -> Self {
OIS1_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OIS1_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OIS1` writer - Output Idle state 1"]
pub struct OIS1_W<'a> {
w: &'a mut W,
}
impl<'a> OIS1_W<'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 = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
self.w
}
}
#[doc = "Field `OIS1N` reader - Output Idle state 1"]
pub struct OIS1N_R(crate::FieldReader<bool, bool>);
impl OIS1N_R {
pub(crate) fn new(bits: bool) -> Self {
OIS1N_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OIS1N_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OIS1N` writer - Output Idle state 1"]
pub struct OIS1N_W<'a> {
w: &'a mut W,
}
impl<'a> OIS1N_W<'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 = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
self.w
}
}
#[doc = "Field `OIS2` reader - Output Idle state 2"]
pub struct OIS2_R(crate::FieldReader<bool, bool>);
impl OIS2_R {
pub(crate) fn new(bits: bool) -> Self {
OIS2_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for OIS2_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `OIS2` writer - Output Idle state 2"]
pub struct OIS2_W<'a> {
w: &'a mut W,
}
impl<'a> OIS2_W<'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 = (self.w.bits & !(0x01 << 10)) | ((value as u32 & 0x01) << 10);
self.w
}
}
impl R {
#[doc = "Bit 0 - Capture/compare preloaded control"]
#[inline(always)]
pub fn ccpc(&self) -> CCPC_R {
CCPC_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 2 - Capture/compare control update selection"]
#[inline(always)]
pub fn ccus(&self) -> CCUS_R {
CCUS_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Capture/compare DMA selection"]
#[inline(always)]
pub fn ccds(&self) -> CCDS_R {
CCDS_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bits 4:6 - Master mode selection"]
#[inline(always)]
pub fn mms(&self) -> MMS_R {
MMS_R::new(((self.bits >> 4) & 0x07) as u8)
}
#[doc = "Bit 7 - TI1 selection"]
#[inline(always)]
pub fn ti1s(&self) -> TI1S_R {
TI1S_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 8 - Output Idle state 1"]
#[inline(always)]
pub fn ois1(&self) -> OIS1_R {
OIS1_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - Output Idle state 1"]
#[inline(always)]
pub fn ois1n(&self) -> OIS1N_R {
OIS1N_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 10 - Output Idle state 2"]
#[inline(always)]
pub fn ois2(&self) -> OIS2_R {
OIS2_R::new(((self.bits >> 10) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Capture/compare preloaded control"]
#[inline(always)]
pub fn ccpc(&mut self) -> CCPC_W {
CCPC_W { w: self }
}
#[doc = "Bit 2 - Capture/compare control update selection"]
#[inline(always)]
pub fn ccus(&mut self) -> CCUS_W {
CCUS_W { w: self }
}
#[doc = "Bit 3 - Capture/compare DMA selection"]
#[inline(always)]
pub fn ccds(&mut self) -> CCDS_W {
CCDS_W { w: self }
}
#[doc = "Bits 4:6 - Master mode selection"]
#[inline(always)]
pub fn mms(&mut self) -> MMS_W {
MMS_W { w: self }
}
#[doc = "Bit 7 - TI1 selection"]
#[inline(always)]
pub fn ti1s(&mut self) -> TI1S_W {
TI1S_W { w: self }
}
#[doc = "Bit 8 - Output Idle state 1"]
#[inline(always)]
pub fn ois1(&mut self) -> OIS1_W {
OIS1_W { w: self }
}
#[doc = "Bit 9 - Output Idle state 1"]
#[inline(always)]
pub fn ois1n(&mut self) -> OIS1N_W {
OIS1N_W { w: self }
}
#[doc = "Bit 10 - Output Idle state 2"]
#[inline(always)]
pub fn ois2(&mut self) -> OIS2_W {
OIS2_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "control register 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr2](index.html) module"]
pub struct CR2_SPEC;
impl crate::RegisterSpec for CR2_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [cr2::R](R) reader structure"]
impl crate::Readable for CR2_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr2::W](W) writer structure"]
impl crate::Writable for CR2_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CR2 to value 0"]
impl crate::Resettable for CR2_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}