#include <stdbool.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
#include "periph/pwm.h"
Go to the source code of this file.
Data Structures | |
struct | pca9685_params_t |
PCA9685 device initialization parameters. More... | |
struct | pca9685_t |
PCA9685 PWM device data structure type. More... | |
struct | pca9685_saul_pwm_params_t |
PCA9685 configuration structure for mapping PWM channels to SAUL. More... | |
Macros | |
#define | PCA9685_CHANNEL_NUM (16U) |
Number of PWM channels provided by PCA9685. | |
#define | PCA9685_RESOLUTION (1 << 12) |
Internal PCA9685 channel resolution is 12-bit. | |
#define | PCA9685_OSC_FREQ (25000000) |
Internal PCA9685 oscilator frequency is 25 MHz. | |
#define | PCA9685_EXT_FERQ_MAX (50000000) |
Maximum external clock frequency is 50 MHz. | |
Enumerations | |
enum | pca9685_error_t { PCA9685_OK = 0, PCA9685_ERROR_I2C = 1 } |
PCA9685 driver error codes. More... | |
enum | pca9685_out_drv_t { PCA9685_OPEN_DRAIN = 0, PCA9685_TOTEM_POLE = 1 } |
PCA9685 output driver mode. More... | |
enum | pca9685_out_ne_t { PCA9685_OFF = 0, PCA9685_OUT_DRV = 1, PCA9685_HIHGH_Z = 2 } |
PCA9685 output-not-enabled mode. More... | |
Functions | |
int | pca9685_init (pca9685_t *dev, const pca9685_params_t *params) |
Initialize the PCA9685 PWM device driver. More... | |
uint32_t | pca9685_pwm_init (pca9685_t *dev, pwm_mode_t mode, uint32_t freq, uint16_t res) |
Initialize the PCA9685 PWM device. More... | |
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. More... | |
void | pca9685_pwm_poweron (pca9685_t *dev) |
Resume PWM generation on the given PCA9685 device. More... | |
void | pca9685_pwm_poweroff (pca9685_t *dev) |
Stop the PWM generation on the given PCA9685 device. More... | |
static uint8_t | pca9685_pwm_channels (pca9685_t *dev) |
Get the number of available channels of the given PCA9685 device. More... | |
PCA9685 I2C slave addresses | |
PCA9685 offers 64 possible hardware-programmable I2C slave addresses. Therefore the I2C slave address is defined as an offset in the range from 0 to 63 to a base address PCA9685_I2C_BASE_ADDR. PCA9685 I2C slave addresses are then in the range from PCA9685_I2C_BASE_ADDR + 0 to PCA9685_I2C_BASE_ADDR + 63 Four I2C slave addresses have special meaning when they are enabled, the All Call address (enabled by default) and three Sub Call addresses disabled by default). These addresses can be used to address either all or sub groups of PCF9695 controllers at the same time. | |
#define | PCA9685_I2C_BASE_ADDR (0x40) |
I2C slave base address. | |
#define | PCA9685_I2C_ALLCALLADDR (0x70) |
Default All Call address. | |
#define | PCA9685_I2C_SUBADR1 (0x71) |
Default Sub Call address 1. | |
#define | PCA9685_I2C_SUBADR2 (0x72) |
Default Sub Call address 2. | |
#define | PCA9685_I2C_SUBADR3 (0x73) |
Default Sub Call address 3. | |