#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use crate::stm32g0::peripherals::gpio::Instance;
pub use crate::stm32g0::peripherals::gpio::{RegisterBlock, ResetValues};
pub use crate::stm32g0::peripherals::gpio::{
AFRH, AFRL, BRR, BSRR, IDR, LCKR, MODER, ODR, OSPEEDR, OTYPER, PUPDR,
};
pub mod GPIOA {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x50000000,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
MODER: 0xEBFFFFFF,
OTYPER: 0x00000000,
OSPEEDR: 0x0C000000,
PUPDR: 0x24000000,
IDR: 0x00000000,
ODR: 0x00000000,
BSRR: 0x00000000,
LCKR: 0x00000000,
AFRL: 0x00000000,
AFRH: 0x00000000,
BRR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPIOA_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOA_TAKEN {
None
} else {
GPIOA_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOA_TAKEN && inst.addr == INSTANCE.addr {
GPIOA_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPIOA_TAKEN = true;
INSTANCE
}
}
pub const GPIOA: *const RegisterBlock = 0x50000000 as *const _;
pub mod GPIOB {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x50000400,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
MODER: 0xFFFFFFFF,
OTYPER: 0x00000000,
OSPEEDR: 0x00000000,
PUPDR: 0x00000000,
IDR: 0x00000000,
ODR: 0x00000000,
BSRR: 0x00000000,
LCKR: 0x00000000,
AFRL: 0x00000000,
AFRH: 0x00000000,
BRR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPIOB_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOB_TAKEN {
None
} else {
GPIOB_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOB_TAKEN && inst.addr == INSTANCE.addr {
GPIOB_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPIOB_TAKEN = true;
INSTANCE
}
}
pub const GPIOB: *const RegisterBlock = 0x50000400 as *const _;
pub mod GPIOC {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x50000800,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
MODER: 0xFFFFFFFF,
OTYPER: 0x00000000,
OSPEEDR: 0x00000000,
PUPDR: 0x00000000,
IDR: 0x00000000,
ODR: 0x00000000,
BSRR: 0x00000000,
LCKR: 0x00000000,
AFRL: 0x00000000,
AFRH: 0x00000000,
BRR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPIOC_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOC_TAKEN {
None
} else {
GPIOC_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOC_TAKEN && inst.addr == INSTANCE.addr {
GPIOC_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPIOC_TAKEN = true;
INSTANCE
}
}
pub const GPIOC: *const RegisterBlock = 0x50000800 as *const _;
pub mod GPIOD {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x50000c00,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
MODER: 0xFFFFFFFF,
OTYPER: 0x00000000,
OSPEEDR: 0x00000000,
PUPDR: 0x00000000,
IDR: 0x00000000,
ODR: 0x00000000,
BSRR: 0x00000000,
LCKR: 0x00000000,
AFRL: 0x00000000,
AFRH: 0x00000000,
BRR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPIOD_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOD_TAKEN {
None
} else {
GPIOD_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOD_TAKEN && inst.addr == INSTANCE.addr {
GPIOD_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPIOD_TAKEN = true;
INSTANCE
}
}
pub const GPIOD: *const RegisterBlock = 0x50000c00 as *const _;
pub mod GPIOF {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x50001400,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
MODER: 0xFFFFFFFF,
OTYPER: 0x00000000,
OSPEEDR: 0x00000000,
PUPDR: 0x00000000,
IDR: 0x00000000,
ODR: 0x00000000,
BSRR: 0x00000000,
LCKR: 0x00000000,
AFRL: 0x00000000,
AFRH: 0x00000000,
BRR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPIOF_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOF_TAKEN {
None
} else {
GPIOF_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPIOF_TAKEN && inst.addr == INSTANCE.addr {
GPIOF_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPIOF_TAKEN = true;
INSTANCE
}
}
pub const GPIOF: *const RegisterBlock = 0x50001400 as *const _;