BAT_main.c File Reference


Detailed Description

This module provides battery monitor task handle.

REVISION

Definition in file BAT_main.c.

#include "../SYSTEM/sys_hardware.h"
#include "../SYSTEM/sys_main.h"
#include "../SYSTEM/rtc_inc.h"
#include "../SYSTEM/sys_hiddenfeature.h"
#include "../GENERIC/eeprom.h"
#include "../MESSAGE/message.h"
#include "battery.h"
#include "battery_assert.h"

Include dependency graph for BAT_main.c:

Include dependency graph

Go to the source code of this file.

Functions

void BAT_init (void)
 Function initializes the battery monitor controls.
void BAT_main (void)
 Function serves as battery monitor task handle.
void BAT_monitorIsr (void)
 Battery monitor hardware ISR.
void BAT_low (void)
 Battery low hardware interrupt handle.
unsigned long BAT_deltaAvg (void)
 Return current battery average data.
void BAT_calibrate (void)
 Basic functionality for calculating the current voltage based on battery chemistry and current average periods.


Function Documentation

unsigned long BAT_deltaAvg void   ) 
 

Return current battery average data.

Returns:
Current battery average data in terms of time resolution.

Definition at line 285 of file BAT_main.c.

00286 {
00287     return ((UINT32)TIM_resolution*(UINT32)DeltaAvg);
00288 }

void BAT_main void   ) 
 

Function serves as battery monitor task handle.

This will update the battery structure accordingly and the results can be pulled from this structure.

Definition at line 206 of file BAT_main.c.

References battery::Flags, SBATLEVEL_UPDT, and SYS_plugSenseDet().

Referenced by KBD_main().

00207 {   
00208     SYS_plugSenseDet();
00209     BAT_stackassert(BAT_MAIN);
00210 
00211     // Now, there's really not reason to calculate the average and voltage
00212     // more than every 0.5 seconds.  Therefore, only calculate the voltage 
00213     // and ultimately update the display when bat_swi.c tells us to
00214     // (i.e. pDelta = &BatteryData.Delta[0];        
00215     if (pDelta == &Delta[0])
00216     {
00217         _batCalculate();
00218         if(SYS_HF_battery())
00219         {
00220             BatteryData.Flags |= BAT_HIDDENFEATURE;
00221             mMSG_send(sysMsgQ, SYS_MSG_ID, SBATLEVEL_UPDT, 0x1234, 0);
00222         }
00223         else if(BatteryData.Flags & BAT_HIDDENFEATURE)
00224         {
00225             BatteryData.Flags |= BAT_HIDDENFEATURE_EXIT;
00226             BatteryData.Flags &= ~BAT_HIDDENFEATURE;
00227         }
00228     }
00229         
00230     // Initiate another measurement
00231     OldTime = TIM;
00232     _setBatlevel(0);            // set battery level to input
00233 }

Here is the call graph for this function:


Generated on Wed Jan 19 01:12:48 2005 for neuros-firmware by  doxygen 1.3.9.1