跳转到内容

SensorLed::WS2812B API

文档稀疏
符号
59
已记录
3
类型
2
继承关系
0
源码分支
main

56 / 59 个公开 API 符号没有说明。

共 2 个类型

类型目录
类

sensors::led::WS2812B

查看源码

WS2812B Finiteframes using a dedicated timer's CC-triggered circular DMA. RGB N is the strip length; BufferLen is the TOTAL waveform capacity in LED units, not the strip length and not the capacity of one half. Only theframe is stored per LED. Each DMA half is refilled in its consumed-half interrupt. The application must service interrupts and finish each refill before DMA returns to that half (24 * BufferLen / 2 bit periods). Exclusively owned timer, up-counting edge-aligned PWM1, active-high output, CCR preload enabled, initial Pulse=0, no repetition/slave/one-pulse mode or CC control preload; update events must remain enabled. The bit rate MUST be 800 kbit/s. ARR therefore counts one 1.25 us bit; zero/one high times are derived from ARR as 24%/52% of the period, i.e. about 300 ns / 650 ns per bit. No timing argument is accepted. Linked CC DMA: circular, memory-to-peripheral, incrementing halfword memory, fixed halfword peripheral; CC DMA requests, not update DMA requests. The application configures the timer clock, PSC/ARR, GPIO AF, DMA request, DMA IRQ/HAL_DMA_IRQHandler, and any advanced-timer break/output settings. PWM mode, polarity, preload, GPIO pulls and idle/off-state levels must all be configured in CubeMX. The driver never reconfigures them. The stopped output must remain LOW; GPIO/advanced-timer idle settings are board-owned. It must ensure the actual pin is driven and the actual timing meets the LED datasheet. Ticks alone do not identify the timer's counter frequency. Validation uses HAL getters and Init metadata, not direct register reads. Settings without HAL getters are application preconditions; bypassing HAL or changing configuration externally is not detected by this driver. Hardware contract, checked by show where possible: Buffer is memory::DMABuffer<48 * BufferLen>, a 32-byte aligned byte array. It must reside in DMA-accessible SRAM (NOT the H7 default DTCM .bss). Place it using the project's linker/section scheme. The buffer must be noncacheable or hardware-coherent: this driver does not clean D-Cache. A barrier alone does not provide cache coherency. No cache policy is changed. One task owns all normal API calls. Only the three explicitly forwarded HAL callbacks run in ISR context. No callbacks are installed globally. Forward: HAL_TIM_PWM_PulseFinishedHalfCpltCallback -> onHalfTransfer; HAL_TIM_PWM_PulseFinishedCallback -> onTransferComplete; HAL_TIM_ErrorCallback -> onError. Buffer stop() Buffer Construction never touches HAL/peripherals and never sends an initial frame. Driver andmust outlive, asynchronous DMA abort completion (!isBusy()), and any forwarded callback. Detach forwarding before destroying the driver. The destructor deliberately does not invoke uninitialized HAL. Never access the borrowedwhile owned by this driver. Do not change timer/DMA configuration during its lifetime. Between frames PWM and DMA are stopped. The project's fixed GPIO/timer configuration must hold DIN LOW.

构造与析构

3

WS2812B

函数公开
        sensors::led::WS2812B< N, BufferLen >::WS2812B (TIM_HandleTypeDef *htim, std::uint32_t channel, Buffer &buffer) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:103

WS2812B

函数公开
        sensors::led::WS2812B< N, BufferLen >::WS2812B (WS2812B &&)=delete
      

上游未提供说明。

led/ws2812/WS2812B.hpp:110

WS2812B

函数公开
        sensors::led::WS2812B< N, BufferLen >::WS2812B (const WS2812B &)=delete
      

上游未提供说明。

led/ws2812/WS2812B.hpp:108

成员函数

24

alignFrameStart

函数私有
        bool sensors::led::WS2812B< N, BufferLen >::alignFrameStart () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:321

