diff --git a/platform/drivers/baseband/HR_Cx000.cpp b/platform/drivers/baseband/HR_Cx000.cpp index 35c1bdb2..ba278e8c 100644 --- a/platform/drivers/baseband/HR_Cx000.cpp +++ b/platform/drivers/baseband/HR_Cx000.cpp @@ -46,6 +46,21 @@ void HR_Cx000< C6000_SpiOpModes >::setDacGain(uint8_t value) writeReg(C6000_SpiOpModes::CONFIG, 0x37, (0x80 | value)); } +template <> +void HR_Cx000< C5000_SpiOpModes >::setInputGain(uint8_t value) +{ + // Mic gain is controlled by bytes 7:3 of register 0x0F (ADLinVol). + if(value > 31) value = 31; + writeReg(C5000_SpiOpModes::CONFIG, 0x0F, value << 3); +} + +template <> +void HR_Cx000< C6000_SpiOpModes >::setInputGain(uint8_t value) +{ + // TODO: Experiments needed for identification of HR_C6000 mic gain register. + (void) value; +} + ScopedChipSelect::ScopedChipSelect() { gpio_clearPin(DMR_CS); diff --git a/platform/drivers/baseband/HR_Cx000.h b/platform/drivers/baseband/HR_Cx000.h index 53f427d9..a78738e8 100644 --- a/platform/drivers/baseband/HR_Cx000.h +++ b/platform/drivers/baseband/HR_Cx000.h @@ -153,6 +153,15 @@ public: */ void setDacGain(uint8_t value); + /** + * Set the gain for the incoming audio from both the microphone and line-in + * sources. This value affects the modulation level in analog FM mode and + * it must be correctly tuned to avoid distorsions. + * + * @param value: gain value. Allowed range is 0-31. + */ + void setInputGain(uint8_t value); + /** * Configure chipset for DMR operation. */