This software is a SPI driver for WS2812 LED controller based LED ring.
D_in pin of device should be connected to MOSI of SPI bus 1. Vcc and GND at appropriate pin locations.
The driver is installed using command line directed at the driver file location, with following commands
- make (only in host system)
- insmod WS2812_device.ko
- insmod WS2812_driver.ko
The user level code can access the device files and run the user level code using 4) ./testapp
The driver can be uninstalled using 5) rmmod WS2812_device.ko 6) rmmod WS2812_driver.ko 7) make clean (only in host system)
OR
- bash run.sh (only in host system)
- bash runapp.sh
Device file is created in /dev folder with "WS2812" name. This needs to be opened to interact with the device.
The device file should be closed after use to maintain proper functioning of the devices.
To reset the device, RESET command is passed to the device with no arguments i.e. NULL.
0 and 1 are represented by 10 bits. Writing to the device is done using an array of 480 consecutive bytes. ((16leds * 24bitRGB * 10bits) / 8bits = 480 bytes) 0 = 1110000000 1 = 1111110000