Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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!

<module name="light_scheduler">
b'<define name="WS2812_NB_LEDS" value="8" />\n '
b'<configure name="WS2812_TIM" value="TIM1" />\n '
</module>

Module configuration options

Configure Options

  • name: WS2812_TIM value: TIM1
    Description: Select the timer used to control the LEDs

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>
<configure name="WS2812_TIM" value="TIM1" description="Select the timer used to control the LEDs"/>
<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">
<configure name="WS2812_TIM" default="TIM1" case="upper"/>
<define name="STM32_PWM_USE_$(WS2812_TIM)" cond="ifeq ($(RTOS),chibios)"/>
<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)"/>
</makefile>
</module>