kopia lustrzana https://github.com/OpenRTX/OpenRTX
Module17: added detection of baseband soft potentiometers
Detects the presence of the soft potentiometers. Display the detected potentiometers in the info menu.pull/273/head
rodzic
b5e49a3b4d
commit
4f2c461bf0
|
@ -124,6 +124,7 @@ const char *info_items[] =
|
|||
"Used heap",
|
||||
"Hw Version",
|
||||
"HMI",
|
||||
"BB Tuning Pot",
|
||||
};
|
||||
|
||||
const char *authors[] =
|
||||
|
|
|
@ -60,6 +60,12 @@ const char *hmiVersions[] =
|
|||
"1.0"
|
||||
};
|
||||
|
||||
const char *bbTuningPot[] =
|
||||
{
|
||||
"Soft",
|
||||
"Hard"
|
||||
};
|
||||
|
||||
void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_t max_len, uint8_t index))
|
||||
{
|
||||
point_t pos = layout.line1_pos;
|
||||
|
@ -303,6 +309,16 @@ int _ui_getInfoValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
snprintf(buf, max_len, "%s", hmiVersions[0]);
|
||||
#endif
|
||||
break;
|
||||
case 4: // Baseband tuning potentiometers
|
||||
#ifdef PLATFORM_LINUX
|
||||
snprintf(buf, max_len, "%s", "Linux");
|
||||
#else
|
||||
if((hwinfo->flags & MOD17_FLAGS_SOFTPOT) != 0)
|
||||
snprintf(buf, max_len, "%s", bbTuningPot[0]);
|
||||
else
|
||||
snprintf(buf, max_len, "%s", bbTuningPot[1]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ enum Mod17HmiVersion
|
|||
|
||||
enum Mod17Flags
|
||||
{
|
||||
MOD17_FLAGS_HMI_PRESENT = 1
|
||||
MOD17_FLAGS_HMI_PRESENT = 1,
|
||||
MOD17_FLAGS_SOFTPOT = 2
|
||||
};
|
||||
|
||||
#define MOD17_HWDET_THRESH 300000 /* Threshold for hardware detection, in uV */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <backlight.h>
|
||||
#include <hwconfig.h>
|
||||
#include <MCP4551.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
ADC_STM32_DEVICE_DEFINE(adc1, ADC1, NULL, 3300000)
|
||||
|
@ -105,8 +106,14 @@ void platform_init()
|
|||
nvm_init();
|
||||
audio_init();
|
||||
adcStm32_init(&adc1);
|
||||
mcp4551_init(&i2c1, SOFTPOT_RX);
|
||||
mcp4551_init(&i2c1, SOFTPOT_TX);
|
||||
|
||||
/* Baseband tuning soft potentiometers */
|
||||
int ret = mcp4551_init(&i2c1, SOFTPOT_RX);
|
||||
if(ret == 0)
|
||||
{
|
||||
hwInfo.flags |= MOD17_FLAGS_SOFTPOT;
|
||||
mcp4551_init(&i2c1, SOFTPOT_TX);
|
||||
}
|
||||
|
||||
/* Set defaults for calibration */
|
||||
mod17CalData.tx_wiper = 0x080;
|
||||
|
|
Ładowanie…
Reference in New Issue