summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c')
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c
deleted file mode 100644
index 8b3f05107c..0000000000
--- a/firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c
+++ /dev/null
@@ -1,65 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2011 by Tomasz Moń
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "adc.h"
24#include "powermgmt.h"
25#include "kernel.h"
26
27/* Use fake linear scale as AVR does the voltage to percentage conversion */
28
29static unsigned int current_battery_level = 100;
30
31/* This specifies the battery level that writes are still safe */
32const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
33{
34 5
35};
36
37/* Below this the player cannot be considered to operate reliably */
38const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
39{
40 4
41};
42
43/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
44const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
45{
46 { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 },
47};
48
49/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
50const unsigned short percent_to_volt_charge[11] =
51{
52 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
53};
54
55/* Returns battery voltage from ADC [millivolts] */
56int _battery_voltage(void)
57{
58 return current_battery_level;
59}
60
61void set_battery_level(unsigned int level)
62{
63 current_battery_level = level;
64}
65