kopia lustrzana https://github.com/OpenRTX/OpenRTX
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.
rodzic
1e7c2ceac3
commit
7209414a2b
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Ładowanie…
Reference in New Issue