bq2429x_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Locha Inc
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef BQ2429X_PARAMS_H
20 #define BQ2429X_PARAMS_H
21 
22 #include "board.h"
23 #include "bq2429x.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /* I2C configuration */
30 #ifndef BQ2429X_PARAM_I2C
31 #define BQ2429X_PARAM_I2C I2C_DEV(0)
32 #endif
33 
34 /* Interrupt pin configuration */
35 #ifndef BQ2429X_PARAM_INT_PIN
36 #define BQ2429X_PARAM_INT_PIN GPIO_UNDEF
37 #endif
38 
39 /* Control pins */
40 #ifndef BQ2429X_PARAM_CE_PIN
41 #define BQ2429X_PARMA_CE_PIN GPIO_UNDEF
42 #endif
43 #ifndef BQ2429X_PARAM_OTG_PIN
44 #define BQ2429X_PARMA_OTG_PIN GPIO_UNDEF
45 #endif
46 
47 /* Input current/voltage */
48 #ifndef BQ2429X_PARAM_VLIM
49 #define BQ2429X_PARAM_VLIM BQ2429X_VLIM_4360
50 #endif
51 #ifndef BQ2429X_PARAM_ILIM
52 #define BQ2429X_PARAM_ILIM BQ2429X_ILIM_500
53 #endif
54 
55 /* Battery charge current/voltage */
56 #ifndef BQ2429X_PARAM_ICHG
57 #define BQ2429X_PARAM_ICHG BQ2429X_ICHG_512
58 #endif
59 #ifndef BQ2429X_PARAM_VREG
60 #define BQ2429X_PARAM_VREG BQ2429X_VREG_4208
61 #endif
62 
63 #if !IS_USED(MODULE_BQ2429X_INT)
64 
65 #ifndef BQ2429X_PARAMS
66 #define BQ2429X_PARAMS { \
67  .i2c = BQ2429X_PARAM_I2C, \
68  .ce_pin = BQ2429X_PARMA_CE_PIN, \
69  .otg_pin = BQ2429X_PARMA_OTG_PIN, \
70  .vlim = BQ2429X_PARAM_VLIM, \
71  .ilim = BQ2429X_PARAM_ILIM, \
72  .ichg = BQ2429X_PARAM_ICHG, \
73  .vreg = BQ2429X_PARAM_VREG, \
74  }
75 #endif
76 
77 #else /* !IS_USED(MODULE_BQ2429X_INT) */
78 
79 #ifndef BQ2429X_PARAMS
80 #define BQ2429X_PARAMS { \
81  .i2c = BQ2429X_PARAM_I2C, \
82  .int_pin = BQ2429X_PARAM_INT_PIN, \
83  .ce_pin = BQ2429X_PARMA_CE_PIN, \
84  .otg_pin = BQ2429X_PARMA_OTG_PIN, \
85  .vlim = BQ2429X_PARAM_VLIM, \
86  .ilim = BQ2429X_PARAM_ILIM, \
87  .ichg = BQ2429X_PARAM_ICHG, \
88  .vreg = BQ2429X_PARAM_VREG, \
89  }
90 #endif
91 
92 #endif /* !IS_USED(MODULE_BQ2429X_INT) */
93 
94 static bq2429x_params_t bq2429x_params[] = {
95  BQ2429X_PARAMS,
96 };
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* BQ2429X_PARAMS_H */
Device driver interface for the BQ2429x Single-Cell USB Charger.
BQ2429x device parameters.
Definition: bq2429x.h:243