WS2812 RMT Driver
API reference
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
WS2812Animator Class Reference

Helper class implementing a few basic WS2812 LED animations. More...

#include <ws2812_effects.hpp>

Public Types

enum class  Effect {
  Off , SolidColor , Rainbow , Chase ,
  Blink , Breath , Larson
}
 

Public Member Functions

 WS2812Animator (WS2812Strip &strip, uint32_t virtual_length=0)
 
void SetEffect (Effect effect, uint32_t color=0xFFFFFF)
 Select the active effect.
 
void SetVirtualLength (uint32_t length)
 
void SetStep (uint16_t step)
 
uint16_t Step () const
 
void Tick ()
 Advance the animation by one step.
 

Detailed Description

Helper class implementing a few basic WS2812 LED animations.

Call tick() periodically (for example from a FreeRTOS task) to update the currently selected effect.

Member Enumeration Documentation

◆ Effect

enum class WS2812Animator::Effect
strong
Enumerator
Off 
SolidColor 
Rainbow 
Chase 
Blink 
Breath 
Larson 

Constructor & Destructor Documentation

◆ WS2812Animator()

WS2812Animator::WS2812Animator ( WS2812Strip &  strip,
uint32_t  virtual_length = 0 
)
explicit

Member Function Documentation

◆ SetEffect()

void WS2812Animator::SetEffect ( Effect  effect,
uint32_t  color = 0xFFFFFF 
)

Select the active effect.

Parameters
effectDesired pattern.
colorBase colour used by some effects.

◆ SetStep()

void WS2812Animator::SetStep ( uint16_t  step)

Set the current step (used for external synchronization).

◆ SetVirtualLength()

void WS2812Animator::SetVirtualLength ( uint32_t  length)

Adjust the virtual length used for effects.

◆ Step()

uint16_t WS2812Animator::Step ( ) const

◆ Tick()

void WS2812Animator::Tick ( )

Advance the animation by one step.


The documentation for this class was generated from the following files: