MetroWind / led-drive

A naively simple WS2812 LED stripe driver for the Raspberry Pi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LED-Drive

A naively simple WS2812 LED stripe driver for the Raspberry Pi.

Introduction

LED-Drive is a simple program that drives a WS2812-based LED stripe using Raspberry Pi’s SPI output. It sounds like an easy task, but there are actually a surprising amount of caveats to navigate.

SPI drivers

There are two SPI drivers on the Raspberry Pi:

  • The Linux standard spidev high level driver

  • The BCM2835 low level driver

The spidev driver is generic regardless of hardware. It basically creates a bunch of /dev/spidev?.? devices, and let you do I/O on them like on a regular file using read, write, and ioctl system calls. The BCM driver is obviously specific to the BCM chip that is on the Pi, and it uses the GPIO pins directly (/dev/mem or /dev/gpiomem) to control the SPI. In LED-Drive, a high level wrapper of it is used.

LED-Driver has implementations on top of both SPI drivers. However, due to the strict timing requirements (I think) of the WS2812 chip, only the BCM driver works (to a certain degree). The spidev driver never worked for me.

Timing and SPI frequency

WIP

Usage

WIP

About

A naively simple WS2812 LED stripe driver for the Raspberry Pi.

License:Do What The F*ck You Want To Public License


Languages

Language:C++ 94.6%Language:CMake 4.5%Language:Shell 0.9%