summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/powermgmt.h')
-rw-r--r--firmware/powermgmt.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/firmware/powermgmt.h b/firmware/powermgmt.h
new file mode 100644
index 0000000000..068fd5d4b5
--- /dev/null
+++ b/firmware/powermgmt.h
@@ -0,0 +1,49 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Heikki Hannikainen
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef _POWERMGMT_H_
20#define _POWERMGMT_H_
21
22#ifndef SIMULATOR
23
24#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
25#define POWER_AVG 3 /* how many samples to take for each measurement */
26
27#define CHARGE_END_NEGD 6 /* stop when N minutes have passed with
28 * avg delta being < -0.3 V */
29#define CHARGE_END_ZEROD 30 /* stop when N minutes have passed with
30 * avg delta being < 0.005 V */
31
32#ifdef HAVE_CHARGE_CTRL
33#define POWER_MESSAGE_LEN 32 /* power thread status message */
34#define CHARGE_MAX_TIME 16*60 /* minutes: maximum charging time */
35#define CHARGE_MIN_TIME 10 /* minutes: minimum charging time */
36#define CHARGE_RESTART_HI 90 /* %: when to restart charging in 'charge' mode */
37#define CHARGE_RESTART_LO 10 /* %: when to restart charging in 'discharge' mode */
38
39extern char power_message[POWER_MESSAGE_LEN];
40extern char charge_restart_level;
41#endif /* HAVE_CHARGE_CTRL */
42
43extern unsigned short power_history[POWER_HISTORY_LEN];
44
45void power_init(void);
46
47#endif
48
49#endif