Module17: added detection of baseband soft potentiometers

Detects the presence of the soft potentiometers. Display the detected potentiometers in the info menu.
This commit is contained in:
Morgan Diepart 2024-02-10 22:31:52 +01:00 committed by Silvano Seva
parent b5e49a3b4d
commit 4f2c461bf0
4 changed files with 28 additions and 3 deletions

View File

@ -124,6 +124,7 @@ const char *info_items[] =
"Used heap", "Used heap",
"Hw Version", "Hw Version",
"HMI", "HMI",
"BB Tuning Pot",
}; };
const char *authors[] = const char *authors[] =

View File

@ -60,6 +60,12 @@ const char *hmiVersions[] =
"1.0" "1.0"
}; };
const char *bbTuningPot[] =
{
"Soft",
"Hard"
};
void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_t max_len, uint8_t index)) void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_t max_len, uint8_t index))
{ {
point_t pos = layout.line1_pos; 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]); snprintf(buf, max_len, "%s", hmiVersions[0]);
#endif #endif
break; 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; return 0;
} }

View File

@ -51,7 +51,8 @@ enum Mod17HmiVersion
enum Mod17Flags 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 */ #define MOD17_HWDET_THRESH 300000 /* Threshold for hardware detection, in uV */

View File

@ -30,6 +30,7 @@
#include <backlight.h> #include <backlight.h>
#include <hwconfig.h> #include <hwconfig.h>
#include <MCP4551.h> #include <MCP4551.h>
#include <errno.h>
ADC_STM32_DEVICE_DEFINE(adc1, ADC1, NULL, 3300000) ADC_STM32_DEVICE_DEFINE(adc1, ADC1, NULL, 3300000)
@ -105,8 +106,14 @@ void platform_init()
nvm_init(); nvm_init();
audio_init(); audio_init();
adcStm32_init(&adc1); 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 */ /* Set defaults for calibration */
mod17CalData.tx_wiper = 0x080; mod17CalData.tx_wiper = 0x080;