Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from ceekdee/main
Browse files Browse the repository at this point in the history
Disallow stm32wl rng operations
  • Loading branch information
ceekdee authored May 14, 2023
2 parents 081878a + 5790bcd commit 8547443
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mod_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub enum RadioError {
DutyCycleUnsupported,
DutyCycleRxContinuousUnsupported,
CADUnexpected,
RngUnsupported,
}

/// Status for a received packet
Expand Down
4 changes: 4 additions & 0 deletions src/sx1261_2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,10 @@ where
/// The random numbers produced by the generator do not have a uniform or Gaussian distribution.
/// If uniformity is needed, perform appropriate software post-processing.
async fn get_random_number(&mut self) -> Result<u32, RadioError> {
// The stm32wl often returns 0 on the first random number generation operation. Documentation for the stm32wl does not recommend LNA register modification.
if self.board_type == BoardType::Stm32wlSx1262 {
return Err(RadioError::RngUnsupported);
}
self.set_irq_params(None).await?;

let mut reg_ana_lna_buffer_original = [0x00u8];
Expand Down

0 comments on commit 8547443

Please sign in to comment.