项目介绍

henriheimann/stm32-hal-pca9685 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,目前获得 31 个 Star、10 次 Fork。

仓库全名
henriheimann/stm32-hal-pca9685
Star 数
31
Fork 数
10
未关闭 Issue
1

README 摘要

PCA9685 Driver for the PCA9685 16 channel 12-bit PWM driver used in this Adafruit product: https://www.adafruit.com/product/815 Usage After connecting the PCA9685 driver to your microcontroller via I2C and initialising the bus using Cube you can use this library to interact with the driver as shown in the following example: Supported Platforms STM32L0 and STM32L4 are supported. The HAL header includes for other…

完整内容见 GitHub 原始 README 或本页 。

常见问题

stm32-hal-pca9685 用什么语言开发?

主要使用 C 编写,目前有 31 个 Star。

如何获取 stm32-hal-pca9685 的源码?

可以直接克隆仓库:git clone https://github.com/henriheimann/stm32-hal-pca9685.git;安装与运行步骤见仓库 README。

stm32-hal-pca9685 最近还在维护吗?

仓库最近一次更新为 2020年4月23日,当前有 1 个未关闭 Issue;Star 数为 31,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Driver for the PCA9685 12-bit PWM driver using STM32Cube HAL

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
82
价值分
24
活跃状态
活跃

README

PCA9685

Driver for the PCA9685 16 channel 12-bit PWM driver used in this Adafruit product: https://www.adafruit.com/product/815

Usage

After connecting the PCA9685 driver to your microcontroller via I2C and initialising the bus using Cube you can use this library to interact with the driver as shown in the following example:

// Create the handle for the driver.
pca9685_handle_t handle = {
    .i2c_handle = &hi2c1,
    .device_address = PCA9865_I2C_DEFAULT_DEVICE_ADDRESS,
    .inverted = false
};

// Initialise driver (performs basic setup).
pca9685_init(&handle);

// Set PWM frequency.
// The frequency must be between 24Hz and 1526Hz.
pca9685_set_pwm_frequency(&handle, 100.0f);

// Set the channel on and off times.
// The channel must be >= 0 and < 16.
// The on and off times must be >= 0 and < 4096.
// In this example, the duty cycle is (off time - on time) / 4096 = (2048 - 0) / 4096 = 50%
pca9685_set_channel_pwm_times(&handle, 0, 0, 2048);

// If you do not want to set the times by hand you can directly set the duty cycle. The last parameter
// lets you use a logarithmic scale for LED dimming applications.
pca9685_set_channel_duty_cycle(&handle, 1, 0.5f, false); 

Supported Platforms

STM32L0 and STM32L4 are supported. The HAL header includes for other platforms may be added in pca9685.h.

评论

暂无评论