Skip to content

Commit 262a3bf

Browse files
authored
subghz: expand documentation for modulation parameters
1 parent e06b735 commit 262a3bf

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

hal/src/subghz/mod_params.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ impl Default for FskModParams {
608608
/// LoRa spreading factor.
609609
///
610610
/// Argument of [`LoRaModParams::set_sf`].
611+
///
612+
/// Higher spreading factors improve receiver sensitivity, but reduce bit rate
613+
/// and increase power consumption.
611614
#[derive(Debug, PartialEq, Eq, Clone, Copy, PartialOrd, Ord)]
612615
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
613616
#[repr(u8)]
@@ -715,19 +718,34 @@ impl PartialOrd for LoRaBandwidth {
715718
/// LoRa forward error correction coding rate.
716719
///
717720
/// Argument of [`LoRaModParams::set_cr`].
721+
///
722+
/// A higher coding rate provides better immunity to interference at the expense
723+
/// of longer transmission time.
724+
/// In normal conditions [`CodingRate::Cr45`] provides the best trade off.
725+
/// In case of strong interference, a higher coding rate may be used.
718726
#[derive(Debug, PartialEq, Eq, Clone, Copy, PartialOrd, Ord)]
719727
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
720728
#[repr(u8)]
721729
pub enum CodingRate {
722730
/// No forward error correction coding rate 4/4
731+
///
732+
/// Overhead ratio of 1
723733
Cr44 = 0x00,
724734
/// Forward error correction coding rate 4/5
735+
///
736+
/// Overhead ratio of 1.25
725737
Cr45 = 0x1,
726738
/// Forward error correction coding rate 4/6
739+
///
740+
/// Overhead ratio of 1.5
727741
Cr46 = 0x2,
728742
/// Forward error correction coding rate 4/7
743+
///
744+
/// Overhead ratio of 1.75
729745
Cr47 = 0x3,
730746
/// Forward error correction coding rate 4/8
747+
///
748+
/// Overhead ratio of 2
731749
Cr48 = 0x4,
732750
}
733751

@@ -798,6 +816,8 @@ impl LoRaModParams {
798816

799817
/// Set the forward error correction coding rate.
800818
///
819+
/// See [`CodingRate`] for more information.
820+
///
801821
/// # Example
802822
///
803823
/// ```
@@ -814,6 +834,25 @@ impl LoRaModParams {
814834

815835
/// Set low data rate optimization enable.
816836
///
837+
/// For low data rates (typically high SF or low BW) and very long payloads
838+
/// (may last several seconds), the low data rate optimization (LDRO) can be
839+
/// enabled.
840+
/// This reduces the number of bits per symbol to the given SF minus 2,
841+
/// to allow the receiver to have a better tracking of the LoRa receive
842+
/// signal.
843+
/// Depending on the payload length, the low data rate optimization is
844+
/// usually recommended when the LoRa symbol time is equal or above
845+
/// 16.38 ms.
846+
/// When using LoRa modulation, the total frequency drift over the packet
847+
/// time must be kept lower than Freq_drift_max:
848+
///
849+
/// Freq_drift_max = BW / (3 × 2SF)
850+
///
851+
/// When possible, enabling the low data rate optimization, relaxes the
852+
/// total frequency drift over the packet time by 16:
853+
///
854+
/// Freq_drift_optimise_max = 16 × Freq_drift_max
855+
///
817856
/// # Example
818857
///
819858
/// ```

0 commit comments

Comments
 (0)