Go to the documentation of this file.
115 #define PCA9685_I2C_BASE_ADDR (0x40)
116 #define PCA9685_I2C_ALLCALLADDR (0x70)
117 #define PCA9685_I2C_SUBADR1 (0x71)
118 #define PCA9685_I2C_SUBADR2 (0x72)
119 #define PCA9685_I2C_SUBADR3 (0x73)
125 #define PCA9685_CHANNEL_NUM (16U)
130 #define PCA9685_RESOLUTION (1 << 12)
135 #define PCA9685_OSC_FREQ (25000000)
140 #define PCA9685_EXT_FERQ_MAX (50000000)
208 #if MODULE_SAUL || DOXYGEN
pca9685_out_drv_t
PCA9685 output driver mode.
@ PCA9685_OUT_DRV
Outputs depend on the output driver mode pca9685_params_t::out_drv.
PCA9685 PWM device data structure type.
uint8_t channel
channel of the PCA9685 device
i2c_t i2c_dev
I2C device, default I2C_DEV(0)
void pca9685_pwm_poweroff(pca9685_t *dev)
Stop the PWM generation on the given PCA9685 device.
bool powered_on
Devices is powered on if true.
unsigned int dev
index of the PCA9685 device
PCA9685 configuration structure for mapping PWM channels to SAUL.
int pca9685_init(pca9685_t *dev, const pca9685_params_t *params)
Initialize the PCA9685 PWM device driver.
@ PCA9685_TOTEM_POLE
Totem pole structure output.
bool inv
Invert outputs, e.g., for LEDs (default yes)
unsigned int i2c_t
Default i2c_t type definition.
gpio_t oe_pin
Active LOW output enable pin /OE.
@ PCA9685_OPEN_DRAIN
Open-drain structure output.
pca9685_error_t
PCA9685 driver error codes.
uint16_t res
PWM resolution (default 4096)
uint16_t initial
initial duty-cycle value
uint32_t ext_freq
If not 0, EXTCLK pin is used with this frequency.
@ PCA9685_OFF
If /OE pin is HIGH, outputs are LOW.
uint8_t i2c_addr
I2C slave address.
PCA9685 device initialization parameters.
pwm_mode_t mode
PWM mode for all channels: PWM_LEFT, PWM_CENTER, PWM_RIGHT supported, (default PWM_CENTER)
@ PCA9685_ERROR_I2C
I2C communication error.
pca9685_out_ne_t
PCA9685 output-not-enabled mode.
const char * name
name of the PCA9685 device
#define PCA9685_CHANNEL_NUM
Number of PWM channels provided by PCA9685.
void pca9685_pwm_set(pca9685_t *dev, uint8_t channel, uint16_t value)
Set the duty-cycle for a given channel or all channels of the given PCA9685 PWM device.
@ PCA9685_HIHGH_Z
If /OE pin is HIGH, outputs are high-impedance.
Low-level GPIO peripheral driver interface definitions.
pca9685_out_drv_t out_drv
Output driver mode.
pca9685_out_ne_t out_ne
Output-not-enabled mode.
Low-level PWM peripheral driver interface definitions.
uint32_t pca9685_pwm_init(pca9685_t *dev, pwm_mode_t mode, uint32_t freq, uint16_t res)
Initialize the PCA9685 PWM device.
pca9685_params_t params
Device initialization parameters.
static uint8_t pca9685_pwm_channels(pca9685_t *dev)
Get the number of available channels of the given PCA9685 device.
Low-level I2C peripheral driver interface definition.
uint32_t freq
PWM frequency in Hz (default 100)
void pca9685_pwm_poweron(pca9685_t *dev)
Resume PWM generation on the given PCA9685 device.