mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 09:57:50 +00:00
Pocsag improvements (#20)
* Update analog_audio_app.cpp (#353) * Adding phase field (extracted from @jamesshao8 repo)
This commit is contained in:
@@ -47,8 +47,11 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
||||
const int32_t audio_sample = __SSAT(sample_int, 16);
|
||||
|
||||
slicer_sr <<= 1;
|
||||
slicer_sr |= (audio_sample < 0); // Do we need hysteresis ?
|
||||
|
||||
if (phase == 0)
|
||||
slicer_sr |= (audio_sample < 0); // Do we need hysteresis ?
|
||||
else
|
||||
slicer_sr |= !(audio_sample < 0);
|
||||
|
||||
// Detect transitions to adjust clock
|
||||
if ((slicer_sr ^ (slicer_sr >> 1)) & 1) {
|
||||
if (sphase < (0x8000u - sphase_delta_half))
|
||||
@@ -162,6 +165,7 @@ void POCSAGProcessor::configure(const POCSAGConfigureMessage& message) {
|
||||
//audio_output.configure(false);
|
||||
|
||||
bitrate = message.bitrate;
|
||||
phase = message.phase;
|
||||
sphase_delta = 0x10000u * bitrate / POCSAG_AUDIO_RATE;
|
||||
sphase_delta_half = sphase_delta / 2; // Just for speed
|
||||
sphase_delta_eighth = sphase_delta / 8;
|
||||
|
@@ -95,6 +95,7 @@ private:
|
||||
bool configured = false;
|
||||
rx_states rx_state { WAITING };
|
||||
pocsag::BitRate bitrate { pocsag::BitRate::FSK1200 };
|
||||
bool phase;
|
||||
uint32_t codeword_count { 0 };
|
||||
pocsag::POCSAGPacket packet { };
|
||||
|
||||
|
Reference in New Issue
Block a user