📄 headset_powermanager.h
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2007
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 battery monitoring configuration */
typedef struct
{
uint16 divisor_ratio;
unsigned low_threshold:8 ;
unsigned shutdown_threshold:8 ;
unsigned high_threshold:8 ;
unsigned monitoring_period:8 ;
}battery_config_type;
/* Definition of the power configuration */
typedef struct
{
battery_config_type battery;
} power_config_type;
/* Task to receive AIO readings */
typedef struct
{
TaskData task;
battery_reading_source source;
BatteryState state;
uint16 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;
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;
unsigned initial_reading:1;
} 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 + -