/**************************************************************************** NAME powerManagerConfig DESCRIPTION Configure power management RETURNS void */ void powerManagerConfig(const power_config* config, const power_pmu_temp_mon_config* pmu_mon_config) { uint16 level = 0; PM_DEBUG(("PM: Power Library Init\n")); PowerInit(&theSink.task, config, pmu_mon_config); theSink.battery_state = POWER_BATT_LEVEL3; if ((theSink.conf1 != NULL) && (config != NULL)) { /* store the charger termination voltage as the max battery voltage */ theSink.rundata->battery_limits.max_battery_v = 0; PsFullRetrieve(PSKEY_CHARGER_CALC_VTERM, &theSink.rundata->battery_limits.max_battery_v, sizeof(uint16)); /* store the critical voltage as the min battery voltage */ theSink.rundata->battery_limits.min_battery_v = 0; for (level = 0; level < POWER_MAX_VBAT_LIMITS; level++) { if ((theSink.conf1->power.bat_events[level].event) == EventSysBatteryCritical) { theSink.rundata->battery_limits.min_battery_v = config->vbat.limits[level].limit * POWER_VSCALE; break; } } } }
/**************************************************************************** NAME powerManagerConfig DESCRIPTION Configure power management RETURNS void */ bool powerManagerConfig(const power_type* config) { bool success = TRUE; PM_DEBUG(("PM Config\n")); if(config) { theHeadset.low_battery_flag_ag = FALSE; /* Initialise the battery and its charging sub-system */ PowerInit(&theHeadset.task, config); PM_DEBUG(("Power init\n")); } else { success = FALSE; } return success; }