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