channelIndex

函数私有const
        unsigned sensors::led::WS2812B< N, BufferLen >::channelIndex () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:252

clear

函数公开
        bool sensors::led::WS2812B< N, BufferLen >::clear () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:129

consumed

函数私有
        void sensors::led::WS2812B< N, BufferLen >::consumed (TIM_HandleTypeDef *htim, unsigned half) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:419

dmaReady

函数私有const
        bool sensors::led::WS2812B< N, BufferLen >::dmaReady () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:274

dmaRequest

函数私有const
        std::uint32_t sensors::led::WS2812B< N, BufferLen >::dmaRequest () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:279

fill

函数公开
        bool sensors::led::WS2812B< N, BufferLen >::fill (Color color) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:121

fillHalf

函数私有
        void sensors::led::WS2812B< N, BufferLen >::fillHalf (unsigned half) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:361

getState

函数公开const
        State sensors::led::WS2812B< N, BufferLen >::getState () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:131

highTicks

函数私有静态
        static constexpr std::uint32_t sensors::led::WS2812B< N, BufferLen >::highTicks (std::uint32_t period, std::uint32_t percent) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:285

isBusy

函数公开const
        bool sensors::led::WS2812B< N, BufferLen >::isBusy () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:139

loadPixel

函数私有
        void sensors::led::WS2812B< N, BufferLen >::loadPixel () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:353

onError

函数公开
        void sensors::led::WS2812B< N, BufferLen >::onError (TIM_HandleTypeDef *htim) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:234

onHalfTransfer

函数公开
        void sensors::led::WS2812B< N, BufferLen >::onHalfTransfer (TIM_HandleTypeDef *htim) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:231

onTransferComplete

函数公开
        void sensors::led::WS2812B< N, BufferLen >::onTransferComplete (TIM_HandleTypeDef *htim) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:232

operator=

函数公开
        WS2812B & sensors::led::WS2812B< N, BufferLen >::operator= (WS2812B &&)=delete
      

上游未提供说明。

led/ws2812/WS2812B.hpp:111

operator=

函数公开
        WS2812B & sensors::led::WS2812B< N, BufferLen >::operator= (const WS2812B &)=delete
      

上游未提供说明。

led/ws2812/WS2812B.hpp:109

selectedDma

函数私有const
        DMA_HandleTypeDef * sensors::led::WS2812B< N, BufferLen >::selectedDma () const noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:257

setPixel

函数公开
        bool sensors::led::WS2812B< N, BufferLen >::setPixel (std::size_t index, Color color) noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:113

show

函数公开
        HAL_StatusTypeDef sensors::led::WS2812B< N, BufferLen >::show () noexcept
      

HAL_BUSY also covers an asynchronous abort still awaiting its DMA IRQ. stop() Errors remain visible until an explicitclears them after abort.

led/ws2812/WS2812B.hpp:149

stop

函数公开
        HAL_StatusTypeDef sensors::led::WS2812B< N, BufferLen >::stop () noexcept
      

Request a safe stop, or explicitly clear a latched error. HAL_BUSY means abort is pending: retain this object/Buffer and service the DMA IRQ before reuse/destruction. Does nothing to an unused timer. A mid-frame stop leaves the last CCR value; the next frame may begin with one invalid bit. Normal frame completion ends on all-zero padding.

led/ws2812/WS2812B.hpp:211

stopPwmDma

函数私有
        bool sensors::led::WS2812B< N, BufferLen >::stopPwmDma () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:344

txBarrier

函数私有静态
        static void sensors::led::WS2812B< N, BufferLen >::txBarrier () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:333

validConfiguration

函数私有
        bool sensors::led::WS2812B< N, BufferLen >::validConfiguration () noexcept
      

上游未提供说明。

led/ws2812/WS2812B.hpp:291

成员变量

19

HalfSampleBytes

