stm32f1_staging/stm32f101/stk/ctrl.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
///Register `CTRL` reader
pub type R = crate::R<CTRLrs>;
///Register `CTRL` writer
pub type W = crate::W<CTRLrs>;
///Field `ENABLE` reader - Counter enable
pub type ENABLE_R = crate::BitReader;
///Field `ENABLE` writer - Counter enable
pub type ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `TICKINT` reader - SysTick exception request enable
pub type TICKINT_R = crate::BitReader;
///Field `TICKINT` writer - SysTick exception request enable
pub type TICKINT_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `CLKSOURCE` reader - Clock source selection
pub type CLKSOURCE_R = crate::BitReader;
///Field `CLKSOURCE` writer - Clock source selection
pub type CLKSOURCE_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `COUNTFLAG` reader - COUNTFLAG
pub type COUNTFLAG_R = crate::BitReader;
///Field `COUNTFLAG` writer - COUNTFLAG
pub type COUNTFLAG_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
///Bit 0 - Counter enable
#[inline(always)]
pub fn enable(&self) -> ENABLE_R {
ENABLE_R::new((self.bits & 1) != 0)
}
///Bit 1 - SysTick exception request enable
#[inline(always)]
pub fn tickint(&self) -> TICKINT_R {
TICKINT_R::new(((self.bits >> 1) & 1) != 0)
}
///Bit 2 - Clock source selection
#[inline(always)]
pub fn clksource(&self) -> CLKSOURCE_R {
CLKSOURCE_R::new(((self.bits >> 2) & 1) != 0)
}
///Bit 16 - COUNTFLAG
#[inline(always)]
pub fn countflag(&self) -> COUNTFLAG_R {
COUNTFLAG_R::new(((self.bits >> 16) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("enable", &self.enable())
.field("tickint", &self.tickint())
.field("clksource", &self.clksource())
.field("countflag", &self.countflag())
.finish()
}
}
impl W {
///Bit 0 - Counter enable
#[inline(always)]
#[must_use]
pub fn enable(&mut self) -> ENABLE_W<CTRLrs> {
ENABLE_W::new(self, 0)
}
///Bit 1 - SysTick exception request enable
#[inline(always)]
#[must_use]
pub fn tickint(&mut self) -> TICKINT_W<CTRLrs> {
TICKINT_W::new(self, 1)
}
///Bit 2 - Clock source selection
#[inline(always)]
#[must_use]
pub fn clksource(&mut self) -> CLKSOURCE_W<CTRLrs> {
CLKSOURCE_W::new(self, 2)
}
///Bit 16 - COUNTFLAG
#[inline(always)]
#[must_use]
pub fn countflag(&mut self) -> COUNTFLAG_W<CTRLrs> {
COUNTFLAG_W::new(self, 16)
}
}
/**SysTick control and status register
You can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F101.html#STK:CTRL)*/
pub struct CTRLrs;
impl crate::RegisterSpec for CTRLrs {
type Ux = u32;
}
///`read()` method returns [`ctrl::R`](R) reader structure
impl crate::Readable for CTRLrs {}
///`write(|w| ..)` method takes [`ctrl::W`](W) writer structure
impl crate::Writable for CTRLrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
///`reset()` method sets CTRL to value 0
impl crate::Resettable for CTRLrs {
const RESET_VALUE: u32 = 0;
}