libpowermon 1.00
PowerMon Access Library
Loading...
Searching...
No Matches
powermon_config.h
1/* Copyright (C) 2020 - 2024, Thornwave Labs Inc
2 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5 * documentation files (the “Software”), to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user.
11 *
12 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16*/
17
18#ifndef _POWERMON_CONFIG_H
19#define _POWERMON_CONFIG_H
20
21
22#include <stdint.h>
23#include <stddef.h>
24
25
30{
31public:
32
33 enum MultiFunctionPinMode: uint32_t
34 {
35 MF_DATA = 0, //data stream
36 MF_TEMP = 1, //DS18B20 temperature sensor
37 MF_BUTTON = 2, //button input
38 MF_COMM = 3 //half duplex communication
39 };
40
41
42 enum FuelgaugeChemistry: uint32_t
43 {
44 FG_CHEM_LEAD_FLOODED = 0,
45 FG_CHEM_LEAD_AGM = 1,
46 FG_CHEM_LIFEPO = 2,
47 FG_CHEM_LIION = 3,
48 FG_CHEM_LIPOLY = 4,
49 };
50
51
52 enum LogMode: uint32_t
53 {
54 LOG_MODE_DISABLED = 0,
55 LOG_MODE_1_SEC = 1,
56 LOG_MODE_2_SEC = 2,
57 LOG_MODE_5_SEC = 3,
58 LOG_MODE_10_SEC = 4,
59 LOG_MODE_20_SEC = 5,
60 LOG_MODE_30_SEC = 6,
61 LOG_MODE_60_SEC = 7,
62 };
63
64
65 void setMfMode(MultiFunctionPinMode mode);
66 MultiFunctionPinMode getMfMode(void) const;
67
68 void setWiFiKeepAPOn(bool state);
69 bool getWiFiKeepAPOn(void) const;
70
71 void setEngineShuntVdropNom(uint8_t mv);
72 uint8_t getEngineShuntVdropNom(void) const;
73
74 void setEngineShuntCurrentNom(uint16_t amperes);
75 uint16_t getEngineShuntCurrentNom(void) const;
76
77 void setEngineShuntCurrentMax(uint16_t amperes);
78 uint16_t getEngineShuntCurrentMax(void) const;
79
80 void setEngineDisableV2(bool state);
81 bool getEngineDisableV2(void) const;
82
83 void setEngineCurrentSignFlip(bool state);
84 bool getEngineCurrentSignFlip(void) const;
85
86 void setEngineMeterVoltageSource(uint8_t source);
87 uint8_t getEngineMeterVoltageSource(void) const;
88
89 void setOcInitialState(bool state);
90 bool getOcInitialState(void) const;
91
92 void setOcInvertOutput(bool state);
93 bool getOcInvertOutput(void) const;
94
95 void setOcLatchRelayOn(bool state);
96 bool getOcLatchRelayOn(void) const;
97
98 void setOcConnectFilter(uint32_t filter_ms);
99 uint32_t getOcConnectFilter(void) const;
100
101 void setOcLvdEnable(bool state);
102 bool getOcLvdEnable(void) const;
103
104 void setOcLvdSource(uint8_t source);
105 uint8_t getOcLvdSource(void) const;
106
107 void setOcLvdDisconnectThreshold(float threshold);
108 float getOcLvdDisconnectThreshold(void) const;
109
110 void setOcLvdConnectThreshold(float threshold);
111 float getOcLvdConnectThreshold(void) const;
112
113 void setOcLvdDisconnectFilter(uint32_t filter_ms);
114 uint32_t getOcLvdDisconnectFilter(void) const;
115
116 void setOcHvdEnable(bool state);
117 bool getOcHvdEnable(void) const;
118
119 void setOcHvdSource(uint8_t source);
120 uint8_t getOcHvdSource(void) const;
121
122 void setOcHvdDisconnectThreshold(float threshold);
123 float getOcHvdDisconnectThreshold(void) const;
124
125 void setOcHvdConnectThreshold(float threshold);
126 float getOcHvdConnectThreshold(void) const;
127
128 void setOcHvdDisconnectFilter(uint32_t filter_ms);
129 uint32_t getOcHvdDisconnectFilter(void) const;
130
131 void setOcOcdEnable(bool state);
132 bool getOcOcdEnable(void) const;
133
134 void setOcOcdSource(uint8_t source);
135 uint8_t getOcOcdSource(void) const;
136
137 void setOcOcdTripThreshold(float threshold);
138 float getOcOcdTripThreshold(void) const;
139
140 void setOcOcdTripFilter(uint32_t filter_ms);
141 uint32_t getOcOcdTripFilter(void) const;
142
143 void setOcLtdEnable(bool state);
144 bool getOcLtdEnable(void) const;
145
146 void setOcLtdDisconnectThreshold(int8_t threshold);
147 int8_t getOcLtdDisconnectThreshold(void) const;
148
149 void setOcLtdConnectThreshold(int8_t threshold);
150 int8_t getOcLtdConnectThreshold(void) const;
151
152 void setOcLtdDisconnectFilter(uint32_t filter_ms);
153 uint32_t getOcLtdDisconnectFilter(void) const;
154
155 void setOcHtdEnable(bool state);
156 bool getOcHtdEnable(void) const;
157
158 void setOcHtdDisconnectThreshold(int8_t threshold);
159 int8_t getOcHtdDisconnectThreshold(void) const;
160
161 void setOcHtdConnectThreshold(int8_t threshold);
162 int8_t getOcHtdConnectThreshold(void) const;
163
164 void setOcHtdDisconnectFilter(uint32_t filter_ms);
165 uint32_t getOcHtdDisconnectFilter(void) const;
166
167 void setOcFgdConnectEnable(bool state);
168 bool getOcFgdConnectEnable(void) const;
169
170 void setOcFgdDisconnectEnable(bool state);
171 bool getOcFgdDisconnectEnable(void) const;
172
173 void setOcFgdConnectThreshold(uint8_t threshold);
174 uint8_t getOcFgdConnectThreshold(void) const;
175
176 void setOcFgdDisconnectThreshold(uint8_t threshold);
177 uint8_t getOcFgdDisconnectThreshold(void) const;
178
179 void setOcAutoOnTimer(uint32_t timer_sec);
180 uint32_t getOcAutoOnTimer(void) const;
181
182 void setOcAutoOffTimer(uint32_t timer_sec);
183 uint32_t getOcAutoOffTimer(void) const;
184
185 void setOcGenControlEnable(bool state);
186 bool getOcGenControlEnable(void) const;
187
188 void setOcGenVonEnable(bool state);
189 bool getOcGenVonEnable(void) const;
190
191 void setOcGenVoffEnable(bool state);
192 bool getOcGenVoffEnable(void) const;
193
194 void setOcGenSoconEnable(bool state);
195 bool getOcGenSoconEnable(void) const;
196
197 void setOcGenSocoffEnable(bool state);
198 bool getOcGenSocoffEnable(void) const;
199
200 void setOcGenVoltageSource(uint8_t source);
201 uint8_t getOcGenVoltageSource(void) const;
202
203 void setOcGenVonThreshold(float threshold);
204 float getOcGenVonThreshold(void) const;
205
206 void setOcGenVoffThreshold(float threshold);
207 float getOcGenVoffThreshold(void) const;
208
209 void setOcGenSoconThreshold(uint8_t threshold);
210 uint8_t getOcGenSoconThreshold(void) const;
211
212 void setOcGenSocoffThreshold(uint8_t threshold);
213 uint8_t getOcGenSocoffThreshold(void) const;
214
215 void setOcGenVonFilter(uint32_t filter_ms);
216 uint32_t getOcGenVonFilter(void) const;
217
218 void setOcGenTurnOffDelay(uint16_t delay_min);
219 uint16_t getOcGenTurnOffDelay(void) const;
220
221 void setOcLiFePOEnable(bool state);
222 bool getOcLiFePOEnable(void) const;
223
224 void setOcLiFePODesignCapacity(float capacity);
225 float getOcLiFePODesignCapacity(void) const;
226
227 void setOcLiFePOCellCount(uint8_t count);
228 uint8_t getOcLiFePOCellCount(void) const;
229
230 void setFgEnable(bool state);
231 bool getFgEnable(void) const;
232
233 void setFgChemistry(FuelgaugeChemistry chemistry);
234 FuelgaugeChemistry getFgChemistry(void) const;
235
236 void setFgCellCount(uint8_t count);
237 uint8_t getFgCellCount(void) const;
238
239 void setFgVoltageSource(uint8_t source);
240 uint8_t getFgVoltageSource(void) const;
241
242 void setFgDesignCapacity(float capacity);
243 float getFgDesignCapacity(void) const;
244
245 void setFgManualChargeDetectionEnable(bool state);
246 bool getFgManualChargeDetectionEnable(void) const;
247
248 void setFgSyncVoltageThreshold(float threshold);
249 float getFgSyncVoltageThreshold(void) const;
250
251 void setFgSyncCurrentThreshold(float threshold);
252 float getFgSyncCurrentThreshold(void) const;
253
254 void setFgSyncFilter(uint32_t filter_ms);
255 uint32_t getFgSyncFilter(void) const;
256
257 void setLogMode(LogMode mode);
258 LogMode getLogMode(void) const;
259
260private:
261 uint8_t mRawConfig[104] alignas(4);
262};
263
264
265#endif
PowermonConfig is a structure containing the PowerMon configuration.
Definition powermon_config.h:30