-
Notifications
You must be signed in to change notification settings - Fork 2
/
charge_sched.h
88 lines (68 loc) · 2.72 KB
/
charge_sched.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*-------------------------------------------------------------------------
charge_sched.h - table based charge current scheduler
Copyright (C) 2007 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
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, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include "chip.h"
typedef struct
{
uint8_t act;
uint8_t val;
} action_and_val_uint8_type;
typedef struct
{
uint8_t act;
uint16_t val;
} action_and_val_uint16_type;
typedef struct
{
uint8_t act;
uint32_t val;
} action_and_val_uint32_type;
typedef struct
{
uint8_t act;
int16_t val;
} action_and_val_int16_type;
typedef struct
{
//(t, V, I, Q, R, T, eventually: dV/dt, dT/dt).
action_and_val_uint32_type t_ms;
uint32_t delta_t_ms;
action_and_val_uint16_type U_mV;
action_and_val_int16_type I_mA;
action_and_val_int16_type Q_raw; /* ... */
action_and_val_uint16_type R_mOhm; /* not handled */
action_and_val_int16_type T_cCelsius; /* in 1/100 degree Celsius */
/* if needed host should keep this variables.
We do not want to come near these critical entities and
do not want to pretend to be able to handle them reasonably.
So better do not have these entities here?
action_and_val_int16_type dU_dT_in_mV_per_s;
action_and_val_int16_type dT_dt_in_mC_per_s;
*/
uint8_t charging;
} battery_compare_type;
extern bool charging_table_valid;
extern battery_is_type __xdata compare_is;
void battery_charging_table_init( void );
void battery_charging_table_set_lo( unsigned char num, unsigned char __xdata *src );
void battery_charging_table_set_hi( unsigned char num, unsigned char __xdata *src );
void battery_charging_table_set_num( unsigned char num );
unsigned char battery_charging_table_get_num();
bool handle_battery_charging_table( void );