📄 headset_powermanager.h
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.5.2-release
FILE NAME
headset_configmanager.h
DESCRIPTION
Configuration manager for the headset - resoponsible for extracting user information out of the
PSKEYs and initialising the configurable nature of the headset components
*/
#ifndef HEADSET_POWER_MANAGER_H
#define HEADSET_POWER_MANAGER_H
#include <csrtypes.h>
#include <battery.h>
/* Definition of the supported battery chemistry */
typedef enum
{
lion,
nimh
}battery_chemistry_type;
/* Definition of the battery monitoring configuration */
typedef struct
{
uint16 divisor_ratio;
uint16 high_threshold;
uint16 low_threshold;
uint16 shutdown_threshold;
uint16 monitoring_period;
uint16 low_batt_remind_time_secs ;
}battery_config_type;
/* Definition of the battery charger configuration */
typedef struct
{
uint16 min_voltage;
uint16 max_voltage;
unsigned dv_voltage:8;
unsigned dv_inhibit_time:8;
unsigned max_temp:8;
unsigned min_temp:8;
unsigned update_period:8;
unsigned td:8;
unsigned time:8;
unsigned th_enable_pio:8;
int16 th_m;
int16 th_c;
int16 vdet_m;
int16 vdet_c;
int16 dt;
}charger_config_type;
/* Definition of the power configuration */
typedef struct
{
battery_chemistry_type chemistry;
battery_config_type battery;
charger_config_type charger;
}power_config_type;
/* Task to receive AIO readings */
typedef struct
{
TaskData task;
battery_reading_source source;
BatteryState state;
int16 current_reading;
}aioTask;
/* Charger state */
typedef enum
{
disconnected,
trickle_charge,
fast_charge,
charge_error
}charging_state_type;
/* Charger control */
typedef struct
{
charging_state_type state;
int16 dv_peak;
int16 prev_dv_peak;
int16 dt_level;
int16 prev_dt_level;
uint16 fast_charge_timer;
bool fast_charge_inhibit;
TaskData task;
}charger_state;
/* Definition of the power state */
typedef struct
{
/* Configuration */
power_config_type config;
/* Vbat */
aioTask vbat_task;
/* Vth */
aioTask vth_task;
/* Charger state */
charger_state charger;
}power_type;
/****************************************************************************
NAME
powerManagerInit
DESCRIPTION
Initialise power management
RETURNS
void
*/
power_type* powerManagerInit(void);
/****************************************************************************
NAME
powerManagerConfig
DESCRIPTION
Configure power management
RETURNS
void
*/
bool powerManagerConfig(power_type* power, const power_config_type* config);
/****************************************************************************
NAME
powerManagerChargerConnected
DESCRIPTION
This function is called when the charger is plugged into the headset
RETURNS
void
*/
void powerManagerChargerConnected(power_type* power);
/****************************************************************************
NAME
powerManagerChargerDisconnected
DESCRIPTION
This function is called when the charger is unplugged from the headset
RETURNS
void
*/
void powerManagerChargerDisconnected(power_type* power);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -