mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Simplify powermgmt thread loops so it calls functions turn (no more power_thread_sleep). Do other target-friendly simplifications, generic battery switch handling and split sim-specific code. Whoever can, please verify charging on the Archos Recorder (due to change in the charger duty cycle code).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19579 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0f9729739f
commit
3157e13956
34 changed files with 1337 additions and 1124 deletions
|
|
@ -19,9 +19,10 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "adc.h"
|
||||
#include "power.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
|
|
@ -58,3 +59,17 @@ unsigned int battery_adc_voltage(void)
|
|||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
||||
unsigned int input_millivolts(void)
|
||||
{
|
||||
|
||||
unsigned int batt_millivolts = battery_voltage();
|
||||
|
||||
if ((power_thread_inputs & POWER_INPUT_BATTERY) == 0) {
|
||||
/* Just return a safe value if battery isn't connected */
|
||||
return 4050;
|
||||
}
|
||||
|
||||
return batt_millivolts;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue