ButterflyMP3

power.h File Reference

Butterfly MP3 Power Routines. More...

#include "types.h"
Include dependency graph for power.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PWR_MAX_V   0x28f
 4.2V
#define PWR_GOOD_V   0x260
 3.85V
#define PWR_LOW_V   0x23c
 3.6V average voltage
#define PWR_MIN_V   0x1D9
 3.0V
#define PWR_ABS_MIN_V   0x1C0
 2.8V absolute minimum allowed battery voltage

Functions

void Power_Init (void)
 Power_Init.
void Power_idle (void)
 Power_idle.
void Power_save (void)
 Power_save.
void Power_off (void)
 Power_off.
uint16 Power_check (void)
 Power_check.
uint16 Power_pcnt (uint16 voltage)
 Power_pcnt.

Variables

volatile uint8 gPowerSaveTimer

Detailed Description

Butterfly MP3 Power Routines.

Author:
Nick Lott
Date:
January 2006
Id:
power.h,v 1.5 2007/06/02 21:34:17 brokentoaster Exp

Copyright (C) 2004 Nick Lott <brokentoaster@users.sf.net> http://butterflymp3.sf.net/

This is the power control software for the ButterflyMP3 project. This file contains all software responsible for controlling the power save modes for the mp3 player.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Target(s)...: ATmega169

Compiler....: AVR-GCC 3.3.1; avr-libc 1.2

Definition in file power.h.


Define Documentation

#define PWR_ABS_MIN_V   0x1C0

2.8V absolute minimum allowed battery voltage

Definition at line 53 of file power.h.

Referenced by mainTimer(), and Power_pcnt().

#define PWR_GOOD_V   0x260

3.85V

Definition at line 50 of file power.h.

Referenced by mainTimer(), and Power_pcnt().

#define PWR_LOW_V   0x23c

3.6V average voltage

Definition at line 51 of file power.h.

Referenced by mainTimer(), and Power_pcnt().

#define PWR_MAX_V   0x28f

4.2V

Definition at line 49 of file power.h.

Referenced by Power_pcnt().

#define PWR_MIN_V   0x1D9

3.0V

Definition at line 52 of file power.h.

Referenced by init_HW(), and mainTimer().


Function Documentation

uint16 Power_check ( void  )

Power_check.

Check the battery voltage and return level

Returns:
uint8 containing voltage level

Definition at line 205 of file power.c.

References EOL, PRINT, and UART_Printfu16().

Referenced by init_HW(), mainTimer(), and update_LCD().

Here is the call graph for this function:

void Power_idle ( void  )

Power_idle.

Set Butterfly into idle mode when nothing happening Keeps the timers running etc.

Definition at line 76 of file power.c.

Referenced by main().

void Power_Init ( void  )

Power_Init.

Set up ADC for monitoring the battery voltage using the internal 1.1V reference.

Definition at line 179 of file power.c.

References VOLTAGE_SENSOR.

Referenced by init_HW().

void Power_off ( void  )

Power_off.

Shut down all non essential systems and go into low power mode.

Definition at line 91 of file power.c.

References CBI, EOL, getkey(), gPowerSaveTimer, LCD_Sleep(), LCD_Wake(), Power_save(), PRINT, RESET_PIN, RESET_PORT, save_player_options(), save_player_state(), SBI, SCI_MODE, UART_Init(), UART_Shutdown(), vs1001_read(), and vs1001_write().

Referenced by handle_interface(), and main().

Here is the call graph for this function:

uint16 Power_pcnt ( uint16  voltage)

Power_pcnt.

Returns the ammount of percentage remaingin battery time based on experimental values.

mins % ADC ADC ~Voltage
0 100 655 0x28f 4.2
400 66 608 0x260 3.9
1050 12 572 0x23c 3.6
1200 0 445 0x1BD 2.8
Parameters:
voltageuint16 reading from ADC
Returns:
0-100 percentage remaining battery

Definition at line 254 of file power.c.

References PWR_ABS_MIN_V, PWR_GOOD_V, PWR_LOW_V, and PWR_MAX_V.

Referenced by update_LCD().

void Power_save ( void  )

Power_save.

Set Butterfly into powersave mode when nothing happening Keep timer2 and pin change interupts on only.

Definition at line 58 of file power.c.

Referenced by Power_off().


Variable Documentation

Definition at line 55 of file power.h.

Referenced by handle_interface(), handle_mmc(), main(), mainTimer(), and Power_off().

 All Files Functions Variables Typedefs Enumerations Enumerator Defines