⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 headset_powermanager.c

📁 bluelab的一个很好的例程
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    headset_powermanager.c
    
DESCRIPTION
    Module responsible for managing the battery monitoring and battery 
	charging functionaility
    
	BC4-Audio has integrated hardware support for charging LiON batteries.
	BC4-Headset provides software support for the charging of NiMH and
	NiMH battery technologies.  NiMH requires external hardware support.
*/

#include "headset_powermanager.h"
#include "headset_private.h"
#include "headset_battery.h"
#include "headset_charger.h"


#ifdef DEBUG_POWER
    #define PM_DEBUG(x) DEBUG(x)             
#else
    #define PM_DEBUG(x) 
#endif


/****************************************************************************
NAME	
	powerManagerInit

DESCRIPTION
	Initialise power management

RETURNS
	void
    
*/
power_type* powerManagerInit(void) 
{
	/* Allocate memory to hold the power state */
	return (power_type*) mallocPanic(sizeof(power_type));
}


/****************************************************************************
NAME    
    powerManagerConfig
    
DESCRIPTION
  	Configure power management
    
RETURNS
    void
*/
bool powerManagerConfig(power_type* power, const power_config_type* config)
{
	bool success = TRUE;
		
	DEBUG(("PM Config\n"));
	
	if(config)
	{
		/* Store power configuration */
		power->config = *config;
	
		/* Initialise the battery sub-system */		
		batteryInit(power);
		
		/* Initialise the battery charging sub-system */
		chargerInit(power);
	}
	else
	{
		success = FALSE;
	}
	
	return success;
}


/****************************************************************************
NAME    
    powerManagerChargerConnected
    
DESCRIPTION
  	This function is called when the charger is plugged into the headset
    
RETURNS
    void
*/
void powerManagerChargerConnected(power_type* power)
{
	chargerConnected(power);
}


/****************************************************************************
NAME    
    powerManagerChargerDisconnected
    
DESCRIPTION
  	This function is called when the charger is unplugged from the headset
    
RETURNS
    void
*/
void powerManagerChargerDisconnected(power_type* power)
{
	chargerDisconnected(power);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -