Skip to content

Commit ab02141

Browse files
authored
subghz: fix timeouts after calling set_sleep
1 parent 7bc9f45 commit ab02141

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
### Fixed
9+
- Fixed timeouts after calling `SubGhz::set_sleep`.
10+
711
## [0.2.0] - 2021-11-11
812
### Added
913
- Added two board support crates

hal/src/subghz/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,14 @@ where
788788
/// # Ok::<(), stm32wlxx_hal::subghz::Error>(())
789789
/// ```
790790
pub unsafe fn set_sleep(&mut self, cfg: SleepCfg) -> Result<(), Error> {
791-
self.write(&[OpCode::SetSleep as u8, u8::from(cfg)])
791+
// poll for busy before, but not after
792+
// radio idles with busy high while in sleep mode
793+
self.poll_not_busy();
794+
{
795+
let _nss: Nss = Nss::new();
796+
self.spi.write(&[OpCode::SetSleep as u8, u8::from(cfg)])?;
797+
}
798+
Ok(())
792799
}
793800

794801
/// Put the radio into standby mode.

0 commit comments

Comments
 (0)