kopia lustrzana https://github.com/OpenRTX/OpenRTX
Implemented mic gain setting based on UI for Module 17
rodzic
cddf8e1c1f
commit
e93666a515
|
@ -389,6 +389,7 @@ mod17_src = ['platform/targets/Module17/platform.c',
|
|||
'platform/drivers/audio/inputStream_Mod17.cpp',
|
||||
'platform/drivers/audio/outputStream_Mod17.cpp',
|
||||
'platform/drivers/audio/audio_Mod17.c',
|
||||
'platform/drivers/audio/MAX9814_Mod17.cpp',
|
||||
'platform/drivers/baseband/MCP4551_Mod17.cpp']
|
||||
|
||||
mod17_src = src + openrtx_ui_module17 + mod17_src + stm32f405_src
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2022 by Mathis Schmieder DB9MAT *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAX9814_H
|
||||
#define MAX9814_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void max9814_setGain(uint8_t gain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MAX9814_H */
|
|
@ -0,0 +1,42 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2021 - 2022 by Mathis Schmieder DB9MAT *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||
***************************************************************************/
|
||||
|
||||
#include <interfaces/gpio.h>
|
||||
#include <hwconfig.h>
|
||||
#include "MAX9814.h"
|
||||
|
||||
/*
|
||||
* Implementation of MAX9814 gain setting
|
||||
*/
|
||||
|
||||
void max9814_setGain(uint8_t gain)
|
||||
{
|
||||
if (gain == 0)
|
||||
{
|
||||
gpio_setMode(MIC_GAIN, OUTPUT);
|
||||
gpio_setPin(MIC_GAIN); // 40 dB gain
|
||||
}
|
||||
else if (gain == 1)
|
||||
{
|
||||
gpio_setMode(MIC_GAIN, OUTPUT);
|
||||
gpio_clearPin(MIC_GAIN); // 50 dB gain
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_setMode(MIC_GAIN, INPUT); // High impedance, 60 dB gain
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
#include <interfaces/audio.h>
|
||||
#include <interfaces/gpio.h>
|
||||
#include <hwconfig.h>
|
||||
#include "MAX9814.h"
|
||||
|
||||
|
||||
static const uint8_t pathCompatibilityMatrix[9][9] =
|
||||
|
@ -42,11 +43,10 @@ void audio_init()
|
|||
{
|
||||
gpio_setMode(SPK_MUTE, OUTPUT);
|
||||
gpio_setMode(MIC_MUTE, OUTPUT);
|
||||
gpio_setMode(MIC_GAIN, OUTPUT);
|
||||
|
||||
gpio_setPin(SPK_MUTE); // Off = logic high
|
||||
gpio_clearPin(MIC_MUTE); // Off = logic low
|
||||
gpio_setPin(MIC_GAIN); // gain = 40 dB
|
||||
max9814_setGain(0); // 40 dB gain
|
||||
}
|
||||
|
||||
void audio_terminate()
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <calibInfo_Mod17.h>
|
||||
#include <hwconfig.h>
|
||||
#include <MCP4551.h>
|
||||
#include "../audio/MAX9814.h"
|
||||
|
||||
enum opstatus radioStatus; // Current operating status
|
||||
const mod17Calib_t *calData; // Calibration data
|
||||
|
@ -87,6 +88,7 @@ void radio_enableTx()
|
|||
|
||||
mcp4551_setWiper(SOFTPOT_TX, calData->tx_wiper);
|
||||
mcp4551_setWiper(SOFTPOT_RX, calData->rx_wiper);
|
||||
max9814_setGain(calData->mic_gain);
|
||||
}
|
||||
|
||||
void radio_disableRtx()
|
||||
|
|
Ładowanie…
Reference in New Issue