LibDriver PCA9685  1.0.0
PCA9685 full-featured driver
pca9685 base driver function

pca9685 base driver modules More...

Data Structures

struct  pca9685_handle_s
 pca9685 handle structure definition More...
 
struct  pca9685_info_s
 pca9685 information structure definition More...
 

Macros

#define PCA9685_OSCILLATOR_INTERNAL_FREQUENCY   25000000
 pca9685 internal oscillator frequency More...
 

Typedefs

typedef struct pca9685_handle_s pca9685_handle_t
 pca9685 handle structure definition More...
 
typedef struct pca9685_info_s pca9685_info_t
 pca9685 information structure definition More...
 

Enumerations

enum  pca9685_address_t {
  PCA9685_ADDRESS_A000000 = 0x00 , PCA9685_ADDRESS_A000001 = 0x01 , PCA9685_ADDRESS_A000010 = 0x02 , PCA9685_ADDRESS_A000011 = 0x03 ,
  PCA9685_ADDRESS_A000100 = 0x04 , PCA9685_ADDRESS_A000101 = 0x05 , PCA9685_ADDRESS_A000110 = 0x06 , PCA9685_ADDRESS_A000111 = 0x07 ,
  PCA9685_ADDRESS_A001000 = 0x08 , PCA9685_ADDRESS_A001001 = 0x09 , PCA9685_ADDRESS_A001010 = 0x0A , PCA9685_ADDRESS_A001011 = 0x0B ,
  PCA9685_ADDRESS_A001100 = 0x0C , PCA9685_ADDRESS_A001101 = 0x0D , PCA9685_ADDRESS_A001110 = 0x0E , PCA9685_ADDRESS_A001111 = 0x0F ,
  PCA9685_ADDRESS_A010000 = 0x10 , PCA9685_ADDRESS_A010001 = 0x11 , PCA9685_ADDRESS_A010010 = 0x12 , PCA9685_ADDRESS_A010011 = 0x13 ,
  PCA9685_ADDRESS_A010100 = 0x14 , PCA9685_ADDRESS_A010101 = 0x15 , PCA9685_ADDRESS_A010110 = 0x16 , PCA9685_ADDRESS_A010111 = 0x17 ,
  PCA9685_ADDRESS_A011000 = 0x18 , PCA9685_ADDRESS_A011001 = 0x19 , PCA9685_ADDRESS_A011010 = 0x1A , PCA9685_ADDRESS_A011011 = 0x1B ,
  PCA9685_ADDRESS_A011100 = 0x1C , PCA9685_ADDRESS_A011101 = 0x1D , PCA9685_ADDRESS_A011110 = 0x1E , PCA9685_ADDRESS_A011111 = 0x1F ,
  PCA9685_ADDRESS_A100000 = 0x20 , PCA9685_ADDRESS_A100001 = 0x21 , PCA9685_ADDRESS_A100010 = 0x22 , PCA9685_ADDRESS_A100011 = 0x23 ,
  PCA9685_ADDRESS_A100100 = 0x24 , PCA9685_ADDRESS_A100101 = 0x25 , PCA9685_ADDRESS_A100110 = 0x26 , PCA9685_ADDRESS_A100111 = 0x27 ,
  PCA9685_ADDRESS_A101000 = 0x28 , PCA9685_ADDRESS_A101001 = 0x29 , PCA9685_ADDRESS_A101010 = 0x2A , PCA9685_ADDRESS_A101011 = 0x2B ,
  PCA9685_ADDRESS_A101100 = 0x2C , PCA9685_ADDRESS_A101101 = 0x2D , PCA9685_ADDRESS_A101110 = 0x2E , PCA9685_ADDRESS_A101111 = 0x2F ,
  PCA9685_ADDRESS_A110000 = 0x30 , PCA9685_ADDRESS_A110001 = 0x31 , PCA9685_ADDRESS_A110010 = 0x32 , PCA9685_ADDRESS_A110011 = 0x33 ,
  PCA9685_ADDRESS_A110100 = 0x34 , PCA9685_ADDRESS_A110101 = 0x35 , PCA9685_ADDRESS_A110110 = 0x36 , PCA9685_ADDRESS_A110111 = 0x37 ,
  PCA9685_ADDRESS_A111000 = 0x38 , PCA9685_ADDRESS_A111001 = 0x39 , PCA9685_ADDRESS_A111010 = 0x3A , PCA9685_ADDRESS_A111011 = 0x3B ,
  PCA9685_ADDRESS_A111100 = 0x3C , PCA9685_ADDRESS_A111101 = 0x3D , PCA9685_ADDRESS_A111110 = 0x3E , PCA9685_ADDRESS_A111111 = 0x3F
}
 pca9685 address enumeration definition More...
 
