Added phase inversion setting to M17 modulator

This commit is contained in:
Silvano Seva 2022-12-08 22:12:01 +01:00
parent adc916dbca
commit e93b461beb
2 changed files with 15 additions and 1 deletions

View File

@ -83,6 +83,13 @@ public:
*/
void stop();
/**
* Invert baseband signal phase before output.
*
* @param status: if set to true signal phase is inverted.
*/
void invertPhase(const bool status);
private:
/**
@ -113,6 +120,7 @@ private:
streamId outStream; ///< Baseband output stream ID.
pathId outPath; ///< Baseband output path ID.
bool txRunning; ///< Transmission running.
bool invPhase; ///< Invert signal phase
#if defined(PLATFORM_MD3x0) || defined(PLATFORM_MDUV3x0)
PwmCompensator pwmComp;

View File

@ -141,6 +141,12 @@ void M17Modulator::stop()
#endif
}
void M17Modulator::invertPhase(const bool status)
{
invPhase = status;
}
void M17Modulator::symbolsToBaseband()
{
memset(idleBuffer, 0x00, M17_FRAME_SAMPLES * sizeof(stream_sample_t));
@ -156,8 +162,8 @@ void M17Modulator::symbolsToBaseband()
elem = M17::rrc_48k(elem * M17_RRC_GAIN) - M17_RRC_OFFSET;
#if defined(PLATFORM_MD3x0) || defined(PLATFORM_MDUV3x0)
elem = pwmComp(elem);
elem *= -1.0f; // Invert signal phase
#endif
if(invPhase) elem = 0.0f - elem; // Invert signal phase
idleBuffer[i] = static_cast< int16_t >(elem);
}
}