#[doc = "Register `OTG_GUSBCFG` reader"]
pub struct R(crate::R<OTG_GUSBCFG_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<OTG_GUSBCFG_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<OTG_GUSBCFG_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<OTG_GUSBCFG_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `OTG_GUSBCFG` writer"]
pub struct W(crate::W<OTG_GUSBCFG_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<OTG_GUSBCFG_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<OTG_GUSBCFG_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<OTG_GUSBCFG_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `TOCAL` reader - TOCAL"]
pub struct TOCAL_R(crate::FieldReader<u8, u8>);
impl TOCAL_R {
pub(crate) fn new(bits: u8) -> Self {
TOCAL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for TOCAL_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TOCAL` writer - TOCAL"]
pub struct TOCAL_W<'a> {
w: &'a mut W,
}
impl<'a> TOCAL_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) | (value as u32 & 0x07);
self.w
}
}
#[doc = "Field `PHYSEL` reader - PHYSEL"]
pub struct PHYSEL_R(crate::FieldReader<bool, bool>);
impl PHYSEL_R {
pub(crate) fn new(bits: bool) -> Self {
PHYSEL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PHYSEL_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PHYSEL` writer - PHYSEL"]
pub struct PHYSEL_W<'a> {
w: &'a mut W,
}
impl<'a> PHYSEL_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 << 6)) | ((value as u32 & 0x01) << 6);
self.w
}
}
#[doc = "Field `SRPCAP` reader - SRPCAP"]
pub struct SRPCAP_R(crate::FieldReader<bool, bool>);
impl SRPCAP_R {
pub(crate) fn new(bits: bool) -> Self {
SRPCAP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SRPCAP_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SRPCAP` writer - SRPCAP"]
pub struct SRPCAP_W<'a> {
w: &'a mut W,
}
impl<'a> SRPCAP_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 `HNPCAP` reader - HNPCAP"]
pub struct HNPCAP_R(crate::FieldReader<bool, bool>);
impl HNPCAP_R {
pub(crate) fn new(bits: bool) -> Self {
HNPCAP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for HNPCAP_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `HNPCAP` writer - HNPCAP"]
pub struct HNPCAP_W<'a> {
w: &'a mut W,
}
impl<'a> HNPCAP_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 `TRDT` reader - TRDT"]
pub struct TRDT_R(crate::FieldReader<u8, u8>);
impl TRDT_R {
pub(crate) fn new(bits: u8) -> Self {
TRDT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for TRDT_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TRDT` writer - TRDT"]
pub struct TRDT_W<'a> {
w: &'a mut W,
}
impl<'a> TRDT_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 & !(0x0f << 10)) | ((value as u32 & 0x0f) << 10);
self.w
}
}
#[doc = "Field `PHYLPC` reader - PHYLPC"]
pub struct PHYLPC_R(crate::FieldReader<bool, bool>);
impl PHYLPC_R {
pub(crate) fn new(bits: bool) -> Self {
PHYLPC_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PHYLPC_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PHYLPC` writer - PHYLPC"]
pub struct PHYLPC_W<'a> {
w: &'a mut W,
}
impl<'a> PHYLPC_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 << 15)) | ((value as u32 & 0x01) << 15);
self.w
}
}
#[doc = "Field `TSDPS` reader - TSDPS"]
pub struct TSDPS_R(crate::FieldReader<bool, bool>);
impl TSDPS_R {
pub(crate) fn new(bits: bool) -> Self {
TSDPS_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for TSDPS_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TSDPS` writer - TSDPS"]
pub struct TSDPS_W<'a> {
w: &'a mut W,
}
impl<'a> TSDPS_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 << 22)) | ((value as u32 & 0x01) << 22);
self.w
}
}
#[doc = "Field `FHMOD` reader - FHMOD"]
pub struct FHMOD_R(crate::FieldReader<bool, bool>);
impl FHMOD_R {
pub(crate) fn new(bits: bool) -> Self {
FHMOD_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FHMOD_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FHMOD` writer - FHMOD"]
pub struct FHMOD_W<'a> {
w: &'a mut W,
}
impl<'a> FHMOD_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 << 29)) | ((value as u32 & 0x01) << 29);
self.w
}
}
#[doc = "Field `FDMOD` reader - FDMOD"]
pub struct FDMOD_R(crate::FieldReader<bool, bool>);
impl FDMOD_R {
pub(crate) fn new(bits: bool) -> Self {
FDMOD_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FDMOD_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FDMOD` writer - FDMOD"]
pub struct FDMOD_W<'a> {
w: &'a mut W,
}
impl<'a> FDMOD_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 << 30)) | ((value as u32 & 0x01) << 30);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - TOCAL"]
#[inline(always)]
pub fn tocal(&self) -> TOCAL_R {
TOCAL_R::new((self.bits & 0x07) as u8)
}
#[doc = "Bit 6 - PHYSEL"]
#[inline(always)]
pub fn physel(&self) -> PHYSEL_R {
PHYSEL_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 8 - SRPCAP"]
#[inline(always)]
pub fn srpcap(&self) -> SRPCAP_R {
SRPCAP_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - HNPCAP"]
#[inline(always)]
pub fn hnpcap(&self) -> HNPCAP_R {
HNPCAP_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bits 10:13 - TRDT"]
#[inline(always)]
pub fn trdt(&self) -> TRDT_R {
TRDT_R::new(((self.bits >> 10) & 0x0f) as u8)
}
#[doc = "Bit 15 - PHYLPC"]
#[inline(always)]
pub fn phylpc(&self) -> PHYLPC_R {
PHYLPC_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 22 - TSDPS"]
#[inline(always)]
pub fn tsdps(&self) -> TSDPS_R {
TSDPS_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 29 - FHMOD"]
#[inline(always)]
pub fn fhmod(&self) -> FHMOD_R {
FHMOD_R::new(((self.bits >> 29) & 0x01) != 0)
}
#[doc = "Bit 30 - FDMOD"]
#[inline(always)]
pub fn fdmod(&self) -> FDMOD_R {
FDMOD_R::new(((self.bits >> 30) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:2 - TOCAL"]
#[inline(always)]
pub fn tocal(&mut self) -> TOCAL_W {
TOCAL_W { w: self }
}
#[doc = "Bit 6 - PHYSEL"]
#[inline(always)]
pub fn physel(&mut self) -> PHYSEL_W {
PHYSEL_W { w: self }
}
#[doc = "Bit 8 - SRPCAP"]
#[inline(always)]
pub fn srpcap(&mut self) -> SRPCAP_W {
SRPCAP_W { w: self }
}
#[doc = "Bit 9 - HNPCAP"]
#[inline(always)]
pub fn hnpcap(&mut self) -> HNPCAP_W {
HNPCAP_W { w: self }
}
#[doc = "Bits 10:13 - TRDT"]
#[inline(always)]
pub fn trdt(&mut self) -> TRDT_W {
TRDT_W { w: self }
}
#[doc = "Bit 15 - PHYLPC"]
#[inline(always)]
pub fn phylpc(&mut self) -> PHYLPC_W {
PHYLPC_W { w: self }
}
#[doc = "Bit 22 - TSDPS"]
#[inline(always)]
pub fn tsdps(&mut self) -> TSDPS_W {
TSDPS_W { w: self }
}
#[doc = "Bit 29 - FHMOD"]
#[inline(always)]
pub fn fhmod(&mut self) -> FHMOD_W {
FHMOD_W { w: self }
}
#[doc = "Bit 30 - FDMOD"]
#[inline(always)]
pub fn fdmod(&mut self) -> FDMOD_W {
FDMOD_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 = "This register can be used to configure the core after power-on or a changing to host mode or device mode. It contains USB and USB-PHY related configuration parameters. The application must program this register before starting any transactions on either the AHB or the USB. Do not make changes to this register after the initial programming.\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 [otg_gusbcfg](index.html) module"]
pub struct OTG_GUSBCFG_SPEC;
impl crate::RegisterSpec for OTG_GUSBCFG_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [otg_gusbcfg::R](R) reader structure"]
impl crate::Readable for OTG_GUSBCFG_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [otg_gusbcfg::W](W) writer structure"]
impl crate::Writable for OTG_GUSBCFG_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets OTG_GUSBCFG to value 0x1400"]
impl crate::Resettable for OTG_GUSBCFG_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x1400
}
}