Paparazzi UAS  v5.15_devel-112-g521f3cf
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
light_scheduler module

Basic light scheduler using WS2812 driver

WS2812 are small RGB leds controlled with a 1-wire protocol. This module is an example of controlling several leds with the color changing continuously. Implementation for ChibiOS using DMA.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

1 <module name="light_scheduler">
2  <define name="WS2812_NB_LEDS" value="8" />
3 </module>

Module configuration options

Define Options

  • name: WS2812_NB_LEDS value: 8
    Description: Number of leds

Module functions

Init Functions

These initialization functions are called once on startup.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • light_scheduler_periodic()
    • Frequency in Hz: 8
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw light_scheduler.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="light_scheduler" dir="light">
<doc>
<description>
Basic light scheduler using WS2812 driver
WS2812 are small RGB leds controlled with a 1-wire protocol.
This module is an example of controlling several leds with the color changing continuously.
Implementation for ChibiOS using DMA.
</description>
<define name="WS2812_NB_LEDS" value="8" description="Number of leds"/>
</doc>
<header>
<file name="light_scheduler.h"/>
</header>
<init fun="light_scheduler_init()"/>
<periodic fun="light_scheduler_periodic()" freq="8"/>
<makefile target="ap">
<file name="light_scheduler.c"/>
<file_arch name="light_ws2812_arch.c"/>
<file_arch name="hal_stm32_dma.c" dir="mcu_periph" cond="ifeq ($(RTOS),chibios)"/>
<define name="STM32_PWM_USE_TIM1" value="TRUE" cond="ifeq ($(RTOS),chibios)"/>
</makefile>
</module>