stm32f1_staging/stm32f100/tim15/bdtr.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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
///Register `BDTR` reader
pub type R = crate::R<BDTRrs>;
///Register `BDTR` writer
pub type W = crate::W<BDTRrs>;
///Field `DTG` reader - Dead-time generator setup
pub type DTG_R = crate::FieldReader;
///Field `DTG` writer - Dead-time generator setup
pub type DTG_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
///Field `LOCK` reader - Lock configuration
pub type LOCK_R = crate::FieldReader;
///Field `LOCK` writer - Lock configuration
pub type LOCK_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
///Field `OSSI` reader - Off-state selection for Idle mode
pub type OSSI_R = crate::BitReader;
///Field `OSSI` writer - Off-state selection for Idle mode
pub type OSSI_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `OSSR` reader - Off-state selection for Run mode
pub type OSSR_R = crate::BitReader;
///Field `OSSR` writer - Off-state selection for Run mode
pub type OSSR_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `BKE` reader - Break enable
pub type BKE_R = crate::BitReader;
///Field `BKE` writer - Break enable
pub type BKE_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `BKP` reader - Break polarity
pub type BKP_R = crate::BitReader;
///Field `BKP` writer - Break polarity
pub type BKP_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `AOE` reader - Automatic output enable
pub type AOE_R = crate::BitReader;
///Field `AOE` writer - Automatic output enable
pub type AOE_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `MOE` reader - Main output enable
pub type MOE_R = crate::BitReader;
///Field `MOE` writer - Main output enable
pub type MOE_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
///Bits 0:7 - Dead-time generator setup
#[inline(always)]
pub fn dtg(&self) -> DTG_R {
DTG_R::new((self.bits & 0xff) as u8)
}
///Bits 8:9 - Lock configuration
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new(((self.bits >> 8) & 3) as u8)
}
///Bit 10 - Off-state selection for Idle mode
#[inline(always)]
pub fn ossi(&self) -> OSSI_R {
OSSI_R::new(((self.bits >> 10) & 1) != 0)
}
///Bit 11 - Off-state selection for Run mode
#[inline(always)]
pub fn ossr(&self) -> OSSR_R {
OSSR_R::new(((self.bits >> 11) & 1) != 0)
}
///Bit 12 - Break enable
#[inline(always)]
pub fn bke(&self) -> BKE_R {
BKE_R::new(((self.bits >> 12) & 1) != 0)
}
///Bit 13 - Break polarity
#[inline(always)]
pub fn bkp(&self) -> BKP_R {
BKP_R::new(((self.bits >> 13) & 1) != 0)
}
///Bit 14 - Automatic output enable
#[inline(always)]
pub fn aoe(&self) -> AOE_R {
AOE_R::new(((self.bits >> 14) & 1) != 0)
}
///Bit 15 - Main output enable
#[inline(always)]
pub fn moe(&self) -> MOE_R {
MOE_R::new(((self.bits >> 15) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("BDTR")
.field("moe", &self.moe())
.field("aoe", &self.aoe())
.field("bkp", &self.bkp())
.field("bke", &self.bke())
.field("ossr", &self.ossr())
.field("ossi", &self.ossi())
.field("lock", &self.lock())
.field("dtg", &self.dtg())
.finish()
}
}
impl W {
///Bits 0:7 - Dead-time generator setup
#[inline(always)]
#[must_use]
pub fn dtg(&mut self) -> DTG_W<BDTRrs> {
DTG_W::new(self, 0)
}
///Bits 8:9 - Lock configuration
#[inline(always)]
#[must_use]
pub fn lock(&mut self) -> LOCK_W<BDTRrs> {
LOCK_W::new(self, 8)
}
///Bit 10 - Off-state selection for Idle mode
#[inline(always)]
#[must_use]
pub fn ossi(&mut self) -> OSSI_W<BDTRrs> {
OSSI_W::new(self, 10)
}
///Bit 11 - Off-state selection for Run mode
#[inline(always)]
#[must_use]
pub fn ossr(&mut self) -> OSSR_W<BDTRrs> {
OSSR_W::new(self, 11)
}
///Bit 12 - Break enable
#[inline(always)]
#[must_use]
pub fn bke(&mut self) -> BKE_W<BDTRrs> {
BKE_W::new(self, 12)
}
///Bit 13 - Break polarity
#[inline(always)]
#[must_use]
pub fn bkp(&mut self) -> BKP_W<BDTRrs> {
BKP_W::new(self, 13)
}
///Bit 14 - Automatic output enable
#[inline(always)]
#[must_use]
pub fn aoe(&mut self) -> AOE_W<BDTRrs> {
AOE_W::new(self, 14)
}
///Bit 15 - Main output enable
#[inline(always)]
#[must_use]
pub fn moe(&mut self) -> MOE_W<BDTRrs> {
MOE_W::new(self, 15)
}
}
/**break and dead-time register
You can [`read`](crate::Reg::read) this register and get [`bdtr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bdtr::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/STM32F100.html#TIM15:BDTR)*/
pub struct BDTRrs;
impl crate::RegisterSpec for BDTRrs {
type Ux = u32;
}
///`read()` method returns [`bdtr::R`](R) reader structure
impl crate::Readable for BDTRrs {}
///`write(|w| ..)` method takes [`bdtr::W`](W) writer structure
impl crate::Writable for BDTRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
///`reset()` method sets BDTR to value 0
impl crate::Resettable for BDTRrs {
const RESET_VALUE: u32 = 0;
}