变量公开静态
        std::size_t sensors::led::WS2812B< N, BufferLen >::HalfSampleBytes
      

上游未提供说明。

led/ws2812/WS2812B.hpp:84

HalfSampleCount

变量公开静态
        std::size_t sensors::led::WS2812B< N, BufferLen >::HalfSampleCount
      

上游未提供说明。

led/ws2812/WS2812B.hpp:82

ResetPeriods

变量公开静态
        std::uint32_t sensors::led::WS2812B< N, BufferLen >::ResetPeriods
      

上游未提供说明。

led/ws2812/WS2812B.hpp:90

SampleBytes

变量公开静态
        std::size_t sensors::led::WS2812B< N, BufferLen >::SampleBytes
      

上游未提供说明。

led/ws2812/WS2812B.hpp:83

SampleCount

变量公开静态
        std::size_t sensors::led::WS2812B< N, BufferLen >::SampleCount
      

上游未提供说明。

led/ws2812/WS2812B.hpp:81

bitMask_

变量私有
        std::uint32_t sensors::led::WS2812B< N, BufferLen >::bitMask_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:448

channel_

变量私有
        const std::uint32_t sensors::led::WS2812B< N, BufferLen >::channel_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:437

dma_

变量私有
        DMA_HandleTypeDef* sensors::led::WS2812B< N, BufferLen >::dma_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:443

htim_

变量私有
        TIM_HandleTypeDef* const sensors::led::WS2812B< N, BufferLen >::htim_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:436

oneHighTicks_

变量私有
        std::uint16_t sensors::led::WS2812B< N, BufferLen >::oneHighTicks_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:440

paddingHalf_

变量私有
        bool sensors::led::WS2812B< N, BufferLen >::paddingHalf_[2] [2]
      

上游未提供说明。

led/ws2812/WS2812B.hpp:449

pixelIndex_

变量私有
        std::size_t sensors::led::WS2812B< N, BufferLen >::pixelIndex_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:446

pixelWord_

变量私有
        std::uint32_t sensors::led::WS2812B< N, BufferLen >::pixelWord_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:447

pixels_

变量私有
        std::array<Color, N> sensors::led::WS2812B< N, BufferLen >::pixels_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:441

resetRemaining_

变量私有
        std::size_t sensors::led::WS2812B< N, BufferLen >::resetRemaining_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:445

state_

变量私有
        std::atomic<State> sensors::led::WS2812B< N, BufferLen >::state_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:442

zeroHighTicks_

变量私有
        std::uint16_t sensors::led::WS2812B< N, BufferLen >::zeroHighTicks_
      

上游未提供说明。

led/ws2812/WS2812B.hpp:439

嵌套类型

6

Buffer

类型定义公开
        using sensors::led::WS2812B< N, BufferLen >::Buffer = memory::DMABuffer<SampleBytes>
      

上游未提供说明。

led/ws2812/WS2812B.hpp:86

CacheClean

类型定义公开
        using sensors::led::WS2812B< N, BufferLen >::CacheClean = void (*)(const void*, std::size_t)
      

上游未提供说明。

led/ws2812/WS2812B.hpp:92

Phase

枚举私有

上游未提供说明。

LeadingReset
上游未提供说明。
Padding
上游未提供说明。
Pixels
上游未提供说明。
TrailingReset
上游未提供说明。
led/ws2812/WS2812B.hpp:244

RGB

类型定义公开
        using sensors::led::WS2812B< N, BufferLen >::RGB = Color
      

上游未提供说明。

led/ws2812/WS2812B.hpp:79

State

枚举公开

上游未提供说明。

Error
上游未提供说明。
Idle
上游未提供说明。
Sending
上游未提供说明。
Stopping
上游未提供说明。
led/ws2812/WS2812B.hpp:93
结构体

sensors::led::WS2812B::Color

查看源码

上游未提供类型说明。

成员变量

3

其他公开符号

文件

1