enum  pca9685_bool_t { PCA9685_BOOL_FALSE = 0x00 , PCA9685_BOOL_TRUE = 0x01 }
 pca9685 bool enumeration definition More...
 
enum  pca9685_output_change_t { PCA9685_OUTPUT_CHANGE_STOP = 0x00 , PCA9685_OUTPUT_CHANGE_ACK = 0x01 }
 pca9685 output change enumeration definition More...
 
enum  pca9685_output_driver_t { PCA9685_OUTPUT_DRIVER_OPEN_DRAIN = 0x00 , PCA9685_OUTPUT_DRIVER_TOTEM_POLE = 0x01 }
 pca9685 output driver enumeration definition More...
 
enum  pca9685_output_disable_type_t { PCA9685_OUTPUT_DISABLE_TYPE_LEDN_LOW = 0x00 , PCA9685_OUTPUT_DISABLE_TYPE_OUTDRV_1_LEDN_LOW_OUTDRV_0_HIGH_IMPEDANCE = 0x01 , PCA9685_OUTPUT_DISABLE_TYPE_HIGH_IMPEDANCE = 0x02 }
 pca9685 output disable type enumeration definition More...
 
enum  pca9685_channel_t {
  PCA9685_CHANNEL_0 = 0x00 , PCA9685_CHANNEL_1 = 0x01 , PCA9685_CHANNEL_2 = 0x02 , PCA9685_CHANNEL_3 = 0x03 ,
  PCA9685_CHANNEL_4 = 0x04 , PCA9685_CHANNEL_5 = 0x05 , PCA9685_CHANNEL_6 = 0x06 , PCA9685_CHANNEL_7 = 0x07 ,
  PCA9685_CHANNEL_8 = 0x08 , PCA9685_CHANNEL_9 = 0x09 , PCA9685_CHANNEL_10 = 0x0A , PCA9685_CHANNEL_11 = 0x0B ,
  PCA9685_CHANNEL_12 = 0x0C , PCA9685_CHANNEL_13 = 0x0D , PCA9685_CHANNEL_14 = 0x0E , PCA9685_CHANNEL_15 = 0x0F
}
 pca9685 channel enumeration definition More...
 

Functions

uint8_t pca9685_info (pca9685_info_t *info)
 get chip's information More...
 
uint8_t pca9685_set_addr_pin (pca9685_handle_t *handle, pca9685_address_t addr_pin)
 set the address pin More...
 
uint8_t pca9685_get_addr_pin (pca9685_handle_t *handle, pca9685_address_t *addr_pin)
 get the address pin More...
 
uint8_t pca9685_set_addr (pca9685_handle_t *handle, uint8_t addr)
 set the address More...
 
uint8_t pca9685_get_addr (pca9685_handle_t *handle, uint8_t *addr)
 get the address More...
 
uint8_t pca9685_init (pca9685_handle_t *handle)
 initialize the chip More...
 
uint8_t pca9685_deinit (pca9685_handle_t *handle)
 close the chip More...
 
uint8_t pca9685_write_channel (pca9685_handle_t *handle, pca9685_channel_t channel, uint16_t on_count, uint16_t off_count)
 write led channels More...
 
uint8_t pca9685_read_channel (pca9685_handle_t *handle, pca9685_channel_t channel, uint16_t *on_count, uint16_t *off_count)
 read led channels More...
 
uint8_t pca9685_write_all_channel (pca9685_handle_t *handle, uint16_t on_count, uint16_t off_count)
 write all led channels More...
 
uint8_t pca9685_pwm_convert_to_register (pca9685_handle_t *handle, float delay_percent, float high_duty_cycle_percent, uint16_t *on_count, uint16_t *off_count)
 convert the pwm to the register raw data More...
 
uint8_t pca9685_pwm_convert_to_data (pca9685_handle_t *handle, uint16_t on_count, uint16_t off_count, float *delay_percent, float *high_duty_cycle_percent)
 convert the register raw data to the pwm More...
 
uint8_t pca9685_set_active (pca9685_handle_t *handle, pca9685_bool_t enable)
 set the chip active More...
 
uint8_t pca9685_set_prescaler (pca9685_handle_t *handle, uint8_t prescaler)
 set the clock pres cale More...
 
uint8_t pca9685_get_prescaler (pca9685_handle_t *handle, uint8_t *prescaler)
 get the clock pre scale More...
 
