Loading...
Searching...
No Matches
pca9685_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
15
16#include "board.h"
17#include "saul_reg.h"
18#include "pca9685.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
28#ifndef PCA9685_PARAM_DEV
30#define PCA9685_PARAM_DEV I2C_DEV(0)
31#endif
32
33#ifndef PCA9685_PARAM_ADDR
35#define PCA9685_PARAM_ADDR (PCA9685_I2C_BASE_ADDR + 0)
36#endif
37
38#ifndef PCA9685_PARAM_INV
40#define PCA9685_PARAM_INV (false)
41#endif
42
43#ifndef PCA9685_PARAM_MODE
45#define PCA9685_PARAM_MODE (PWM_LEFT)
46#endif
47
48#ifndef PCA9685_PARAM_FREQ
50#define PCA9685_PARAM_FREQ (100)
51#endif
52
53#ifndef PCA9685_PARAM_RES
55#define PCA9685_PARAM_RES (4096)
56#endif
57
58#ifndef PCA9685_PARAM_OE_PIN
60#define PCA9685_PARAM_OE_PIN (GPIO_UNDEF)
61#endif
62
63#ifndef PCA9685_PARAM_EXT_FREQ
65#define PCA9685_PARAM_EXT_FREQ (0)
66#endif
67
68#ifndef PCA9685_PARAM_OUT_DRV
70#define PCA9685_PARAM_OUT_DRV (PCA9685_TOTEM_POLE)
71#endif
72
73#ifndef PCA9685_PARAM_OUT_NE
75#define PCA9685_PARAM_OUT_NE (PCA9685_OFF)
76#endif
77
78#ifndef PCA9685_PARAMS
79#define PCA9685_PARAMS { \
80 .i2c_dev = PCA9685_PARAM_DEV, \
81 .i2c_addr = PCA9685_PARAM_ADDR, \
82 .inv = PCA9685_PARAM_INV, \
83 .mode = PCA9685_PARAM_MODE, \
84 .freq = PCA9685_PARAM_FREQ, \
85 .res = PCA9685_PARAM_RES, \
86 .ext_freq = PCA9685_PARAM_EXT_FREQ, \
87 .oe_pin = PCA9685_PARAM_OE_PIN, \
88 .out_drv = PCA9685_PARAM_OUT_DRV, \
89 .out_ne = PCA9685_PARAM_OUT_NE, \
90 }
91#endif /* PCA9685_PARAMS */
92
93#ifndef PCA9685_SAUL_PWM_PARAMS
95#define PCA9685_SAUL_PWM_PARAMS { \
96 .name = "PCA9685-0:0", \
97 .dev = 0, \
98 .channel = 0, \
99 .initial = (PCA9685_PARAM_RES >> 1), \
100 }, \
101 { \
102 .name = "PCA9685-0:1", \
103 .dev = 0, \
104 .channel = 1, \
105 .initial = (PCA9685_PARAM_RES >> 2), \
106 }, \
107 { \
108 .name = "PCA9685-0:1", \
109 .dev = 0, \
110 .channel = 2, \
111 .initial = (PCA9685_PARAM_RES >> 3), \
112 },
113#endif /* PCA9685_PARAMS */
115
120{
121 PCA9685_PARAMS
122};
123
124#if MODULE_SAUL || DOXYGEN
132#endif /* MODULE_SAUL || DOXYGEN */
133
134#ifdef __cplusplus
135}
136#endif
137
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