Fixed error in ADC conversion sequence in MD-3x0 platforms, improved behaviour of 'platform_pwrButtonStatus' in targets having the power switch on the volume knob.

replace/ba185738b5621c82dddcd0c0a6a00c80da141dc2
Silvano Seva 2021-04-11 18:18:58 +02:00
rodzic 1e7c2ceac3
commit 7209414a2b
5 zmienionych plików z 18 dodań i 6 usunięć

Wyświetl plik

@ -104,8 +104,8 @@ void adc1_init()
| (15 << 5); /* CH15, HTEMP value on PC5 */
#elif defined(PLATFORM_MD3x0)
ADC1->SQR1 = 3 << 20; /* Four channels to be converted */
ADC1->SQR3 |= (1 << 0) /* CH1, battery voltage on PA1 */
| (0 << 5) /* CH0, volume potentiometer level on PA0 */
ADC1->SQR3 |= (0 << 0) /* CH0, volume potentiometer level on PA0 */
| (1 << 5) /* CH1, battery voltage on PA1 */
| (8 << 10) /* CH8, RSSI value on PB0 */
| (3 << 15); /* CH3, vox level on PA3 */
#else

Wyświetl plik

@ -144,8 +144,11 @@ bool platform_pwrButtonStatus()
{
/*
* When power knob is set to off, battery voltage measurement returns 0V.
* Here we set the threshold to 1V since, with knob in off position, there
* is always a bit of noise in the ADC measurement making the returned
* voltage not to be exactly zero.
*/
return (platform_getVbat() > 0.0f) ? true : false;
return (platform_getVbat() > 1.0f) ? true : false;
}
void platform_ledOn(led_t led)

Wyświetl plik

@ -143,8 +143,11 @@ bool platform_pwrButtonStatus()
{
/*
* When power knob is set to off, battery voltage measurement returns 0V.
* Here we set the threshold to 1V since, with knob in off position, there
* is always a bit of noise in the ADC measurement making the returned
* voltage not to be exactly zero.
*/
return (platform_getVbat() > 0.0f) ? true : false;
return (platform_getVbat() > 1.0f) ? true : false;
}
void platform_ledOn(led_t led)

Wyświetl plik

@ -126,8 +126,11 @@ bool platform_pwrButtonStatus()
{
/*
* When power knob is set to off, battery voltage measurement returns 0V.
* Here we set the threshold to 1V since, with knob in off position, there
* is always a bit of noise in the ADC measurement making the returned
* voltage not to be exactly zero.
*/
return (adc1_getMeasurement(ADC_VBAT_CH) > 0.0f) ? true : false;
return (platform_getVbat() > 1.0f) ? true : false;
}
void platform_ledOn(led_t led)

Wyświetl plik

@ -120,8 +120,11 @@ bool platform_pwrButtonStatus()
{
/*
* When power knob is set to off, battery voltage measurement returns 0V.
* Here we set the threshold to 1V since, with knob in off position, there
* is always a bit of noise in the ADC measurement making the returned
* voltage not to be exactly zero.
*/
return (adc1_getMeasurement(ADC_VBAT_CH) > 0.0f) ? true : false;
return (platform_getVbat() > 1.0f) ? true : false;
}
void platform_ledOn(led_t led)