uint8_t pca9685_output_frequency_convert_to_register (pca9685_handle_t *handle, uint32_t oscillator, uint16_t output_freq, uint8_t *reg)
 convert the output frequency to the register raw data More...
 
uint8_t pca9685_output_frequency_convert_to_data (pca9685_handle_t *handle, uint32_t oscillator, uint8_t reg, uint16_t *output_freq)
 convert the register raw data to the output frequency More...
 
uint8_t pca9685_set_restart (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable restart More...
 
uint8_t pca9685_get_restart (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the restart status More...
 
uint8_t pca9685_set_external_clock_pin (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable the external clock pin More...
 
uint8_t pca9685_get_external_clock_pin (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the external clock pin status More...
 
uint8_t pca9685_set_register_auto_increment (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable the register auto increment More...
 
uint8_t pca9685_get_register_auto_increment (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the register auto increment status More...
 
uint8_t pca9685_set_sleep_mode (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable the sleep mode More...
 
uint8_t pca9685_get_sleep_mode (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the sleep mode status More...
 
uint8_t pca9685_set_respond_subaddress_1 (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable respond sub address 1 More...
 
uint8_t pca9685_get_respond_subaddress_1 (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the respond sub address 1 status More...
 
uint8_t pca9685_set_respond_subaddress_2 (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable respond sub address 2 More...
 
uint8_t pca9685_get_respond_subaddress_2 (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the respond sub address 2 status More...
 
uint8_t pca9685_set_respond_subaddress_3 (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable respond sub address 3 More...
 
uint8_t pca9685_get_respond_subaddress_3 (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the respond sub address 3 status More...
 
uint8_t pca9685_set_respond_all_call (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable respond all call More...
 
uint8_t pca9685_get_respond_all_call (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the respond all call status More...
 
uint8_t pca9685_set_output_invert (pca9685_handle_t *handle, pca9685_bool_t enable)
 enable or disable output invert More...
 
uint8_t pca9685_get_output_invert (pca9685_handle_t *handle, pca9685_bool_t *enable)
 get the output invert status More...
 
uint8_t pca9685_set_output_change (pca9685_handle_t *handle, pca9685_output_change_t change)
 set the output change type More...
 
uint8_t pca9685_get_output_change (pca9685_handle_t *handle, pca9685_output_change_t *change)
 get the output change type More...
 
uint8_t pca9685_set_output_driver (pca9685_handle_t *handle, pca9685_output_driver_t driver)
 set the output driver type More...
 
uint8_t pca9685_get_output_driver (pca9685_handle_t *handle, pca9685_output_driver_t *driver)
 get the output driver type More...
 
uint8_t pca9685_set_output_disable_type (pca9685_handle_t *handle, pca9685_output_disable_type_t type)
 set the output disable type More...
 
uint8_t pca9685_get_output_disable_type (pca9685_handle_t *handle, pca9685_output_disable_type_t *type)
 get the output disable type More...
 
uint8_t pca9685_set_subaddress_1 (pca9685_handle_t *handle, uint8_t addr)
 set the sub address 1 More...
 
uint8_t pca9685_get_subaddress_1 (pca9685_handle_t *handle, uint8_t *addr)
 get the sub address 1 More...
 
uint8_t pca9685_set_subaddress_2 (pca9685_handle_t *handle, uint8_t addr)
 set the sub address 2 More...
 
uint8_t pca9685_get_subaddress_2 (pca9685_handle_t *handle, uint8_t *addr)
 get the sub address 2 More...
 
uint8_t pca9685_set_subaddress_3 (pca9685_handle_t *handle, uint8_t addr)
 set the sub address 3 More...
 
uint8_t pca9685_get_subaddress_3 (pca9685_handle_t *handle, uint8_t *addr)
 get the sub address 3 More...
 
uint8_t pca9685_set_all_call_address (pca9685_handle_t *handle, uint8_t addr)
 set the all call address More...
 
uint8_t pca9685_get_all_call_address (pca9685_handle_t *handle, uint8_t *addr)
 set the all call address More...
 

Detailed Description

pca9685 base driver modules

Macro Definition Documentation

◆ PCA9685_OSCILLATOR_INTERNAL_FREQUENCY

#define PCA9685_OSCILLATOR_INTERNAL_FREQUENCY   25000000

pca9685 internal oscillator frequency

25MHz

Definition at line 63 of file driver_pca9685.h.

Typedef Documentation

◆ pca9685_handle_t

pca9685 handle structure definition

◆ pca9685_info_t

pca9685 information structure definition

Enumeration Type Documentation

◆ pca9685_address_t

pca9685 address enumeration definition

Enumerator
PCA9685_ADDRESS_A000000 

A5A4A3A2A1A0 000000

PCA9685_ADDRESS_A000001 

A5A4A3A2A1A0 000001

PCA9685_ADDRESS_A000010 

A5A4A3A2A1A0 000010

PCA9685_ADDRESS_A000011 

A5A4A3A2A1A0 000011

PCA9685_ADDRESS_A000100 

A5A4A3A2A1A0 000100

PCA9685_ADDRESS_A000101 

A5A4A3A2A1A0 000101

PCA9685_ADDRESS_A000110 

A5A4A3A2A1A0 000110

PCA9685_ADDRESS_A000111 

A5A4A3A2A1A0 000111

PCA9685_ADDRESS_A001000 

A5A4A3A2A1A0 001000

PCA9685_ADDRESS_A001001 

A5A4A3A2A1A0 001001

PCA9685_ADDRESS_A001010 

A5A4A3A2A1A0 001010

PCA9685_ADDRESS_A001011 

A5A4A3A2A1A0 001011

PCA9685_ADDRESS_A001100 

A5A4A3A2A1A0 001100

PCA9685_ADDRESS_A001101 

A5A4A3A2A1A0 001101

PCA9685_ADDRESS_A001110 

A5A4A3A2A1A0 001110

PCA9685_ADDRESS_A001111 

A5A4A3A2A1A0 001111

PCA9685_ADDRESS_A010000 

A5A4A3A2A1A0 010000

PCA9685_ADDRESS_A010001 

A5A4A3A2A1A0 010001

PCA9685_ADDRESS_A010010 

A5A4A3A2A1A0 010010

PCA9685_ADDRESS_A010011 

A5A4A3A2A1A0 010011

PCA9685_ADDRESS_A010100 

A5A4A3A2A1A0 010100

PCA9685_ADDRESS_A010101 

A5A4A3A2A1A0 010101

PCA9685_ADDRESS_A010110 

A5A4A3A2A1A0 010110

PCA9685_ADDRESS_A010111 

A5A4A3A2A1A0 010111

PCA9685_ADDRESS_A011000 

A5A4A3A2A1A0 011000

PCA9685_ADDRESS_A011001 

A5A4A3A2A1A0 011001

PCA9685_ADDRESS_A011010 

A5A4A3A2A1A0 011010

PCA9685_ADDRESS_A011011 

A5A4A3A2A1A0 011011

PCA9685_ADDRESS_A011100 

A5A4A3A2A1A0 011100

PCA9685_ADDRESS_A011101 

A5A4A3A2A1A0 011101

PCA9685_ADDRESS_A011110 

A5A4A3A2A1A0 011110

PCA9685_ADDRESS_A011111 

A5A4A3A2A1A0 011111

PCA9685_ADDRESS_A100000 

A5A4A3A2A1A0 100000

PCA9685_ADDRESS_A100001 

A5A4A3A2A1A0 100001

PCA9685_ADDRESS_A100010 

A5A4A3A2A1A0 100010

PCA9685_ADDRESS_A100011 

A5A4A3A2A1A0 100011

PCA9685_ADDRESS_A100100 

A5A4A3A2A1A0 100100

PCA9685_ADDRESS_A100101 

A5A4A3A2A1A0 100101

PCA9685_ADDRESS_A100110 

A5A4A3A2A1A0 100110

PCA9685_ADDRESS_A100111 

A5A4A3A2A1A0 100111

PCA9685_ADDRESS_A101000 

A5A4A3A2A1A0 101000

PCA9685_ADDRESS_A101001 

A5A4A3A2A1A0 101001

PCA9685_ADDRESS_A101010 

A5A4A3A2A1A0 101010

PCA9685_ADDRESS_A101011 

A5A4A3A2A1A0 101011

PCA9685_ADDRESS_A101100 

A5A4A3A2A1A0 101100

PCA9685_ADDRESS_A101101 

A5A4A3A2A1A0 101101

PCA9685_ADDRESS_A101110 

A5A4A3A2A1A0 101110

PCA9685_ADDRESS_A101111 

A5A4A3A2A1A0 101111

PCA9685_ADDRESS_A110000 

A5A4A3A2A1A0 110000

PCA9685_ADDRESS_A110001 

A5A4A3A2A1A0 110001

PCA9685_ADDRESS_A110010 

A5A4A3A2A1A0 110010

PCA9685_ADDRESS_A110011 

A5A4A3A2A1A0 110011

PCA9685_ADDRESS_A110100 

A5A4A3A2A1A0 110100

PCA9685_ADDRESS_A110101 

A5A4A3A2A1A0 110101

PCA9685_ADDRESS_A110110 

A5A4A3A2A1A0 110110

PCA9685_ADDRESS_A110111 

A5A4A3A2A1A0 110111

PCA9685_ADDRESS_A111000 

A5A4A3A2A1A0 111000

PCA9685_ADDRESS_A111001 

A5A4A3A2A1A0 111001

PCA9685_ADDRESS_A111010 

A5A4A3A2A1A0 111010

PCA9685_ADDRESS_A111011 

A5A4A3A2A1A0 111011

PCA9685_ADDRESS_A111100 

A5A4A3A2A1A0 111100

PCA9685_ADDRESS_A111101 

A5A4A3A2A1A0 111101

PCA9685_ADDRESS_A111110 

A5A4A3A2A1A0 111110

PCA9685_ADDRESS_A111111 

A5A4A3A2A1A0 111111

Definition at line 69 of file driver_pca9685.h.

◆ pca9685_bool_t

pca9685 bool enumeration definition

Enumerator
PCA9685_BOOL_FALSE 

disable

PCA9685_BOOL_TRUE 

enable

Definition at line 140 of file driver_pca9685.h.

◆ pca9685_channel_t

pca9685 channel enumeration definition

Enumerator
PCA9685_CHANNEL_0 

channel 0

PCA9685_CHANNEL_1 

channel 1

PCA9685_CHANNEL_2 

channel 2

PCA9685_CHANNEL_3 

channel 3

PCA9685_CHANNEL_4 

channel 4

PCA9685_CHANNEL_5 

channel 5

PCA9685_CHANNEL_6 

channel 6

PCA9685_CHANNEL_7 

channel 7

PCA9685_CHANNEL_8 

channel 8

PCA9685_CHANNEL_9 

channel 9

PCA9685_CHANNEL_10 

channel 10

PCA9685_CHANNEL_11 

channel 11

PCA9685_CHANNEL_12 

channel 12

PCA9685_CHANNEL_13 

channel 13

PCA9685_CHANNEL_14 

channel 14

PCA9685_CHANNEL_15 

channel 15

Definition at line 178 of file driver_pca9685.h.

◆ pca9685_output_change_t

pca9685 output change enumeration definition

Enumerator
PCA9685_OUTPUT_CHANGE_STOP 

outputs change on stop command

PCA9685_OUTPUT_CHANGE_ACK 

outputs change on ack

Definition at line 149 of file driver_pca9685.h.

◆ pca9685_output_disable_type_t

pca9685 output disable type enumeration definition

Enumerator
PCA9685_OUTPUT_DISABLE_TYPE_LEDN_LOW 

when OE = 1 (output drivers not enabled), ledn = 0

PCA9685_OUTPUT_DISABLE_TYPE_OUTDRV_1_LEDN_LOW_OUTDRV_0_HIGH_IMPEDANCE 

when OE = 1 (output drivers not enabled), ledn = 1 when OUTDRV = 1 ledn = high impedance when OUTDRV = 0

PCA9685_OUTPUT_DISABLE_TYPE_HIGH_IMPEDANCE 

when OE = 1 (output drivers not enabled), ledn = high impedance

Definition at line 167 of file driver_pca9685.h.

◆ pca9685_output_driver_t

pca9685 output driver enumeration definition

Enumerator
PCA9685_OUTPUT_DRIVER_OPEN_DRAIN 

outputs are configured with an open drain structure

PCA9685_OUTPUT_DRIVER_TOTEM_POLE 

outputs are configured with a totem pole structure

Definition at line 158 of file driver_pca9685.h.

Function Documentation

◆ pca9685_deinit()

uint8_t pca9685_deinit ( pca9685_handle_t handle)

close the chip

Parameters
[in]*handlepointer to a pca9685 handle structure
Returns
status code
  • 0 success
  • 1 power down failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 iic or gpio deinit failed
Note
none

Definition at line 1935 of file driver_pca9685.c.

◆ pca9685_get_addr()

uint8_t pca9685_get_addr ( pca9685_handle_t handle,
uint8_t *  addr 
)

get the address

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addrpointer to a chip address buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 144 of file driver_pca9685.c.

◆ pca9685_get_addr_pin()

uint8_t pca9685_get_addr_pin ( pca9685_handle_t handle,
pca9685_address_t addr_pin 
)

get the address pin

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addr_pinpointer to a chip address pins buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 102 of file driver_pca9685.c.

◆ pca9685_get_all_call_address()

uint8_t pca9685_get_all_call_address ( pca9685_handle_t handle,
uint8_t *  addr 
)

set the all call address

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addrpointer to an all call address buffer
Returns
status code
  • 0 success
  • 1 get all call address failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1428 of file driver_pca9685.c.

◆ pca9685_get_external_clock_pin()

uint8_t pca9685_get_external_clock_pin ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the external clock pin status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get external clock pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 326 of file driver_pca9685.c.

◆ pca9685_get_output_change()

uint8_t pca9685_get_output_change ( pca9685_handle_t handle,
pca9685_output_change_t change 
)

get the output change type

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*changepointer to an output change type buffer
Returns
status code
  • 0 success
  • 1 get output change failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 982 of file driver_pca9685.c.

◆ pca9685_get_output_disable_type()

uint8_t pca9685_get_output_disable_type ( pca9685_handle_t handle,
pca9685_output_disable_type_t type 
)

get the output disable type

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*typepointer to an output disable type buffer
Returns
status code
  • 0 success
  • 1 get output disable type failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1146 of file driver_pca9685.c.

◆ pca9685_get_output_driver()

uint8_t pca9685_get_output_driver ( pca9685_handle_t handle,
pca9685_output_driver_t driver 
)

get the output driver type

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*driverpointer to an output driver type buffer
Returns
status code
  • 0 success
  • 1 get output driver failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1064 of file driver_pca9685.c.

◆ pca9685_get_output_invert()

uint8_t pca9685_get_output_invert ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the output invert status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get output invert failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 900 of file driver_pca9685.c.

◆ pca9685_get_prescaler()

uint8_t pca9685_get_prescaler ( pca9685_handle_t handle,
uint8_t *  prescaler 
)

get the clock pre scale

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*prescalerpointer to a clock pre scale buffer
Returns
status code
  • 0 success
  • 1 get pre scale failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1645 of file driver_pca9685.c.

◆ pca9685_get_register_auto_increment()

uint8_t pca9685_get_register_auto_increment ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the register auto increment status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get register auto increment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 408 of file driver_pca9685.c.

◆ pca9685_get_respond_all_call()

uint8_t pca9685_get_respond_all_call ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the respond all call status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get respond all call failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 818 of file driver_pca9685.c.

◆ pca9685_get_respond_subaddress_1()

uint8_t pca9685_get_respond_subaddress_1 ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the respond sub address 1 status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get respond sub address 1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 572 of file driver_pca9685.c.

◆ pca9685_get_respond_subaddress_2()

uint8_t pca9685_get_respond_subaddress_2 ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the respond sub address 2 status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get respond sub address 2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 654 of file driver_pca9685.c.

◆ pca9685_get_respond_subaddress_3()

uint8_t pca9685_get_respond_subaddress_3 ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the respond sub address 3 status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get respond sub address 3 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 736 of file driver_pca9685.c.

◆ pca9685_get_restart()

uint8_t pca9685_get_restart ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the restart status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get restart failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 244 of file driver_pca9685.c.

◆ pca9685_get_sleep_mode()

uint8_t pca9685_get_sleep_mode ( pca9685_handle_t handle,
pca9685_bool_t enable 
)

get the sleep mode status

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get sleep mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 490 of file driver_pca9685.c.

◆ pca9685_get_subaddress_1()

uint8_t pca9685_get_subaddress_1 ( pca9685_handle_t handle,
uint8_t *  addr 
)

get the sub address 1

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addrpointer to a sub address 1 buffer
Returns
status code
  • 0 success
  • 1 get sub address 1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1218 of file driver_pca9685.c.

◆ pca9685_get_subaddress_2()

uint8_t pca9685_get_subaddress_2 ( pca9685_handle_t handle,
uint8_t *  addr 
)

get the sub address 2

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addrpointer to a sub address 2 buffer
Returns
status code
  • 0 success
  • 1 get sub address 2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1288 of file driver_pca9685.c.

◆ pca9685_get_subaddress_3()

uint8_t pca9685_get_subaddress_3 ( pca9685_handle_t handle,
uint8_t *  addr 
)

get the sub address 3

Parameters
[in]*handlepointer to a pca9685 handle structure
[out]*addrpointer to a sub address 3 buffer
Returns
status code
  • 0 success
  • 1 get sub address 3 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1358 of file driver_pca9685.c.

◆ pca9685_info()

uint8_t pca9685_info ( pca9685_info_t info)

get chip's information

Parameters
[out]*infopointer to a pca9685 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 2056 of file driver_pca9685.c.

◆ pca9685_init()

uint8_t pca9685_init ( pca9685_handle_t handle)

initialize the chip

Parameters
[in]*handlepointer to a pca9685 handle structure
Returns
status code
  • 0 success
  • 1 iic or gpio initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
Note
none

Definition at line 1814 of file driver_pca9685.c.

◆ pca9685_output_frequency_convert_to_data()

uint8_t pca9685_output_frequency_convert_to_data ( pca9685_handle_t handle,
uint32_t  oscillator,
uint8_t  reg,
uint16_t *  output_freq 
)

convert the register raw data to the output frequency

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]oscillatoroscillator frequency
[in]regregister raw data
[out]*output_freqpointer to an output frequency buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1709 of file driver_pca9685.c.

◆ pca9685_output_frequency_convert_to_register()

uint8_t pca9685_output_frequency_convert_to_register ( pca9685_handle_t handle,
uint32_t  oscillator,
uint16_t  output_freq,
uint8_t *  reg 
)

convert the output frequency to the register raw data

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]oscillatoroscillator frequency
[in]output_freqoutput frequency
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1681 of file driver_pca9685.c.

◆ pca9685_pwm_convert_to_data()

uint8_t pca9685_pwm_convert_to_data ( pca9685_handle_t handle,
uint16_t  on_count,
uint16_t  off_count,
float *  delay_percent,
float *  high_duty_cycle_percent 
)

convert the register raw data to the pwm

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]on_countled on count
[in]off_countled off count
[out]*delay_percentpointer to a delay percent buffer
[out]*high_duty_cycle_percentpointer to a high duty cycle percent buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 on_count or off_count is over 4096
Note
on_count <= 4096 && off_count <= 4096

Definition at line 1779 of file driver_pca9685.c.

◆ pca9685_pwm_convert_to_register()

uint8_t pca9685_pwm_convert_to_register ( pca9685_handle_t handle,
float  delay_percent,
float  high_duty_cycle_percent,
uint16_t *  on_count,
uint16_t *  off_count 
)

convert the pwm to the register raw data

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]delay_percentstart delay percent
[in]high_duty_cycle_percentpwm high duty cycle percent
[out]*on_countpointer to an on counter buffer
[out]*off_countpointer to an off counter buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 delay_percent + high_duty_cycle_percent can't be over 100.0
Note
0.0 <= delay_percent + high_duty_cycle_percent <= 100.0 0.0 <= delay_percent <= 100.0 0.0 <= high_duty_cycle_percent <= 100.0

Definition at line 1741 of file driver_pca9685.c.

◆ pca9685_read_channel()

uint8_t pca9685_read_channel ( pca9685_handle_t handle,
pca9685_channel_t  channel,
uint16_t *  on_count,
uint16_t *  off_count 
)

read led channels

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]channelled channel
[out]*on_countpointer to an led on count buffer
[out]*off_countpointer to an led off count buffer
Returns
status code
  • 0 success
  • 1 read channel failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1515 of file driver_pca9685.c.

◆ pca9685_set_active()

uint8_t pca9685_set_active ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

set the chip active

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set active failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 167 of file driver_pca9685.c.

◆ pca9685_set_addr()

uint8_t pca9685_set_addr ( pca9685_handle_t handle,
uint8_t  addr 
)

set the address

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addrchip address
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 123 of file driver_pca9685.c.

◆ pca9685_set_addr_pin()

uint8_t pca9685_set_addr_pin ( pca9685_handle_t handle,
pca9685_address_t  addr_pin 
)

set the address pin

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addr_pinchip address pins
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 80 of file driver_pca9685.c.

◆ pca9685_set_all_call_address()

uint8_t pca9685_set_all_call_address ( pca9685_handle_t handle,
uint8_t  addr 
)

set the all call address

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addrall call address
Returns
status code
  • 0 success
  • 1 set all call address failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1393 of file driver_pca9685.c.

◆ pca9685_set_external_clock_pin()

uint8_t pca9685_set_external_clock_pin ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable the external clock pin

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set external clock pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 281 of file driver_pca9685.c.

◆ pca9685_set_output_change()

uint8_t pca9685_set_output_change ( pca9685_handle_t handle,
pca9685_output_change_t  change 
)

set the output change type

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]changeoutput change type
Returns
status code
  • 0 success
  • 1 set output change failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 937 of file driver_pca9685.c.

◆ pca9685_set_output_disable_type()

uint8_t pca9685_set_output_disable_type ( pca9685_handle_t handle,
pca9685_output_disable_type_t  type 
)

set the output disable type

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]typeoutput disable type
Returns
status code
  • 0 success
  • 1 set output disable type failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1101 of file driver_pca9685.c.

◆ pca9685_set_output_driver()

uint8_t pca9685_set_output_driver ( pca9685_handle_t handle,
pca9685_output_driver_t  driver 
)

set the output driver type

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]driveroutput driver type
Returns
status code
  • 0 success
  • 1 set output driver failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1019 of file driver_pca9685.c.

◆ pca9685_set_output_invert()

uint8_t pca9685_set_output_invert ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable output invert

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set output invert failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 855 of file driver_pca9685.c.

◆ pca9685_set_prescaler()

uint8_t pca9685_set_prescaler ( pca9685_handle_t handle,
uint8_t  prescaler 
)

set the clock pres cale

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]prescalerclock pre scale
Returns
status code
  • 0 success
  • 1 set pre scale failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 prescaler must be >= 3
Note
prescaler >= 3

Definition at line 1604 of file driver_pca9685.c.

◆ pca9685_set_register_auto_increment()

uint8_t pca9685_set_register_auto_increment ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable the register auto increment

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set register auto increment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 363 of file driver_pca9685.c.

◆ pca9685_set_respond_all_call()

uint8_t pca9685_set_respond_all_call ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable respond all call

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set respond all call failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 773 of file driver_pca9685.c.

◆ pca9685_set_respond_subaddress_1()

uint8_t pca9685_set_respond_subaddress_1 ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable respond sub address 1

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set respond sub address 1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 527 of file driver_pca9685.c.

◆ pca9685_set_respond_subaddress_2()

uint8_t pca9685_set_respond_subaddress_2 ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable respond sub address 2

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set respond sub address 2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 609 of file driver_pca9685.c.

◆ pca9685_set_respond_subaddress_3()

uint8_t pca9685_set_respond_subaddress_3 ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable respond sub address 3

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set respond sub address 3 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 691 of file driver_pca9685.c.

◆ pca9685_set_restart()

uint8_t pca9685_set_restart ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable restart

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set restart failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 199 of file driver_pca9685.c.

◆ pca9685_set_sleep_mode()

uint8_t pca9685_set_sleep_mode ( pca9685_handle_t handle,
pca9685_bool_t  enable 
)

enable or disable the sleep mode

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set sleep mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 445 of file driver_pca9685.c.

◆ pca9685_set_subaddress_1()

uint8_t pca9685_set_subaddress_1 ( pca9685_handle_t handle,
uint8_t  addr 
)

set the sub address 1

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addrsub address 1
Returns
status code
  • 0 success
  • 1 set sub address 1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1183 of file driver_pca9685.c.

◆ pca9685_set_subaddress_2()

uint8_t pca9685_set_subaddress_2 ( pca9685_handle_t handle,
uint8_t  addr 
)

set the sub address 2

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addrsub address 2
Returns
status code
  • 0 success
  • 1 set sub address 2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1253 of file driver_pca9685.c.

◆ pca9685_set_subaddress_3()

uint8_t pca9685_set_subaddress_3 ( pca9685_handle_t handle,
uint8_t  addr 
)

set the sub address 3

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]addrsub address 3
Returns
status code
  • 0 success
  • 1 set sub address 3 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1323 of file driver_pca9685.c.

◆ pca9685_write_all_channel()

uint8_t pca9685_write_all_channel ( pca9685_handle_t handle,
uint16_t  on_count,
uint16_t  off_count 
)

write all led channels

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]on_countled on count
[in]off_countled off count
Returns
status code
  • 0 success
  • 1 write all channel failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 on_count or off_count is over 4096
Note
on_count <= 4096 && off_count <= 4096

Definition at line 1557 of file driver_pca9685.c.

◆ pca9685_write_channel()

uint8_t pca9685_write_channel ( pca9685_handle_t handle,
pca9685_channel_t  channel,
uint16_t  on_count,
uint16_t  off_count 
)

write led channels

Parameters
[in]*handlepointer to a pca9685 handle structure
[in]channelled channel
[in]on_countled on count
[in]off_countled off count
Returns
status code
  • 0 success
  • 1 write channel failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 on_count or off_count is over 4096
Note
on_count <= 4096 && off_count <= 4096

Definition at line 1466 of file driver_pca9685.c.