amiro-os / modules / PowerManagement_1-1 / module.h @ 4e8e8462
History | View | Annotate | Download (31.061 KB)
1 | e545e620 | Thomas Schöpping | /*
|
---|---|---|---|
2 | AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
||
3 | 96621a83 | Thomas Schöpping | Copyright (C) 2016..2020 Thomas Schöpping et al.
|
4 | e545e620 | Thomas Schöpping | |
5 | This program is free software: you can redistribute it and/or modify
|
||
6 | it under the terms of the GNU General Public License as published by
|
||
7 | the Free Software Foundation, either version 3 of the License, or
|
||
8 | (at your option) any later version.
|
||
9 | |||
10 | This program is distributed in the hope that it will be useful,
|
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | GNU General Public License for more details.
|
||
14 | |||
15 | You should have received a copy of the GNU General Public License
|
||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
17 | */
|
||
18 | |||
19 | 53710ca3 | Marc Rothmann | /**
|
20 | acc97cbf | Thomas Schöpping | * @file
|
21 | 53710ca3 | Marc Rothmann | * @brief Structures and constant for the PowerManagement module.
|
22 | *
|
||
23 | * @addtogroup powermanagement_module
|
||
24 | * @{
|
||
25 | */
|
||
26 | |||
27 | 6ff06bbf | Thomas Schöpping | #ifndef AMIROOS_MODULE_H
|
28 | #define AMIROOS_MODULE_H
|
||
29 | e545e620 | Thomas Schöpping | |
30 | e2d7143f | Thomas Schöpping | #include <amiroos.h> |
31 | |||
32 | e545e620 | Thomas Schöpping | /*===========================================================================*/
|
33 | /**
|
||
34 | * @name Module specific functions
|
||
35 | * @{
|
||
36 | */
|
||
37 | /*===========================================================================*/
|
||
38 | |||
39 | 1c1b3372 | Thomas Schöpping | /**
|
40 | e545e620 | Thomas Schöpping | * @brief Makro to store data in the core coupled memory (ccm).
|
41 | * Example:
|
||
42 | * int compute_buffer[128] CCM_RAM;
|
||
43 | *
|
||
44 | * @note The ccm is not connected to any bus system.
|
||
45 | */
|
||
46 | 1c1b3372 | Thomas Schöpping | #define CCM_RAM(...) __attribute__((section(".ram4"), ##__VA_ARGS__)) |
47 | e545e620 | Thomas Schöpping | |
48 | 1c1b3372 | Thomas Schöpping | /**
|
49 | e545e620 | Thomas Schöpping | * @brief Makro to store data in the ethernet memory (eth).
|
50 | * Example:
|
||
51 | * int dma_buffer[128] ETH_RAM;
|
||
52 | *
|
||
53 | * @note The eth is a dedicated memory block with its own DMA controller.
|
||
54 | */
|
||
55 | 1c1b3372 | Thomas Schöpping | #define ETH_RAM(...) __attribute__((section(".ram2"), ##__VA_ARGS__)) |
56 | e545e620 | Thomas Schöpping | |
57 | 1c1b3372 | Thomas Schöpping | /**
|
58 | e545e620 | Thomas Schöpping | * @brief Makro to store data in the backup memory (bckp).
|
59 | * Example:
|
||
60 | * int backup_buffer[128] BCKP_RAM;
|
||
61 | *
|
||
62 | * @note The eth is a dedicated memory block with its own DMA controller.
|
||
63 | */
|
||
64 | 1c1b3372 | Thomas Schöpping | #define BCKP_RAM(...) __attribute__((section(".ram5"), ##__VA_ARGS__)) |
65 | e545e620 | Thomas Schöpping | |
66 | /** @} */
|
||
67 | |||
68 | /*===========================================================================*/
|
||
69 | /**
|
||
70 | * @name ChibiOS/HAL configuration
|
||
71 | * @{
|
||
72 | */
|
||
73 | /*===========================================================================*/
|
||
74 | |||
75 | /**
|
||
76 | * @brief ADC driver for reading the system voltage.
|
||
77 | */
|
||
78 | #define MODULE_HAL_ADC_VSYS ADCD1
|
||
79 | |||
80 | /**
|
||
81 | * @brief Configuration for the ADC.
|
||
82 | */
|
||
83 | extern ADCConversionGroup moduleHalAdcVsysConversionGroup;
|
||
84 | |||
85 | /**
|
||
86 | * @brief CAN driver to use.
|
||
87 | */
|
||
88 | #define MODULE_HAL_CAN CAND1
|
||
89 | |||
90 | /**
|
||
91 | * @brief Configuration for the CAN driver.
|
||
92 | */
|
||
93 | extern CANConfig moduleHalCanConfig;
|
||
94 | |||
95 | /**
|
||
96 | 8be006e0 | Thomas Schöpping | * @brief I2C driver to access the sensor ring, power monitors for VIO1.8 and VIO3.3, and fuel gauge (rear battery).
|
97 | * @details Depending on the attached sensor ring, the devices connected to this bus vary:
|
||
98 | * ProximitySensor:
|
||
99 | * - I2C multiplexer (PCA9544A)
|
||
100 | * - proximity sensors (VCNL4020) #1 - #4
|
||
101 | * DistanceSensor (VL53L0X):
|
||
102 | * TODO
|
||
103 | * DistanceSensor (VL53L1X):
|
||
104 | * TODO
|
||
105 | */
|
||
106 | #define MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR I2CD1
|
||
107 | |||
108 | /**
|
||
109 | * @brief Configuration for the sensor ring, power monitors for VIO1.8 and VIO3.3, and fuel gauge (rear battery) I2C driver.
|
||
110 | * @details Depending on the attached sensor ring, the devices connected to this bus vary:
|
||
111 | * ProximitySensor:
|
||
112 | * - I2C multiplexer (PCA9544A)
|
||
113 | * - proximity sensors (VCNL4020) #1 - #4
|
||
114 | * DistanceSensor (VL53L0X):
|
||
115 | * TODO
|
||
116 | * DistanceSensor (VL53L1X):
|
||
117 | * TODO
|
||
118 | */
|
||
119 | extern I2CConfig moduleHalI2cSrPm18Pm33GaugeRearConfig;
|
||
120 | |||
121 | /**
|
||
122 | * @brief I2C driver to access the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery).
|
||
123 | * @details Depending on the attached sensor ring, the devices connected to this bus vary:
|
||
124 | * ProximitySensor:
|
||
125 | * - I2C multiplexer (PCA9544A)
|
||
126 | * - proximity sensors (VCNL4020) #1 - #4
|
||
127 | * - touch sensor (MPR121)
|
||
128 | * DistanceSensor (VL53L0X):
|
||
129 | * TODO
|
||
130 | * DistanceSensor (VL53L1X):
|
||
131 | * TODO
|
||
132 | */
|
||
133 | #define MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT I2CD2
|
||
134 | |||
135 | /**
|
||
136 | * @brief Configuration for the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery) I2C driver.
|
||
137 | * @details Depending on the attached sensor ring, the devices connected to this bus vary:
|
||
138 | * ProximitySensor:
|
||
139 | * - I2C multiplexer (PCA9544A)
|
||
140 | * - proximity sensors (VCNL4020) #1 - #4
|
||
141 | * - touch sensor (MPR121)
|
||
142 | * DistanceSensor (VL53L0X):
|
||
143 | * TODO
|
||
144 | * DistanceSensor (VL53L1X):
|
||
145 | * TODO
|
||
146 | */
|
||
147 | extern I2CConfig moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig;
|
||
148 | e545e620 | Thomas Schöpping | |
149 | /**
|
||
150 | * @brief PWM driver for the buzzer.
|
||
151 | */
|
||
152 | #define MODULE_HAL_PWM_BUZZER PWMD3
|
||
153 | |||
154 | /**
|
||
155 | * @brief Configuration of the PWM driver.
|
||
156 | */
|
||
157 | extern PWMConfig moduleHalPwmBuzzerConfig;
|
||
158 | |||
159 | /**
|
||
160 | 243fb4e2 | Thomas Schöpping | * @brief PWM channel for the buzzer.
|
161 | e545e620 | Thomas Schöpping | */
|
162 | #define MODULE_HAL_PWM_BUZZER_CHANNEL 1 |
||
163 | |||
164 | /**
|
||
165 | * @brief Serial driver of the programmer interface.
|
||
166 | */
|
||
167 | #define MODULE_HAL_PROGIF SD1
|
||
168 | |||
169 | /**
|
||
170 | * @brief Configuration for the programmer serial interface driver.
|
||
171 | */
|
||
172 | extern SerialConfig moduleHalProgIfConfig;
|
||
173 | |||
174 | 8399aeae | Thomas Schöpping | /**
|
175 | * @brief Real-Time Clock driver.
|
||
176 | */
|
||
177 | #define MODULE_HAL_RTC RTCD1
|
||
178 | |||
179 | e545e620 | Thomas Schöpping | /** @} */
|
180 | |||
181 | /*===========================================================================*/
|
||
182 | /**
|
||
183 | * @name GPIO definitions
|
||
184 | * @{
|
||
185 | */
|
||
186 | /*===========================================================================*/
|
||
187 | |||
188 | /**
|
||
189 | * @brief SYS_REG_EN output signal GPIO.
|
||
190 | */
|
||
191 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysRegEn;
|
192 | e545e620 | Thomas Schöpping | |
193 | /**
|
||
194 | * @brief IR_INT1 input signal GPIO.
|
||
195 | */
|
||
196 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioIrInt1;
|
197 | e545e620 | Thomas Schöpping | |
198 | /**
|
||
199 | * @brief POWER_EN output signal GPIO.
|
||
200 | */
|
||
201 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioPowerEn;
|
202 | e545e620 | Thomas Schöpping | |
203 | /**
|
||
204 | * @brief SYS_UART_DN bidirectional signal GPIO.
|
||
205 | */
|
||
206 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysUartDn;
|
207 | e545e620 | Thomas Schöpping | |
208 | /**
|
||
209 | * @brief CHARGE_STAT2A input signal GPIO.
|
||
210 | */
|
||
211 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioChargeStat2A;
|
212 | e545e620 | Thomas Schöpping | |
213 | /**
|
||
214 | * @brief GAUGE_BATLOW2 input signal GPIO.
|
||
215 | */
|
||
216 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioGaugeBatLow2;
|
217 | e545e620 | Thomas Schöpping | |
218 | /**
|
||
219 | * @brief GAUGE_BATGD2 input signal GPIO.
|
||
220 | */
|
||
221 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioGaugeBatGd2;
|
222 | e545e620 | Thomas Schöpping | |
223 | /**
|
||
224 | * @brief LED output signal GPIO.
|
||
225 | */
|
||
226 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioLed;
|
227 | e545e620 | Thomas Schöpping | |
228 | /**
|
||
229 | * @brief SYS_UART_UP bidirectional signal GPIO.
|
||
230 | */
|
||
231 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysUartUp;
|
232 | e545e620 | Thomas Schöpping | |
233 | /**
|
||
234 | * @brief CHARGE_STAT1A input signal GPIO.
|
||
235 | */
|
||
236 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioChargeStat1A;
|
237 | e545e620 | Thomas Schöpping | |
238 | /**
|
||
239 | * @brief GAUGE_BATLOW1 input signal GPIO.
|
||
240 | */
|
||
241 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioGaugeBatLow1;
|
242 | e545e620 | Thomas Schöpping | |
243 | /**
|
||
244 | * @brief GAUGE_BATGD1 input signal GPIO.
|
||
245 | */
|
||
246 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioGaugeBatGd1;
|
247 | e545e620 | Thomas Schöpping | |
248 | /**
|
||
249 | 340f2bdf | Thomas Schöpping | * @brief CHARGE_EN1 output signal GPIO.
|
250 | e545e620 | Thomas Schöpping | */
|
251 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioChargeEn1;
|
252 | e545e620 | Thomas Schöpping | |
253 | /**
|
||
254 | * @brief IR_INT2 input signal GPIO.
|
||
255 | */
|
||
256 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioIrInt2;
|
257 | e545e620 | Thomas Schöpping | |
258 | /**
|
||
259 | * @brief TOUCH_INT input signal GPIO.
|
||
260 | */
|
||
261 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioTouchInt;
|
262 | e545e620 | Thomas Schöpping | |
263 | /**
|
||
264 | * @brief SYS_DONE input signal GPIO.
|
||
265 | */
|
||
266 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysDone;
|
267 | e545e620 | Thomas Schöpping | |
268 | /**
|
||
269 | * @brief SYS_PROG output signal GPIO.
|
||
270 | */
|
||
271 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysProg;
|
272 | e545e620 | Thomas Schöpping | |
273 | /**
|
||
274 | * @brief PATH_DC input signal GPIO.
|
||
275 | */
|
||
276 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioPathDc;
|
277 | e545e620 | Thomas Schöpping | |
278 | /**
|
||
279 | * @brief SYS_SPI_DIR bidirectional signal GPIO.
|
||
280 | */
|
||
281 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysSpiDir;
|
282 | e545e620 | Thomas Schöpping | |
283 | /**
|
||
284 | * @brief SYS_SYNC bidirectional signal GPIO.
|
||
285 | */
|
||
286 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysSync;
|
287 | e545e620 | Thomas Schöpping | |
288 | /**
|
||
289 | * @brief SYS_PD bidirectional signal GPIO.
|
||
290 | */
|
||
291 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysPd;
|
292 | e545e620 | Thomas Schöpping | |
293 | /**
|
||
294 | * @brief SYS_WARMRST bidirectional signal GPIO.
|
||
295 | */
|
||
296 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioSysWarmrst;
|
297 | e545e620 | Thomas Schöpping | |
298 | /**
|
||
299 | * @brief BT_RST output signal GPIO.
|
||
300 | */
|
||
301 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioBtRst;
|
302 | e545e620 | Thomas Schöpping | |
303 | /**
|
||
304 | * @brief CHARGE_EN2 output signal GPIO.
|
||
305 | */
|
||
306 | acc97cbf | Thomas Schöpping | extern ROMCONST apalControlGpio_t moduleGpioChargeEn2;
|
307 | e545e620 | Thomas Schöpping | |
308 | /** @} */
|
||
309 | |||
310 | /*===========================================================================*/
|
||
311 | /**
|
||
312 | * @name AMiRo-OS core configurations
|
||
313 | * @{
|
||
314 | */
|
||
315 | /*===========================================================================*/
|
||
316 | |||
317 | /**
|
||
318 | * @brief Event flag to be set on a IR_INT1 / CHARGE_STAT1A interrupt.
|
||
319 | */
|
||
320 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_IRINT1 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT1_N))
|
321 | e545e620 | Thomas Schöpping | |
322 | /**
|
||
323 | * @brief Event flag to be set on a GAUGE_BATLOW1 interrupt.
|
||
324 | */
|
||
325 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_GAUGEBATLOW1 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW1))
|
326 | e545e620 | Thomas Schöpping | |
327 | /**
|
||
328 | * @brief Event flag to be set on a GAUGE_BATGD1 interrupt.
|
||
329 | */
|
||
330 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_GAUGEBATGD1 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD1_N))
|
331 | e545e620 | Thomas Schöpping | |
332 | /**
|
||
333 | * @brief Event flag to be set on a SYS_UART_DN interrupt.
|
||
334 | */
|
||
335 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSUARTDN AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
336 | e545e620 | Thomas Schöpping | |
337 | /**
|
||
338 | * @brief Event flag to be set on a IR_INT2 / CHARGE_STAT2A interrupt.
|
||
339 | */
|
||
340 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_IRINT2 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT2_N))
|
341 | e545e620 | Thomas Schöpping | |
342 | /**
|
||
343 | * @brief Event flag to be set on a TOUCH_INT interrupt.
|
||
344 | */
|
||
345 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_TOUCHINT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_TOUCH_INT_N))
|
346 | e545e620 | Thomas Schöpping | |
347 | /**
|
||
348 | * @brief Event flag to be set on a GAUGE_BATLOW2 interrupt.
|
||
349 | */
|
||
350 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_GAUGEBATLOW2 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW2))
|
351 | e545e620 | Thomas Schöpping | |
352 | /**
|
||
353 | * @brief Event flag to be set on a GAUGE_BATGD2 interrupt.
|
||
354 | */
|
||
355 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_GAUGEBATGD2 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD2_N))
|
356 | e545e620 | Thomas Schöpping | |
357 | /**
|
||
358 | * @brief Event flag to be set on a PATH_DC interrupt.
|
||
359 | */
|
||
360 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_PATHDC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_PATH_DC))
|
361 | e545e620 | Thomas Schöpping | |
362 | /**
|
||
363 | * @brief Event flag to be set on a SYS_SPI_DIR interrupt.
|
||
364 | */
|
||
365 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSSPIDIR AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_SPI_DIR))
|
366 | e545e620 | Thomas Schöpping | |
367 | /**
|
||
368 | * @brief Event flag to be set on a SYS_SYNC interrupt.
|
||
369 | */
|
||
370 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSSYNC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
371 | e545e620 | Thomas Schöpping | |
372 | /**
|
||
373 | * @brief Event flag to be set on a SYS_PD interrupt.
|
||
374 | */
|
||
375 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSPD AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
376 | e545e620 | Thomas Schöpping | |
377 | /**
|
||
378 | * @brief Event flag to be set on a SYS_WARMRST interrupt.
|
||
379 | */
|
||
380 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSWARMRST AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
|
381 | e545e620 | Thomas Schöpping | |
382 | /**
|
||
383 | * @brief Event flag to be set on a SYS_UART_UP interrupt.
|
||
384 | */
|
||
385 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_SYSUARTUP AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
386 | e545e620 | Thomas Schöpping | |
387 | cda14729 | Thomas Schöpping | #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
388 | e545e620 | Thomas Schöpping | /**
|
389 | * @brief Shell prompt text.
|
||
390 | */
|
||
391 | acc97cbf | Thomas Schöpping | extern ROMCONST char* moduleShellPrompt; |
392 | cda14729 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) */ |
393 | e545e620 | Thomas Schöpping | |
394 | /**
|
||
395 | 1e5f7648 | Thomas Schöpping | * @brief Interrupt initialization macro.
|
396 | */
|
||
397 | #define MODULE_INIT_INTERRUPTS() { \
|
||
398 | /* IR_INT1 */ \
|
||
399 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioIrInt1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt1.gpio->line); \ |
400 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioIrInt1.gpio->line, APAL2CH_EDGE(moduleGpioIrInt1.meta.edge)); \ |
401 | 1e5f7648 | Thomas Schöpping | /* GAUGE_BATLOW2 */ \
|
402 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioGaugeBatLow2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatLow2.gpio->line); \ |
403 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioGaugeBatLow2.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatLow2.meta.edge)); \ |
404 | 1e5f7648 | Thomas Schöpping | /* GAUGE_BATGD2 */ \
|
405 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioGaugeBatGd2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatGd2.gpio->line); \ |
406 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioGaugeBatGd2.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatGd2.meta.edge)); \ |
407 | 1e5f7648 | Thomas Schöpping | /* GAUGE_BATLOW1 */ \
|
408 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioGaugeBatLow1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatLow1.gpio->line); \ |
409 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioGaugeBatLow1.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatLow1.meta.edge)); \ |
410 | 1e5f7648 | Thomas Schöpping | /* GAUGE_BATGD1 */ \
|
411 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioGaugeBatGd1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatGd1.gpio->line); \ |
412 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioGaugeBatGd1.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatGd1.meta.edge)); \ |
413 | 05b882c0 | Thomas Schöpping | /* IR_INT2 */ \
|
414 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioIrInt2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt2.gpio->line); \ |
415 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioIrInt2.gpio->line, APAL2CH_EDGE(moduleGpioIrInt2.meta.edge)); \ |
416 | 1e5f7648 | Thomas Schöpping | /* TOUCH_INT */ \
|
417 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioTouchInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioTouchInt.gpio->line); \ |
418 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioTouchInt.gpio->line, APAL2CH_EDGE(moduleGpioTouchInt.meta.edge)); \ |
419 | 1e5f7648 | Thomas Schöpping | /* PATH_DC */ \
|
420 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioPathDc.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioPathDc.gpio->line); \ |
421 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioPathDc.gpio->line, APAL2CH_EDGE(moduleGpioPathDc.meta.edge)); \ |
422 | 1e5f7648 | Thomas Schöpping | /* SYS_SPI_DIR */ \
|
423 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioSysSpiDir.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysSpiDir.gpio->line); \ |
424 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioSysSpiDir.gpio->line, APAL2CH_EDGE(moduleGpioSysSpiDir.meta.edge)); \ |
425 | 1e5f7648 | Thomas Schöpping | /* SYS_WARMRST */ \
|
426 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysWarmrst.gpio->line); \ |
427 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioSysWarmrst.gpio->line, APAL2CH_EDGE(moduleGpioSysWarmrst.meta.edge)); \ |
428 | 1e5f7648 | Thomas Schöpping | } |
429 | |||
430 | /**
|
||
431 | 4c72a54c | Thomas Schöpping | * @brief Test initialization hook.
|
432 | e545e620 | Thomas Schöpping | */
|
433 | #define MODULE_INIT_TESTS() { \
|
||
434 | cda14729 | Thomas Schöpping | /* add test commands to shell */ \
|
435 | 4c72a54c | Thomas Schöpping | aosShellAddCommand(&aos.shell, &moduleTestAdcShellCmd); \ |
436 | aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
||
437 | aosShellAddCommand(&aos.shell, &moduleTestBq241xxShellCmd); \ |
||
438 | aosShellAddCommand(&aos.shell, &moduleTestBq27500ShellCmd); \ |
||
439 | aosShellAddCommand(&aos.shell, &moduleTestBq27500Bq241xxShellCmd); \ |
||
440 | aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd); \ |
||
441 | aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd); \ |
||
442 | aosShellAddCommand(&aos.shell, &moduleTestPkxxxexxxShellCmd); \ |
||
443 | aosShellAddCommand(&aos.shell, &moduleTestTps6211xShellCmd); \ |
||
444 | aosShellAddCommand(&aos.shell, &moduleTestTps6211xIna219ShellCmd); \ |
||
445 | 8be006e0 | Thomas Schöpping | MODULE_INIT_TEST_SENSORRING(); \ |
446 | 4c72a54c | Thomas Schöpping | aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd); \ |
447 | e545e620 | Thomas Schöpping | } |
448 | 8be006e0 | Thomas Schöpping | #if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
|
449 | #define MODULE_INIT_TEST_SENSORRING() { \
|
||
450 | 4c72a54c | Thomas Schöpping | aosShellAddCommand(&aos.shell, &moduleTestPca9544aShellCmd); \ |
451 | aosShellAddCommand(&aos.shell, &moduleTestMpr121ShellCmd); \ |
||
452 | aosShellAddCommand(&aos.shell, &moduleTestVcnl4020ShellCmd); \ |
||
453 | 8be006e0 | Thomas Schöpping | } |
454 | #elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
|
||
455 | #define MODULE_INIT_TEST_SENSORRING() { \
|
||
456 | 4c72a54c | Thomas Schöpping | aosShellAddCommand(&aos.shell, &moduleTestPcal6524ShellCmd); \ |
457 | aosShellAddCommand(&aos.shell, &moduleTestAt42qt1050ShellCmd); \ |
||
458 | 8be006e0 | Thomas Schöpping | } |
459 | #elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
|
||
460 | #define MODULE_INIT_TEST_SENSORRING() { \
|
||
461 | 4c72a54c | Thomas Schöpping | aosShellAddCommand(&aos.shell, &moduleTestPcal6524ShellCmd); \ |
462 | aosShellAddCommand(&aos.shell, &moduleTestAt42qt1050ShellCmd); \ |
||
463 | 8be006e0 | Thomas Schöpping | } |
464 | 7de0cc90 | Thomas Schöpping | #else /* (BOARD_SENSORRING == ?) */ |
465 | 8be006e0 | Thomas Schöpping | #define MODULE_INIT_TEST_SENSORRING() {}
|
466 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == ?) */ |
467 | e545e620 | Thomas Schöpping | |
468 | /**
|
||
469 | * @brief Periphery communication interfaces initialization hook.
|
||
470 | */
|
||
471 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF() { \
|
472 | MODULE_INIT_PERIPHERY_IF_SENSORRING(); \ |
||
473 | e545e620 | Thomas Schöpping | /* serial driver */ \
|
474 | sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
||
475 | /* I2C */ \
|
||
476 | 8be006e0 | Thomas Schöpping | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
477 | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
||
478 | moduleHalI2cSrPm18Pm33GaugeRearConfig.duty_cycle = (moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \
|
||
479 | i2cStart(&MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR, &moduleHalI2cSrPm18Pm33GaugeRearConfig); \ |
||
480 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
481 | ddf34c3d | Thomas Schöpping | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT24C01B_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT24C01B_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
482 | 8be006e0 | Thomas Schöpping | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
483 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.duty_cycle = (moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \
|
||
484 | i2cStart(&MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, &moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig); \ |
||
485 | e545e620 | Thomas Schöpping | /* ADC */ \
|
486 | adcStart(&MODULE_HAL_ADC_VSYS, NULL); \
|
||
487 | /* PWM */ \
|
||
488 | pwmStart(&MODULE_HAL_PWM_BUZZER, &moduleHalPwmBuzzerConfig); \ |
||
489 | moduleHalPwmBuzzerConfig.frequency = MODULE_HAL_PWM_BUZZER.clock; \ |
||
490 | pwmStop(&MODULE_HAL_PWM_BUZZER); \ |
||
491 | ddf34c3d | Thomas Schöpping | moduleHalPwmBuzzerConfig.period = moduleHalPwmBuzzerConfig.frequency / PKxxxExxx_LLD_FREQUENCY_SPEC; \ |
492 | e545e620 | Thomas Schöpping | pwmStart(&MODULE_HAL_PWM_BUZZER, &moduleHalPwmBuzzerConfig); \ |
493 | cda14729 | Thomas Schöpping | /* CAN */ \
|
494 | canStart(&MODULE_HAL_CAN, &moduleHalCanConfig); \ |
||
495 | e545e620 | Thomas Schöpping | } |
496 | 8be006e0 | Thomas Schöpping | #if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
|
497 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
498 | 8be006e0 | Thomas Schöpping | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
499 | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
||
500 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
501 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
502 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (MPR121_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? MPR121_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
503 | } |
||
504 | #elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
|
||
505 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
506 | bffb3465 | Thomas Schöpping | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
507 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
508 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT42QT1050_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT42QT1050_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
509 | 8be006e0 | Thomas Schöpping | } |
510 | #elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
|
||
511 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
512 | bffb3465 | Thomas Schöpping | moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
513 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
514 | moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT42QT1050_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT42QT1050_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
||
515 | 8be006e0 | Thomas Schöpping | } |
516 | 7de0cc90 | Thomas Schöpping | #else /* (BOARD_SENSORRING == ?) */ |
517 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF_SENSORRING() {}
|
518 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == ?) */ |
519 | e545e620 | Thomas Schöpping | |
520 | /**
|
||
521 | * @brief Periphery communication interface deinitialization hook.
|
||
522 | */
|
||
523 | 4c72a54c | Thomas Schöpping | #define MODULE_SHUTDOWN_PERIPHERY_IF() { \
|
524 | cda14729 | Thomas Schöpping | /* CAN */ \
|
525 | canStop(&MODULE_HAL_CAN); \ |
||
526 | e545e620 | Thomas Schöpping | /* PWM */ \
|
527 | pwmStop(&MODULE_HAL_PWM_BUZZER); \ |
||
528 | /* ADC */ \
|
||
529 | adcStop(&MODULE_HAL_ADC_VSYS); \ |
||
530 | /* I2C */ \
|
||
531 | 8be006e0 | Thomas Schöpping | i2cStop(&MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR); \ |
532 | i2cStop(&MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT); \ |
||
533 | e545e620 | Thomas Schöpping | /* don't stop the serial driver so messages can still be printed */ \
|
534 | } |
||
535 | |||
536 | 08d86900 | Thomas Schöpping | #define AMIROOS_CFG_SYSINFO_HOOK() { \
|
537 | _printSystemInfoLine(stream, "Built for Sensor Ring", SYSTEM_INFO_NAMEWIDTH, "%s", \ |
||
538 | (BOARD_SENSORRING == BOARD_NOSENSORRING) ? "none" : \
|
||
539 | (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) ? "ProximitySensor (VCNL4020)" : \
|
||
540 | (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) ? "DistanceSensor (VL53L0X)" : \
|
||
541 | (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) ? "DistanceSensor (VL53L1X)" : \
|
||
542 | "unknown"); \
|
||
543 | } |
||
544 | |||
545 | e545e620 | Thomas Schöpping | /** @} */
|
546 | |||
547 | /*===========================================================================*/
|
||
548 | /**
|
||
549 | 6b53f6bf | Thomas Schöpping | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
550 | * @{
|
||
551 | */
|
||
552 | /*===========================================================================*/
|
||
553 | |||
554 | c53ef0b1 | Thomas Schöpping | #define moduleSsspSignalPD() (&moduleGpioSysPd)
|
555 | #define moduleSsspEventflagPD() MODULE_OS_GPIOEVENTFLAG_SYSPD
|
||
556 | 933df08e | Thomas Schöpping | |
557 | c53ef0b1 | Thomas Schöpping | #define moduleSsspSignalS() (&moduleGpioSysSync)
|
558 | #define moduleSsspEventflagS() MODULE_OS_GPIOEVENTFLAG_SYSSYNC
|
||
559 | 6b53f6bf | Thomas Schöpping | |
560 | c53ef0b1 | Thomas Schöpping | #define moduleSsspSignalUP() (&moduleGpioSysUartUp)
|
561 | #define moduleSsspEventflagUP() MODULE_OS_GPIOEVENTFLAG_SYSUARTUP
|
||
562 | 933df08e | Thomas Schöpping | |
563 | c53ef0b1 | Thomas Schöpping | #define moduleSsspSignalDN() (&moduleGpioSysUartDn)
|
564 | #define moduleSsspEventflagDN() MODULE_OS_GPIOEVENTFLAG_SYSUARTDN
|
||
565 | cda14729 | Thomas Schöpping | |
566 | 6b53f6bf | Thomas Schöpping | /** @} */
|
567 | |||
568 | /*===========================================================================*/
|
||
569 | /**
|
||
570 | e545e620 | Thomas Schöpping | * @name Low-level drivers
|
571 | * @{
|
||
572 | */
|
||
573 | /*===========================================================================*/
|
||
574 | ddf34c3d | Thomas Schöpping | #include <alld_AT24C01B.h> |
575 | #include <alld_bq241xx.h> |
||
576 | e545e620 | Thomas Schöpping | #include <alld_bq27500.h> |
577 | ddf34c3d | Thomas Schöpping | #include <alld_INA219.h> |
578 | #include <alld_LED.h> |
||
579 | #include <alld_PKxxxExxx.h> |
||
580 | #include <alld_TPS6211x.h> |
||
581 | e545e620 | Thomas Schöpping | |
582 | /**
|
||
583 | * @brief EEPROM driver.
|
||
584 | */
|
||
585 | ddf34c3d | Thomas Schöpping | extern AT24C01BDriver moduleLldEeprom;
|
586 | e545e620 | Thomas Schöpping | |
587 | /**
|
||
588 | * @brief Battery charger (front battery) driver.
|
||
589 | */
|
||
590 | ddf34c3d | Thomas Schöpping | extern BQ241xxDriver moduleLldBatteryChargerFront;
|
591 | e545e620 | Thomas Schöpping | |
592 | /**
|
||
593 | * @brief Battery charger (rear battery) driver.
|
||
594 | */
|
||
595 | ddf34c3d | Thomas Schöpping | extern BQ241xxDriver moduleLldBatteryChargerRear;
|
596 | e545e620 | Thomas Schöpping | |
597 | /**
|
||
598 | * @brief Fuel gauge (front battery) driver.
|
||
599 | */
|
||
600 | extern BQ27500Driver moduleLldFuelGaugeFront;
|
||
601 | |||
602 | /**
|
||
603 | * @brief Fuel gauge (rear battery) driver.
|
||
604 | */
|
||
605 | extern BQ27500Driver moduleLldFuelGaugeRear;
|
||
606 | |||
607 | /**
|
||
608 | * @brief Power monitor (VDD) driver.
|
||
609 | */
|
||
610 | extern INA219Driver moduleLldPowerMonitorVdd;
|
||
611 | |||
612 | /**
|
||
613 | * @brief Power monitor (VIO 1.8) driver.
|
||
614 | */
|
||
615 | extern INA219Driver moduleLldPowerMonitorVio18;
|
||
616 | |||
617 | /**
|
||
618 | * @brief Power monitor (VIO 3.3) driver.
|
||
619 | */
|
||
620 | extern INA219Driver moduleLldPowerMonitorVio33;
|
||
621 | |||
622 | /**
|
||
623 | * @brief Power monitor (VSYS 4.2) driver.
|
||
624 | */
|
||
625 | extern INA219Driver moduleLldPowerMonitorVsys42;
|
||
626 | |||
627 | /**
|
||
628 | * @brief Power monitor (VIO 5.0) driver.
|
||
629 | */
|
||
630 | extern INA219Driver moduleLldPowerMonitorVio50;
|
||
631 | |||
632 | /**
|
||
633 | * @brief Status LED driver.
|
||
634 | */
|
||
635 | extern LEDDriver moduleLldStatusLed;
|
||
636 | |||
637 | /**
|
||
638 | 8be006e0 | Thomas Schöpping | * @brief Step down converter driver.
|
639 | ddf34c3d | Thomas Schöpping | * @note Although there multiple TPS6211x, those are completely identical from driver few (share the same signals).
|
640 | 8be006e0 | Thomas Schöpping | */
|
641 | ddf34c3d | Thomas Schöpping | extern TPS6211xDriver moduleLldStepDownConverter;
|
642 | 8be006e0 | Thomas Schöpping | |
643 | #if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
|
||
644 | |||
645 | ddf34c3d | Thomas Schöpping | #include <alld_MPR121.h> |
646 | #include <alld_PCA9544A.h> |
||
647 | #include <alld_VCNL4020.h> |
||
648 | 8be006e0 | Thomas Schöpping | |
649 | /**
|
||
650 | e545e620 | Thomas Schöpping | * @brief Touch sensor driver.
|
651 | */
|
||
652 | extern MPR121Driver moduleLldTouch;
|
||
653 | |||
654 | /**
|
||
655 | 8be006e0 | Thomas Schöpping | * @brief I2C multiplexer (I2C #1) driver.
|
656 | e545e620 | Thomas Schöpping | */
|
657 | extern PCA9544ADriver moduleLldI2cMultiplexer1;
|
||
658 | |||
659 | /**
|
||
660 | 8be006e0 | Thomas Schöpping | * @brief I2C multiplexer (I2C #2) driver.
|
661 | e545e620 | Thomas Schöpping | */
|
662 | extern PCA9544ADriver moduleLldI2cMultiplexer2;
|
||
663 | |||
664 | /**
|
||
665 | 8be006e0 | Thomas Schöpping | * @brief Proximity sensor (I2C #1) driver.
|
666 | e545e620 | Thomas Schöpping | */
|
667 | extern VCNL4020Driver moduleLldProximity1;
|
||
668 | |||
669 | /**
|
||
670 | 8be006e0 | Thomas Schöpping | * @brief Proximity sensor (I2C #2) driver.
|
671 | e545e620 | Thomas Schöpping | */
|
672 | extern VCNL4020Driver moduleLldProximity2;
|
||
673 | |||
674 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) */ |
675 | 8be006e0 | Thomas Schöpping | |
676 | #if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
|
||
677 | bffb3465 | Thomas Schöpping | |
678 | ddf34c3d | Thomas Schöpping | #include <alld_PCAL6524.h> |
679 | #include <alld_AT42QT1050.h> |
||
680 | bffb3465 | Thomas Schöpping | |
681 | /**
|
||
682 | * @brief GPIO extender (I2C #1) driver.
|
||
683 | */
|
||
684 | extern PCAL6524Driver moduleLldGpioExtender1;
|
||
685 | |||
686 | /**
|
||
687 | * @brief GPIO extender (I2C #2) driver.
|
||
688 | */
|
||
689 | extern PCAL6524Driver moduleLldGpioExtender2;
|
||
690 | |||
691 | /**
|
||
692 | * @brief Touch sensor driver.
|
||
693 | */
|
||
694 | extern AT42QT1050Driver moduleLldTouch;
|
||
695 | |||
696 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) */ |
697 | 8be006e0 | Thomas Schöpping | |
698 | #if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
|
||
699 | bffb3465 | Thomas Schöpping | |
700 | ddf34c3d | Thomas Schöpping | #include <alld_PCAL6524.h> |
701 | #include <alld_AT42QT1050.h> |
||
702 | bffb3465 | Thomas Schöpping | |
703 | /**
|
||
704 | * @brief GPIO extender (I2C #1) driver.
|
||
705 | */
|
||
706 | extern PCAL6524Driver moduleLldGpioExtender1;
|
||
707 | |||
708 | /**
|
||
709 | * @brief GPIO extender (I2C #2) driver.
|
||
710 | */
|
||
711 | extern PCAL6524Driver moduleLldGpioExtender2;
|
||
712 | |||
713 | /**
|
||
714 | * @brief Touch sensor driver.
|
||
715 | */
|
||
716 | extern AT42QT1050Driver moduleLldTouch;
|
||
717 | |||
718 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) */ |
719 | 8be006e0 | Thomas Schöpping | |
720 | e545e620 | Thomas Schöpping | /** @} */
|
721 | |||
722 | /*===========================================================================*/
|
||
723 | /**
|
||
724 | 4c72a54c | Thomas Schöpping | * @name Tests
|
725 | e545e620 | Thomas Schöpping | * @{
|
726 | */
|
||
727 | /*===========================================================================*/
|
||
728 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
729 | |||
730 | /**
|
||
731 | 4c72a54c | Thomas Schöpping | * @brief ADC test command.
|
732 | e545e620 | Thomas Schöpping | */
|
733 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAdcShellCmd;
|
734 | e545e620 | Thomas Schöpping | |
735 | /**
|
||
736 | 4c72a54c | Thomas Schöpping | * @brief AT24C01BN-SH-B (EEPROM) test command.
|
737 | e545e620 | Thomas Schöpping | */
|
738 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAt24c01bShellCmd;
|
739 | e545e620 | Thomas Schöpping | |
740 | /**
|
||
741 | 4c72a54c | Thomas Schöpping | * @brief bq24103a (battery charger) test command.
|
742 | e545e620 | Thomas Schöpping | */
|
743 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestBq241xxShellCmd;
|
744 | e545e620 | Thomas Schöpping | |
745 | /**
|
||
746 | 4c72a54c | Thomas Schöpping | * @brief bq27500 (fuel gauge) test command.
|
747 | e545e620 | Thomas Schöpping | */
|
748 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestBq27500ShellCmd;
|
749 | e545e620 | Thomas Schöpping | |
750 | /**
|
||
751 | 4c72a54c | Thomas Schöpping | * @brief bq27500 (fuel gauge) in combination with bq24103a (battery charger) test command.
|
752 | e545e620 | Thomas Schöpping | */
|
753 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestBq27500Bq241xxShellCmd;
|
754 | e545e620 | Thomas Schöpping | |
755 | /**
|
||
756 | 4c72a54c | Thomas Schöpping | * @brief INA219 (power monitor) test command.
|
757 | e545e620 | Thomas Schöpping | */
|
758 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestIna219ShellCmd;
|
759 | e545e620 | Thomas Schöpping | |
760 | /**
|
||
761 | 4c72a54c | Thomas Schöpping | * @brief Status LED test command.
|
762 | e545e620 | Thomas Schöpping | */
|
763 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestLedShellCmd;
|
764 | e545e620 | Thomas Schöpping | |
765 | /**
|
||
766 | 4c72a54c | Thomas Schöpping | * @brief PKLCS1212E4001 (buzzer) test command.
|
767 | e545e620 | Thomas Schöpping | */
|
768 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestPkxxxexxxShellCmd;
|
769 | e545e620 | Thomas Schöpping | |
770 | /**
|
||
771 | 4c72a54c | Thomas Schöpping | * @brief TPS62113 (step-down converter) test command.
|
772 | e545e620 | Thomas Schöpping | */
|
773 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestTps6211xShellCmd;
|
774 | e545e620 | Thomas Schöpping | |
775 | /**
|
||
776 | 4c72a54c | Thomas Schöpping | * @brief TPS62113 (step-sown converter) in combination with INA219 (power monitor) test command.
|
777 | e545e620 | Thomas Schöpping | */
|
778 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestTps6211xIna219ShellCmd;
|
779 | e545e620 | Thomas Schöpping | |
780 | 8be006e0 | Thomas Schöpping | #if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
|
781 | |||
782 | /**
|
||
783 | 4c72a54c | Thomas Schöpping | * @brief MPR121 (touch sensor) test command.
|
784 | 8be006e0 | Thomas Schöpping | */
|
785 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestMpr121ShellCmd;
|
786 | 8be006e0 | Thomas Schöpping | |
787 | /**
|
||
788 | 4c72a54c | Thomas Schöpping | * @brief PCA9544A (I2C multiplexer) test command.
|
789 | 8be006e0 | Thomas Schöpping | */
|
790 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestPca9544aShellCmd;
|
791 | 8be006e0 | Thomas Schöpping | |
792 | e545e620 | Thomas Schöpping | /**
|
793 | 4c72a54c | Thomas Schöpping | * @brief VCNL4020 (proximity sensor) test command.
|
794 | e545e620 | Thomas Schöpping | */
|
795 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestVcnl4020ShellCmd;
|
796 | e545e620 | Thomas Schöpping | |
797 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) */ |
798 | 8be006e0 | Thomas Schöpping | |
799 | #if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
|
||
800 | bffb3465 | Thomas Schöpping | |
801 | /**
|
||
802 | 4c72a54c | Thomas Schöpping | * @brief PCAL6524 (GPIO extender) test command.
|
803 | bffb3465 | Thomas Schöpping | */
|
804 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestPcal6524ShellCmd;
|
805 | bffb3465 | Thomas Schöpping | |
806 | /**
|
||
807 | 4c72a54c | Thomas Schöpping | * @brief AT42QT1050 (touch sensor) test command.
|
808 | bffb3465 | Thomas Schöpping | */
|
809 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAt42qt1050ShellCmd;
|
810 | bffb3465 | Thomas Schöpping | |
811 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) */ |
812 | 8be006e0 | Thomas Schöpping | |
813 | #if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
|
||
814 | bffb3465 | Thomas Schöpping | |
815 | /**
|
||
816 | 4c72a54c | Thomas Schöpping | * @brief PCAL6524 (GPIO extender) test command.
|
817 | bffb3465 | Thomas Schöpping | */
|
818 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestPcal6524ShellCmd;
|
819 | bffb3465 | Thomas Schöpping | |
820 | /**
|
||
821 | 4c72a54c | Thomas Schöpping | * @brief AT42QT1050 (touch sensor) test command.
|
822 | bffb3465 | Thomas Schöpping | */
|
823 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAt42qt1050ShellCmd;
|
824 | bffb3465 | Thomas Schöpping | |
825 | 7de0cc90 | Thomas Schöpping | #endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) */ |
826 | 8be006e0 | Thomas Schöpping | |
827 | 4c72a54c | Thomas Schöpping | /**
|
828 | * @brief Entire module test command.
|
||
829 | */
|
||
830 | extern aos_shellcommand_t moduleTestAllShellCmd;
|
||
831 | |||
832 | 7de0cc90 | Thomas Schöpping | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
833 | e545e620 | Thomas Schöpping | |
834 | /** @} */
|
||
835 | |||
836 | 6ff06bbf | Thomas Schöpping | #endif /* AMIROOS_MODULE_H */ |
837 | 53710ca3 | Marc Rothmann | |
838 | /** @} */ |