Module17: added detection of baseband soft potentiometers

Detects the presence of the soft potentiometers. Display the detected potentiometers in the info menu.
pull/269/head
Morgan Diepart 2024-02-10 22:31:52 +01:00 zatwierdzone przez Silvano Seva
rodzic 35b07ba269
commit 26665a9001
4 zmienionych plików z 28 dodań i 3 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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[(hwinfo->flags >> 8) & 0xFF]);
#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;
}

Wyświetl plik

@ -45,7 +45,8 @@ enum Mod17HmiVersion
enum Mod17Flags
{
MOD17_FLAGS_HMI_PRESENT = 1
MOD17_FLAGS_HMI_PRESENT = 1,
MOD17_FLAGS_SOFTPOT = 2
};
#define MOD17_HWDET_THRESH 300 /* Threshold for hardware detection, in mV */

Wyświetl plik

@ -30,6 +30,7 @@
#include <backlight.h>
#include <hwconfig.h>
#include <MCP4551.h>
#include <errno.h>
I2C_STM32_DEVICE_DEFINE(i2c1, I2C1, NULL)
@ -102,8 +103,14 @@ void platform_init()
nvm_init();
adc1_init();
audio_init();
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;