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 
9 #pragma once
10 
21 #include "board.h"
22 #include "bq2429x.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* I2C configuration */
29 #ifndef BQ2429X_PARAM_I2C
30 #define BQ2429X_PARAM_I2C I2C_DEV(0)
31 #endif
32 
33 /* Interrupt pin configuration */
34 #ifndef BQ2429X_PARAM_INT_PIN
35 #define BQ2429X_PARAM_INT_PIN GPIO_UNDEF
36 #endif
37 
38 /* Control pins */
39 #ifndef BQ2429X_PARAM_CE_PIN
40 #define BQ2429X_PARMA_CE_PIN GPIO_UNDEF
41 #endif
42 #ifndef BQ2429X_PARAM_OTG_PIN
43 #define BQ2429X_PARMA_OTG_PIN GPIO_UNDEF
44 #endif
45 
46 /* Input current/voltage */
47 #ifndef BQ2429X_PARAM_VLIM
48 #define BQ2429X_PARAM_VLIM BQ2429X_VLIM_4360
49 #endif
50 #ifndef BQ2429X_PARAM_ILIM
51 #define BQ2429X_PARAM_ILIM BQ2429X_ILIM_500
52 #endif
53 
54 /* Battery charge current/voltage */
55 #ifndef BQ2429X_PARAM_ICHG
56 #define BQ2429X_PARAM_ICHG BQ2429X_ICHG_512
57 #endif
58 #ifndef BQ2429X_PARAM_VREG
59 #define BQ2429X_PARAM_VREG BQ2429X_VREG_4208
60 #endif
61 
62 #if !IS_USED(MODULE_BQ2429X_INT)
63 
64 #ifndef BQ2429X_PARAMS
65 #define BQ2429X_PARAMS { \
66  .i2c = BQ2429X_PARAM_I2C, \
67  .ce_pin = BQ2429X_PARMA_CE_PIN, \
68  .otg_pin = BQ2429X_PARMA_OTG_PIN, \
69  .vlim = BQ2429X_PARAM_VLIM, \
70  .ilim = BQ2429X_PARAM_ILIM, \
71  .ichg = BQ2429X_PARAM_ICHG, \
72  .vreg = BQ2429X_PARAM_VREG, \
73  }
74 #endif
75 
76 #else /* !IS_USED(MODULE_BQ2429X_INT) */
77 
78 #ifndef BQ2429X_PARAMS
79 #define BQ2429X_PARAMS { \
80  .i2c = BQ2429X_PARAM_I2C, \
81  .int_pin = BQ2429X_PARAM_INT_PIN, \
82  .ce_pin = BQ2429X_PARMA_CE_PIN, \
83  .otg_pin = BQ2429X_PARMA_OTG_PIN, \
84  .vlim = BQ2429X_PARAM_VLIM, \
85  .ilim = BQ2429X_PARAM_ILIM, \
86  .ichg = BQ2429X_PARAM_ICHG, \
87  .vreg = BQ2429X_PARAM_VREG, \
88  }
89 #endif
90 
91 #endif /* !IS_USED(MODULE_BQ2429X_INT) */
92 
93 static bq2429x_params_t bq2429x_params[] = {
94  BQ2429X_PARAMS,
95 };
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
Device driver interface for the BQ2429x Single-Cell USB Charger.
BQ2429x device parameters.
Definition: bq2429x.h:242