mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
imx233: implement battery reading using power register (automatically updated & scaled by lradc delay)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30988 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4359b40cf1
commit
9e4299f6f0
2 changed files with 5 additions and 2 deletions
|
|
@ -67,6 +67,8 @@
|
||||||
#define HW_POWER_STS__PSWITCH_BM (3 << 20)
|
#define HW_POWER_STS__PSWITCH_BM (3 << 20)
|
||||||
|
|
||||||
#define HW_POWER_BATTMONITOR (*(volatile uint32_t *)(HW_POWER_BASE + 0xe0))
|
#define HW_POWER_BATTMONITOR (*(volatile uint32_t *)(HW_POWER_BASE + 0xe0))
|
||||||
|
#define HW_POWER_BATTMONITOR__BATT_VAL_BP 16
|
||||||
|
#define HW_POWER_BATTMONITOR__BATT_VAL_BM (0x3ff << 16)
|
||||||
|
|
||||||
#define HW_POWER_RESET (*(volatile uint32_t *)(HW_POWER_BASE + 0x100))
|
#define HW_POWER_RESET (*(volatile uint32_t *)(HW_POWER_BASE + 0x100))
|
||||||
#define HW_POWER_RESET__UNLOCK 0x3E770000
|
#define HW_POWER_RESET__UNLOCK 0x3E770000
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "adc-target.h"
|
#include "power-imx233.h"
|
||||||
|
|
||||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +49,8 @@ const unsigned short percent_to_volt_charge[11] =
|
||||||
/* Returns battery voltage from ADC [millivolts] */
|
/* Returns battery voltage from ADC [millivolts] */
|
||||||
unsigned int battery_adc_voltage(void)
|
unsigned int battery_adc_voltage(void)
|
||||||
{
|
{
|
||||||
return 4100;
|
/* battery value is in 8mV LSB */
|
||||||
|
return __XTRACT(HW_POWER_BATTMONITOR, BATT_VAL) * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void powermgmt_init_target(void)
|
void powermgmt_init_target(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue