On board LED blinky example for Wio cellular targets - Seeed Wio 3G and Wio LTE-M1/NB1(BG96)

Dependencies:   WS2812 PixelArray

Committer:
MACRUM
Date:
Wed Feb 13 02:03:15 2019 +0000
Revision:
4:bd5780849912
Parent:
3:d48c9a684738
Add error macro

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 1:194e3cf73e72 1 #include "WS2812.h"
MACRUM 1:194e3cf73e72 2 #include "PixelArray.h"
MACRUM 1:194e3cf73e72 3
MACRUM 1:194e3cf73e72 4 #define WS2812_BUF 8
MACRUM 1:194e3cf73e72 5 #define NUM_COLORS 8
MACRUM 1:194e3cf73e72 6 #define NUM_LEDS_PER_COLOR 8
MACRUM 1:194e3cf73e72 7 #define H0 8
MACRUM 1:194e3cf73e72 8 #define L0 32
MACRUM 1:194e3cf73e72 9 #define H1 17
MACRUM 1:194e3cf73e72 10 #define L1 32
MACRUM 1:194e3cf73e72 11
MACRUM 1:194e3cf73e72 12 DigitalOut LEDPower(PE_8, 1);
MACRUM 1:194e3cf73e72 13 PixelArray px(WS2812_BUF);
MACRUM 1:194e3cf73e72 14 WS2812 ws(PB_1, WS2812_BUF, H0, L0, H1, L1);
MACRUM 1:194e3cf73e72 15
MACRUM 1:194e3cf73e72 16 const int colorbuf[NUM_COLORS] = {0x000000, 0x2f0000,0x2f2f00,0x002f00,0x002f2f,0x00002f,0x2f002f, 0x2f2f2f};
MACRUM 1:194e3cf73e72 17
MACRUM 1:194e3cf73e72 18 enum ws2812_color {
MACRUM 1:194e3cf73e72 19 WS2812_BLACK = 0,
MACRUM 1:194e3cf73e72 20 WS2812_RED,
MACRUM 1:194e3cf73e72 21 WS2812_YELLOW,
MACRUM 1:194e3cf73e72 22 WS2812_GREEN,
MACRUM 1:194e3cf73e72 23 WS2812_CYAN,
MACRUM 1:194e3cf73e72 24 WS2812_BLUE,
MACRUM 1:194e3cf73e72 25 WS2812_PURPLE,
MACRUM 1:194e3cf73e72 26 WS2812_WHITE
MACRUM 1:194e3cf73e72 27 };
MACRUM 1:194e3cf73e72 28
MACRUM 1:194e3cf73e72 29 void setcolor(int color)
MACRUM 1:194e3cf73e72 30 {
MACRUM 1:194e3cf73e72 31 px.Set(0, colorbuf[color]);
MACRUM 1:194e3cf73e72 32 px.SetI(0, 0x80);
MACRUM 1:194e3cf73e72 33 ws.write_offsets(px.getBuf(), 0, 0, 0);
MACRUM 1:194e3cf73e72 34
MACRUM 1:194e3cf73e72 35 }