Skip to content

Commit

Permalink
bsp: inline RfSwitch functions
Browse files Browse the repository at this point in the history
  • Loading branch information
newAM authored May 14, 2022
1 parent 853c451 commit cf79a73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lora-e5-bsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl RfSwitch {
/// // 2. the pins have been setup
/// let rfs: RfSwitch = unsafe { RfSwitch::steal() };
/// ```
#[inline]
pub unsafe fn steal() -> Self {
RfSwitch {
a4: Output::steal(),
Expand All @@ -107,6 +108,7 @@ impl RfSwitch {
/// let mut rfs: RfSwitch = cortex_m::interrupt::free(|cs| RfSwitch::new(gpioa.a4, gpioa.a5, cs));
/// rfs.set_rx();
/// ```
#[inline]
pub fn set_rx(&mut self) {
self.a5.set_level(PinState::Low);
self.a4.set_level(PinState::High);
Expand All @@ -128,6 +130,7 @@ impl RfSwitch {
/// let mut rfs: RfSwitch = cortex_m::interrupt::free(|cs| RfSwitch::new(gpioa.a4, gpioa.a5, cs));
/// rfs.set_tx_hp();
/// ```
#[inline]
pub fn set_tx_hp(&mut self) {
self.a4.set_level(PinState::Low);
self.a5.set_level(PinState::High);
Expand Down
4 changes: 4 additions & 0 deletions nucleo-wl55jc-bsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl RfSwitch {
/// // 2. the pins have been setup
/// let rfs: RfSwitch = unsafe { RfSwitch::steal() };
/// ```
#[inline]
pub unsafe fn steal() -> Self {
RfSwitch {
fe_ctrl1: Output::steal(),
Expand All @@ -113,6 +114,7 @@ impl RfSwitch {
/// cortex_m::interrupt::free(|cs| RfSwitch::new(gpioc.c3, gpioc.c4, gpioc.c5, cs));
/// rfs.set_rx()
/// ```
#[inline]
pub fn set_rx(&mut self) {
self.fe_ctrl1.set_level(PinState::High);
self.fe_ctrl2.set_level(PinState::Low);
Expand All @@ -136,6 +138,7 @@ impl RfSwitch {
/// cortex_m::interrupt::free(|cs| RfSwitch::new(gpioc.c3, gpioc.c4, gpioc.c5, cs));
/// rfs.set_tx_lp()
/// ```
#[inline]
pub fn set_tx_lp(&mut self) {
self.fe_ctrl1.set_level(PinState::High);
self.fe_ctrl2.set_level(PinState::High);
Expand All @@ -159,6 +162,7 @@ impl RfSwitch {
/// cortex_m::interrupt::free(|cs| RfSwitch::new(gpioc.c3, gpioc.c4, gpioc.c5, cs));
/// rfs.set_tx_hp()
/// ```
#[inline]
pub fn set_tx_hp(&mut self) {
self.fe_ctrl2.set_level(PinState::High);
self.fe_ctrl1.set_level(PinState::Low);
Expand Down

0 comments on commit cf79a73

Please sign in to comment.