feat: add shared GMSK radio profile helpers
Add a fixed 6-byte 100 kbps GMSK profile matching the health-band telemetry packet, plus FSK packet-status helpers for RSSI and error checks. Expose instantaneous RSSI reads for CCA and image calibration for 430-440 MHz GFSK bring-up.
This commit is contained in:
@@ -476,6 +476,40 @@ struct gfsk_parameters_t {
|
||||
.broadcast_address = std::nullopt,
|
||||
};
|
||||
}
|
||||
|
||||
static constexpr gfsk_parameters_t
|
||||
Gmsk100kFixed6(freq_t frequency_mhz = 433.45,
|
||||
tx_params_t tx_params = tx_params_t::Default()) {
|
||||
return {
|
||||
.mod_params =
|
||||
{
|
||||
.bitrate_bps = 100'000,
|
||||
.frequency_deviation_hz = 25'000,
|
||||
.pulse_shape = GfskPulseShape::Gauss05,
|
||||
.rx_bandwidth = GfskRxBandwidth::Bw187200,
|
||||
},
|
||||
.packet_params =
|
||||
{
|
||||
.preamble_bits = 32,
|
||||
.detector_length = GfskPreambleDetector::Bits16,
|
||||
.sync_length_bits = 32,
|
||||
.address_filtering = GfskAddressFiltering::Disabled,
|
||||
.packet_length_mode = GfskPacketLengthMode::Fixed,
|
||||
.payload_length = 6,
|
||||
.crc_type = GfskCrcType::Off,
|
||||
.whitening = GfskWhitening::On,
|
||||
},
|
||||
.tx_params = tx_params,
|
||||
.frequency_mhz = frequency_mhz,
|
||||
.sync_word = {0x2D, 0xD4, 0xA1, 0x7E, 0, 0, 0, 0},
|
||||
.sync_word_length = 4,
|
||||
.crc_seed = 0x1D0F,
|
||||
.crc_polynomial = 0x1021,
|
||||
.whitening_seed = 0x0100,
|
||||
.node_address = std::nullopt,
|
||||
.broadcast_address = std::nullopt,
|
||||
};
|
||||
}
|
||||
void log(const char *tag) const;
|
||||
};
|
||||
|
||||
@@ -656,6 +690,26 @@ struct __attribute__((packed)) fsk_packet_status_t {
|
||||
// the pkt_done IRQ. [negated, dBm, fixdt(0,8,1)] Actual signal power is
|
||||
// –RssiAvg/2 (dBm)
|
||||
uint8_t rssi_avg;
|
||||
|
||||
[[nodiscard]]
|
||||
bool has_error() const {
|
||||
return (rx_status & 0b11111100U) != 0;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool packet_received() const {
|
||||
return (rx_status & 0b00000010U) != 0;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto rssi_sync_dbm() const -> float {
|
||||
return -static_cast<float>(rssi_sync) / 2.0F;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto rssi_avg_dbm() const -> float {
|
||||
return -static_cast<float>(rssi_avg) / 2.0F;
|
||||
}
|
||||
};
|
||||
|
||||
union packet_status_t {
|
||||
|
||||
Reference in New Issue
Block a user