Add various additional AS3525v2 SOC voltages to the debug screen.

Change-Id: I8c110771f73f5248e949b027fbe1c281c6b1f6f7
Reviewed-on: http://gerrit.rockbox.org/991
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
Tested: Michael Giacomelli <giac2000@hotmail.com>
This commit is contained in:
Michael Giacomelli 2014-09-28 21:08:29 +02:00
parent 23dc0b0179
commit f014a76866

View file

@ -437,6 +437,14 @@ end:
return false; return false;
} }
void adc_set_voltage_mux(int channel)
{
ascodec_lock();
/*this register also controls which subregister is subsequently written, so be careful*/
ascodec_write(AS3543_PMU_ENABLE, 8 | channel << 4 );
ascodec_unlock();
}
bool dbg_ports(void) bool dbg_ports(void)
{ {
int line, btn, i; int line, btn, i;
@ -510,10 +518,22 @@ bool dbg_ports(void)
"I_CHGact", "I_CHGact",
"I_CHGref", "I_CHGref",
}; };
static const char *adc_mux_name[10] = {
NULL,
"AVDD27 ",
"AVDD17 ",
"PVDD1 ",
"PVDD2 ",
"CVDD1 ",
"CVDD2 ",
"RVDD ",
"FVDD ",
"PWGD ",
};
#endif #endif
lcd_clear_display(); lcd_clear_display();
while(1) while(1)
{ {
line = 0; line = 0;
@ -550,6 +570,7 @@ bool dbg_ports(void)
for(; i<16; i++) for(; i<16; i++)
lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)); lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i));
#endif #endif
lcd_update(); lcd_update();
btn = button_get_w_tmo(HZ/10); btn = button_get_w_tmo(HZ/10);
@ -558,7 +579,25 @@ bool dbg_ports(void)
else if(btn == (BUTTON_DOWN|BUTTON_REL)) else if(btn == (BUTTON_DOWN|BUTTON_REL))
break; break;
} }
} #if CONFIG_CPU == AS3525v2 /*extend AS3543 voltage registers*/
lcd_clear_display();
while(1)
{
line = 0;
for(i=1; i<9; i++){
adc_set_voltage_mux(i); /*change the voltage mux to a new channel*/
lcd_putsf(0, line++, "%s: %d mV", adc_mux_name[i], adc_read(5) * 5);
}
lcd_update();
btn = button_get_w_tmo(HZ/10);
if(btn == (DEBUG_CANCEL|BUTTON_REL))
goto end;
else if(btn == (BUTTON_DOWN|BUTTON_REL))
break;
}
#endif
}
end: end:
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);