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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#ifndef __SP2541_BATTERY_H_
#define __SP2541_BATTERY_H_
#define SP2541_I2C_ADDR 0x14
#define I2C_BUS_ID 3
#define RAM_READ_CMD 0x55
#define EEPROM_READ_CMD 0xF5
#define EEPROM_WRITE_CMD 0xFA
#define SP2541_REG_VOLT 0x08
#define SP2541_REG_AI 0x14
#define SP2541_REG_SOC 0x2c
struct eeprom_table {
unsigned int addr;
unsigned int len;
int data;
};
static struct eeprom_table default_table[] = {
{0x0120, 1, 0x0D},
{0x0121, 1, 0x1B},
{0x0122, 1, 0x0E},
{0x0123, 1, 0x39},
{0x0124, 1, 0x0E},
{0x0125, 1, 0x5E},
{0x0126, 1, 0x0E},
{0x0127, 1, 0x75},
{0x0128, 1, 0x0E},
{0x0129, 1, 0x93},
{0x012A, 1, 0x0E},
{0x012B, 1, 0xA9},
{0x012C, 1, 0x0E},
{0x012D, 1, 0xB3},
{0x012E, 1, 0x0E},
{0x012F, 1, 0xB7},
{0x0130, 1, 0x0E},
{0x0131, 1, 0xC2},
{0x0132, 1, 0x0E},
{0x0133, 1, 0xCF},
{0x0134, 1, 0x0E},
{0x0135, 1, 0xDF},
{0x0136, 1, 0x0E},
{0x0137, 1, 0xF5},
{0x0138, 1, 0x0F},
{0x0139, 1, 0x16},
{0x013A, 1, 0x0F},
{0x013B, 1, 0x37},
{0x013C, 1, 0x0F},
{0x013D, 1, 0x55},
{0x013E, 1, 0x0F},
{0x013F, 1, 0x79},
{0x0140, 1, 0x0F},
{0x0141, 1, 0x9A},
{0x0142, 1, 0x0F},
{0x0143, 1, 0xBF},
{0x0144, 1, 0x0F},
{0x0145, 1, 0xEB},
{0x0146, 1, 0x10},
{0x0147, 1, 0x1B},
{0x0148, 1, 0x10},
{0x0149, 1, 0x5A},
{0x0150, 1, 0x0C},
{0x0151, 1, 0x1D},
{0x0152, 1, 0x0D},
{0x0153, 1, 0x76},
{0x0154, 1, 0x0D},
{0x0155, 1, 0xC6},
{0x0156, 1, 0x0D},
{0x0157, 1, 0xE6},
{0x0158, 1, 0x0E},
{0x0159, 1, 0x04},
{0x015A, 1, 0x0E},
{0x015B, 1, 0x18},
{0x015C, 1, 0x0E},
{0x015D, 1, 0x27},
{0x015E, 1, 0x0E},
{0x015F, 1, 0x32},
{0x0160, 1, 0x0E},
{0x0161, 1, 0x3D},
{0x0162, 1, 0x0E},
{0x0163, 1, 0x4A},
{0x0164, 1, 0x0E},
{0x0165, 1, 0x5D},
{0x0166, 1, 0x0E},
{0x0167, 1, 0x70},
{0x0168, 1, 0x0E},
{0x0169, 1, 0x86},
{0x016A, 1, 0x0E},
{0x016B, 1, 0xA2},
{0x016C, 1, 0x0E},
{0x016D, 1, 0xC0},
{0x016E, 1, 0x0E},
{0x016F, 1, 0xE3},
{0x0170, 1, 0x0F},
{0x0171, 1, 0x08},
{0x0172, 1, 0x0F},
{0x0173, 1, 0x37},
{0x0174, 1, 0x0F},
{0x0175, 1, 0x65},
{0x0176, 1, 0x0F},
{0x0177, 1, 0x9C},
{0x0178, 1, 0x10},
{0x0179, 1, 0x5A},
};
#endif /* #ifndef __SP2541_BATTERY_H_ */
|