Agragate of 16 PWM channels for a PCA9685PWM.
More...
#include <PCA9685PWM.hxx>
|
| | PCA9685PWM () |
| | Constructor.
|
| |
| void | init (const char *name, uint8_t i2c_address, uint16_t pwm_freq=200, int32_t external_clock_freq=-1) |
| | Initialize device.
|
| |
| | ~PCA9685PWM () |
| | Destructor.
|
| |
| | OSThread (const char *name, int priority, size_t stack_size, void *(*start_routine)(void *), void *arg) |
| | Create a thread.
|
| |
| | OSThread () |
| | Creates a thread via inheritance.
|
| |
| void | start (const char *name, int priority, size_t stack_size) |
| | Starts the thread.
|
| |
| virtual | ~OSThread () |
| | Default destructor.
|
| |
| bool | is_created () |
| |
| void | inherit () |
| | Inherits the current thread.
|
| |
| os_thread_t | get_handle () |
| |
| void | lock_to_thread () |
| | Sets the thread handle to the current calling thread's.
|
| |
| void | unlock_from_thread () |
| | Resets the thread handle to none.
|
| |
|
| static constexpr size_t | NUM_CHANNELS = 16 |
| | maximum number of PWM channels supported by the PCA9685
|
| |
| static constexpr size_t | MAX_PWM_COUNTS = 4096 |
| | maximum number of PWM counts supported by the PCA9685
|
| |
Agragate of 16 PWM channels for a PCA9685PWM.
Definition at line 48 of file PCA9685PWM.hxx.
◆ Registers
Important device register offsets.
| Enumerator |
|---|
| MODE1 | mode 1 settings
|
| MODE2 | mode 2 settings
|
| LED0_ON_L | first LED control register
|
| PRE_SCALE | clock prescale divider
|
Definition at line 119 of file PCA9685PWM.hxx.
◆ PCA9685PWM()
| PCA9685PWM::PCA9685PWM |
( |
| ) |
|
|
inline |
◆ ~PCA9685PWM()
| PCA9685PWM::~PCA9685PWM |
( |
| ) |
|
|
inline |
◆ bit_modify()
| void PCA9685PWM::bit_modify |
( |
Registers |
address, |
|
|
uint8_t |
data, |
|
|
uint8_t |
mask |
|
) |
| |
|
inlineprivate |
Bit modify to an I2C register.
- Parameters
-
| address | address to modify |
| data | data to modify |
| mask | mask of data to modify, bits where mask is 1 will be overwritten, bits where mask is zero will be kept |
Definition at line 218 of file PCA9685PWM.hxx.
◆ entry()
| void * PCA9685PWM::entry |
( |
| ) |
|
|
overrideprivatevirtual |
User entry point for the created thread.
- Returns
- exit status
Reimplemented from OSThread.
Definition at line 39 of file PCA9685PWM.cxx.
◆ get_pwm_duty()
| uint16_t PCA9685PWM::get_pwm_duty |
( |
unsigned |
channel | ) |
|
|
inlineprivate |
Get the pwm duty cycle.
- Parameters
-
| channel | channel index (0 through 15) |
- Returns
- counts for PWM duty cycle
Definition at line 267 of file PCA9685PWM.hxx.
◆ init()
| void PCA9685PWM::init |
( |
const char * |
name, |
|
|
uint8_t |
i2c_address, |
|
|
uint16_t |
pwm_freq = 200, |
|
|
int32_t |
external_clock_freq = -1 |
|
) |
| |
|
inline |
Initialize device.
- Parameters
-
| name | name of the I2C device |
| i2c_address | I2C address of the device on the bus |
| pwm_frequency | target PWM frequency (will truncate at minimum and maximum prescaler values) |
| external_clock | frequency of an external clock in Hz, -1 if internal clock is used |
Definition at line 74 of file PCA9685PWM.hxx.
◆ register_write()
| void PCA9685PWM::register_write |
( |
Registers |
address, |
|
|
uint8_t |
data |
|
) |
| |
|
inlineprivate |
Write to an I2C register.
- Parameters
-
| address | address to write to |
| data | data to write |
Definition at line 307 of file PCA9685PWM.hxx.
◆ register_write_multiple()
| void PCA9685PWM::register_write_multiple |
( |
Registers |
address, |
|
|
void * |
data, |
|
|
size_t |
count |
|
) |
| |
|
inlineprivate |
Write to multiple sequential I2C registers.
- Parameters
-
| address | address to start write at |
| data | array of data to write |
| count | number of data registers to write in sequence |
Definition at line 317 of file PCA9685PWM.hxx.
◆ set_pwm_duty()
| void PCA9685PWM::set_pwm_duty |
( |
unsigned |
channel, |
|
|
uint16_t |
counts |
|
) |
| |
|
inlineprivate |
Set the pwm duty cycle.
- Parameters
-
| channel | channel index (0 through 15) |
| counts | counts for PWM duty cycle |
Definition at line 252 of file PCA9685PWM.hxx.
◆ write_pwm_duty()
| void PCA9685PWM::write_pwm_duty |
( |
unsigned |
channel, |
|
|
uint16_t |
counts |
|
) |
| |
|
inlineprivate |
Set the pwm duty cycle.
- Parameters
-
| channel | channel index (0 through 15) |
| counts | counts for PWM duty cycle |
Definition at line 276 of file PCA9685PWM.hxx.
◆ dirty_
| uint16_t PCA9685PWM::dirty_ |
|
private |
set if the duty_ value is updated (bit mask)
Definition at line 338 of file PCA9685PWM.hxx.
◆ duty_
◆ i2c_
◆ i2cAddress_
| uint8_t PCA9685PWM::i2cAddress_ |
|
private |
◆ MAX_PWM_COUNTS
| constexpr size_t PCA9685PWM::MAX_PWM_COUNTS = 4096 |
|
staticconstexpr |
maximum number of PWM counts supported by the PCA9685
Definition at line 55 of file PCA9685PWM.hxx.
◆ NUM_CHANNELS
| constexpr size_t PCA9685PWM::NUM_CHANNELS = 16 |
|
staticconstexpr |
maximum number of PWM channels supported by the PCA9685
Definition at line 52 of file PCA9685PWM.hxx.
◆ PCA9685PWMBit
| friend PCA9685PWM::PCA9685PWMBit |
|
private |
◆ sem_
The documentation for this class was generated from the following files: