54 uint8_t addr_value, addr_value_check;
55 uint8_t prescaler, prescaler_check;
56 uint16_t output_freq, output_freq_check;
58 float delay_percent, high_duty_cycle_percent;
59 float delay_percent_check, high_duty_cycle_percent_check;
60 uint16_t on_count, off_count;
61 uint16_t on_count_check, off_count_check;
110 addr_value = rand() % 256;
131 for (i = 0; i < 64; i++)
193 prescaler = rand() % 200 + 3;
744 addr_value = rand() % 256;
745 addr_value &= ~(1 << 0);
768 addr_value = rand() % 256;
769 addr_value &= ~(1 << 0);
792 addr_value = rand() % 256;
793 addr_value &= ~(1 << 0);
816 addr_value = rand() % 256;
817 addr_value &= ~(1 << 0);
840 output_freq = rand() % (1526 - 24) + 24;
863 delay_percent = rand() % 10 + 10.5f;
864 high_duty_cycle_percent = rand() % 50 + 5.6f;
877 res =
pca9685_pwm_convert_to_data(&gs_handle, on_count, off_count, (
float *)&delay_percent_check, (
float *)&high_duty_cycle_percent_check);
891 for (i = 0; i < 16; i++)
894 on_count = rand() % 2048;
895 off_count = on_count + rand() % 2048;
907 res =
pca9685_read_channel(&gs_handle, channel, (uint16_t *)&on_count_check, (uint16_t *)&off_count_check);
922 on_count = rand() % 2048;
923 off_count = on_count + rand() % 2048;
driver pca9685 register test header file
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
uint8_t pca9685_set_prescaler(pca9685_handle_t *handle, uint8_t prescaler)
set the clock pres cale
uint8_t pca9685_write_channel(pca9685_handle_t *handle, pca9685_channel_t channel, uint16_t on_count, uint16_t off_count)
write led channels
pca9685_bool_t
pca9685 bool enumeration definition
uint8_t pca9685_get_subaddress_1(pca9685_handle_t *handle, uint8_t *addr)
get the sub address 1
uint8_t pca9685_write_all_channel(pca9685_handle_t *handle, uint16_t on_count, uint16_t off_count)
write all led channels
pca9685_address_t
pca9685 address enumeration definition
uint8_t pca9685_get_addr_pin(pca9685_handle_t *handle, pca9685_address_t *addr_pin)
get the address pin
uint8_t pca9685_set_addr(pca9685_handle_t *handle, uint8_t addr)
set the address
uint8_t pca9685_get_respond_all_call(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the respond all call status
uint8_t pca9685_set_respond_all_call(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable respond all call
uint8_t pca9685_init(pca9685_handle_t *handle)
initialize the chip
uint8_t pca9685_set_active(pca9685_handle_t *handle, pca9685_bool_t enable)
set the chip active
uint8_t pca9685_get_output_change(pca9685_handle_t *handle, pca9685_output_change_t *change)
get the output change type
uint8_t pca9685_get_all_call_address(pca9685_handle_t *handle, uint8_t *addr)
set the all call address
uint8_t pca9685_set_addr_pin(pca9685_handle_t *handle, pca9685_address_t addr_pin)
set the address pin
uint8_t pca9685_get_external_clock_pin(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the external clock pin status
pca9685_output_disable_type_t
pca9685 output disable type enumeration definition
uint8_t pca9685_get_restart(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the restart status
uint8_t pca9685_set_output_driver(pca9685_handle_t *handle, pca9685_output_driver_t driver)
set the output driver type
uint8_t pca9685_set_respond_subaddress_2(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable respond sub address 2
uint8_t pca9685_get_prescaler(pca9685_handle_t *handle, uint8_t *prescaler)
get the clock pre scale
uint8_t pca9685_get_addr(pca9685_handle_t *handle, uint8_t *addr)
get the address
uint8_t pca9685_get_sleep_mode(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the sleep mode status
uint8_t pca9685_set_output_disable_type(pca9685_handle_t *handle, pca9685_output_disable_type_t type)
set the output disable type
uint8_t pca9685_get_subaddress_3(pca9685_handle_t *handle, uint8_t *addr)
get the sub address 3
uint8_t pca9685_read_channel(pca9685_handle_t *handle, pca9685_channel_t channel, uint16_t *on_count, uint16_t *off_count)
read led channels
uint8_t pca9685_get_output_driver(pca9685_handle_t *handle, pca9685_output_driver_t *driver)
get the output driver type
uint8_t pca9685_set_subaddress_2(pca9685_handle_t *handle, uint8_t addr)
set the sub address 2
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
uint8_t pca9685_set_register_auto_increment(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable the register auto increment
uint8_t pca9685_set_respond_subaddress_3(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable respond sub address 3
uint8_t pca9685_info(pca9685_info_t *info)
get chip's information
uint8_t pca9685_set_output_invert(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable output invert
uint8_t pca9685_get_respond_subaddress_2(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the respond sub address 2 status
uint8_t pca9685_get_subaddress_2(pca9685_handle_t *handle, uint8_t *addr)
get the sub address 2
pca9685_channel_t
pca9685 channel enumeration definition
uint8_t pca9685_get_output_disable_type(pca9685_handle_t *handle, pca9685_output_disable_type_t *type)
get the output disable type
uint8_t pca9685_set_subaddress_1(pca9685_handle_t *handle, uint8_t addr)
set the sub address 1
uint8_t pca9685_set_restart(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable restart
#define PCA9685_OSCILLATOR_INTERNAL_FREQUENCY
pca9685 internal oscillator frequency
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
pca9685_output_driver_t
pca9685 output driver enumeration definition
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
uint8_t pca9685_set_sleep_mode(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable the sleep mode
uint8_t pca9685_get_respond_subaddress_1(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the respond sub address 1 status
uint8_t pca9685_get_output_invert(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the output invert status
uint8_t pca9685_set_external_clock_pin(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable the external clock pin
pca9685_output_change_t
pca9685 output change enumeration definition
uint8_t pca9685_deinit(pca9685_handle_t *handle)
close the chip
uint8_t pca9685_get_respond_subaddress_3(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the respond sub address 3 status
uint8_t pca9685_set_respond_subaddress_1(pca9685_handle_t *handle, pca9685_bool_t enable)
enable or disable respond sub address 1
uint8_t pca9685_set_subaddress_3(pca9685_handle_t *handle, uint8_t addr)
set the sub address 3
uint8_t pca9685_set_all_call_address(pca9685_handle_t *handle, uint8_t addr)
set the all call address
uint8_t pca9685_set_output_change(pca9685_handle_t *handle, pca9685_output_change_t change)
set the output change type
uint8_t pca9685_get_register_auto_increment(pca9685_handle_t *handle, pca9685_bool_t *enable)
get the register auto increment status
@ PCA9685_OUTPUT_DISABLE_TYPE_LEDN_LOW
@ PCA9685_OUTPUT_DISABLE_TYPE_OUTDRV_1_LEDN_LOW_OUTDRV_0_HIGH_IMPEDANCE
@ PCA9685_OUTPUT_DISABLE_TYPE_HIGH_IMPEDANCE
@ PCA9685_OUTPUT_DRIVER_TOTEM_POLE
@ PCA9685_OUTPUT_DRIVER_OPEN_DRAIN
@ PCA9685_OUTPUT_CHANGE_STOP
@ PCA9685_OUTPUT_CHANGE_ACK
void pca9685_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t pca9685_interface_oe_deinit(void)
interface oe deinit
uint8_t pca9685_interface_oe_init(void)
interface oe init
uint8_t pca9685_interface_iic_deinit(void)
interface iic bus deinit
uint8_t pca9685_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
uint8_t pca9685_interface_iic_init(void)
interface iic bus init
void pca9685_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t pca9685_interface_oe_write(uint8_t value)
interface oe write
uint8_t pca9685_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
#define DRIVER_PCA9685_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
#define DRIVER_PCA9685_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
#define DRIVER_PCA9685_LINK_IIC_READ(HANDLE, FUC)
link iic_read function
#define DRIVER_PCA9685_LINK_OE_GPIO_INIT(HANDLE, FUC)
link oe_gpio_init function
#define DRIVER_PCA9685_LINK_INIT(HANDLE, STRUCTURE)
initialize pca9685_handle_t structure
#define DRIVER_PCA9685_LINK_OE_GPIO_DEINIT(HANDLE, FUC)
link oe_gpio_deinit function
#define DRIVER_PCA9685_LINK_OE_GPIO_WRITE(HANDLE, FUC)
link oe_gpio_write function
#define DRIVER_PCA9685_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_PCA9685_LINK_IIC_WEITE(HANDLE, FUC)
link iic_write function
#define DRIVER_PCA9685_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
uint8_t pca9685_register_test(pca9685_address_t addr)
register test
pca9685 handle structure definition
pca9685 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v