Skip to content

新增 sean_ws2812b 软件包 #1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025
Merged

新增 sean_ws2812b 软件包 #1886

merged 1 commit into from
May 17, 2025

Conversation

godmial
Copy link

@godmial godmial commented Apr 29, 2025

新增软件包:sean_ws2812b

简介

新增 sean_ws2812b 灯带驱动软件包,基于 SPI 接口控制 WS2812B RGB 灯带,适用于 RT-Thread 4.1.0 系统。

该软件包体积小巧、接口规范、功能完整,支持单颗灯珠控制、批量设置、全局亮度调整以及内置 Gamma 校正。

功能特性

  • 支持通过 SPI 接口控制 WS2812B 灯带
  • 支持单颗灯珠独立设置颜色
  • 支持批量设置所有灯珠颜色
  • 支持全局亮度调节(0~255)
  • 支持 Gamma 矫正,亮度更自然
  • 提供基础灯效示例(如流水灯、呼吸灯)
  • 支持 Kconfig 配置 SPI 总线、设备名称、片选引脚、灯珠数量等参数
  • 提供详细的 README.md 使用说明文档

适配平台

  • 当前版本基于 RT-Thread 4.1.0 设计
  • 实测平台:
    • STM32F103(主频48MHz)运行正常
    • STM32H743(主频68MHz)运行正常

使用说明

  • 需要在 RT-Thread menuconfig 中开启 SPI 驱动(RT_USING_SPI)
  • 在工程 board.h 文件中取消注释对应的 SPI 总线宏
  • 在 STM32CubeMX 中配置 SPI 接口为 "半双工单向发送(Transmit Only Half Duplex)" 模式

详细使用方法和注意事项请参考软件包自带的 README.md

TODO清单

  • 增加基于 PWM 方式的 WS2812B 驱动支持
  • 适配 RT-Thread 5.1.0 及以上版本

许可协议

本软件包遵循 Apache-2.0 许可证。


@supperthomas supperthomas requested a review from Copilot May 15, 2025 01:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new WS2812B LED strip driver package for RT-Thread 4.1.0, which is controlled over SPI and includes configurable parameters via Kconfig as well as a package manifest in package.json.

  • Added package.json with metadata and configuration for the new package.
  • Created a dedicated Kconfig file to enable and configure the package options.
  • Updated the peripherals/Kconfig to include the new package.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
peripherals/sean_ws2812b/package.json Added package manifest with metadata and repository info.
peripherals/sean_ws2812b/Kconfig Introduced Kconfig options for the new WS2812B driver.
peripherals/Kconfig Updated to source the new package’s Kconfig file.

@supperthomas
Copy link
Member

当前版本基于 RT-Thread 4.1.0 设计? 现在master上的代码可以试下吗?能编译通过吗?

@godmial
Copy link
Author

godmial commented May 15, 2025

你好,目前在RT-Thread 4.1.0版本上验证过,4.1.0版本使用SPI需要使用rt_hw_spi_device_attach函数将一个 SPI 设备挂载到SPI 总线上,所以不支持rt_hw_spi_device_attach函数的更高版本都暂时编译不通过。

@supperthomas supperthomas requested a review from Rbb666 May 15, 2025 02:07
@Rbb666
Copy link
Member

Rbb666 commented May 15, 2025

你好,目前在RT-Thread 4.1.0版本上验证过,4.1.0版本使用SPI需要使用rt_hw_spi_device_attach函数将一个 SPI 设备挂载到SPI 总线上,所以不支持rt_hw_spi_device_attach函数的更高版本都暂时编译不通过。

rt_hw_spi_device_attach这个函数在主线版本的drv_spi中都会包含

@godmial
Copy link
Author

godmial commented May 15, 2025

你好,目前在RT-Thread 4.1.0版本上验证过,4.1.0版本使用SPI需要使用rt_hw_spi_device_attach函数将一个 SPI 设备挂载到SPI 总线上,所以不支持rt_hw_spi_device_attach函数的更高版本都暂时编译不通过。

rt_hw_spi_device_attach这个函数在主线版本的drv_spi中都会包含

收到,在合并之后我会尽快适配各个不同版本以及增加PWM方式驱动

@Rbb666 Rbb666 merged commit d0ea67f into RT-Thread:master May 17, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants