pca9685_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gunar Schorcht
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 
17 #ifndef PCA9685_PARAMS_H
18 #define PCA9685_PARAMS_H
19 
20 #include "board.h"
21 #include "saul_reg.h"
22 #include "pca9685.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #ifndef PCA9685_PARAM_DEV
33 
34 #define PCA9685_PARAM_DEV I2C_DEV(0)
35 #endif
36 
37 #ifndef PCA9685_PARAM_ADDR
38 
39 #define PCA9685_PARAM_ADDR (PCA9685_I2C_BASE_ADDR + 0)
40 #endif
41 
42 #ifndef PCA9685_PARAM_INV
43 
44 #define PCA9685_PARAM_INV (false)
45 #endif
46 
47 #ifndef PCA9685_PARAM_MODE
48 
49 #define PCA9685_PARAM_MODE (PWM_LEFT)
50 #endif
51 
52 #ifndef PCA9685_PARAM_FREQ
53 
54 #define PCA9685_PARAM_FREQ (100)
55 #endif
56 
57 #ifndef PCA9685_PARAM_RES
58 
59 #define PCA9685_PARAM_RES (4096)
60 #endif
61 
62 #ifndef PCA9685_PARAM_OE_PIN
63 
64 #define PCA9685_PARAM_OE_PIN (GPIO_UNDEF)
65 #endif
66 
67 #ifndef PCA9685_PARAM_EXT_FREQ
68 
69 #define PCA9685_PARAM_EXT_FREQ (0)
70 #endif
71 
72 #ifndef PCA9685_PARAM_OUT_DRV
73 
74 #define PCA9685_PARAM_OUT_DRV (PCA9685_TOTEM_POLE)
75 #endif
76 
77 #ifndef PCA9685_PARAM_OUT_NE
78 
79 #define PCA9685_PARAM_OUT_NE (PCA9685_OFF)
80 #endif
81 
82 #ifndef PCA9685_PARAMS
83 #define PCA9685_PARAMS { \
84  .i2c_dev = PCA9685_PARAM_DEV, \
85  .i2c_addr = PCA9685_PARAM_ADDR, \
86  .inv = PCA9685_PARAM_INV, \
87  .mode = PCA9685_PARAM_MODE, \
88  .freq = PCA9685_PARAM_FREQ, \
89  .res = PCA9685_PARAM_RES, \
90  .ext_freq = PCA9685_PARAM_EXT_FREQ, \
91  .oe_pin = PCA9685_PARAM_OE_PIN, \
92  .out_drv = PCA9685_PARAM_OUT_DRV, \
93  .out_ne = PCA9685_PARAM_OUT_NE, \
94  }
95 #endif /* PCA9685_PARAMS */
96 
97 #ifndef PCA9685_SAUL_PWM_PARAMS
98 
99 #define PCA9685_SAUL_PWM_PARAMS { \
100  .name = "PCA9685-0:0", \
101  .dev = 0, \
102  .channel = 0, \
103  .initial = (PCA9685_PARAM_RES >> 1), \
104  }, \
105  { \
106  .name = "PCA9685-0:1", \
107  .dev = 0, \
108  .channel = 1, \
109  .initial = (PCA9685_PARAM_RES >> 2), \
110  }, \
111  { \
112  .name = "PCA9685-0:1", \
113  .dev = 0, \
114  .channel = 2, \
115  .initial = (PCA9685_PARAM_RES >> 3), \
116  },
117 #endif /* PCA9685_PARAMS */
118 
124 {
125  PCA9685_PARAMS
126 };
127 
128 #if MODULE_SAUL || DOXYGEN
129 
133 {
135 };
136 #endif /* MODULE_SAUL || DOXYGEN */
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* PCA9685_PARAMS_H */
143 
pca9685_saul_pwm_params_t
PCA9685 configuration structure for mapping PWM channels to SAUL.
Definition: pca9685.h:212
PCA9685_SAUL_PWM_PARAMS
#define PCA9685_SAUL_PWM_PARAMS
Example for mapping PWM channels to SAUL.
Definition: pca9685_params.h:99
pca9685_params_t
PCA9685 device initialization parameters.
Definition: pca9685.h:178
pca9685_params
static const pca9685_params_t pca9685_params[]
Allocate some memory to store the actual configuration.
Definition: pca9685_params.h:123
pca9685.h
saul_reg.h
SAUL registry interface definition.
pca9685_saul_pwm_params
static const pca9685_saul_pwm_params_t pca9685_saul_pwm_params[]
Additional meta information to keep in the SAUL registry.
Definition: pca9685_params.h:132