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

Dependencies:   WS2812 PixelArray

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Wio_Cellular_LED.h Source File

Wio_Cellular_LED.h

00001 #include "WS2812.h"
00002 #include "PixelArray.h"
00003 
00004 #define WS2812_BUF 8
00005 #define NUM_COLORS 8
00006 #define NUM_LEDS_PER_COLOR 8
00007 #define H0 8
00008 #define L0 32
00009 #define H1 17
00010 #define L1 32
00011 
00012 DigitalOut LEDPower(PE_8, 1);
00013 PixelArray px(WS2812_BUF);
00014 WS2812 ws(PB_1, WS2812_BUF, H0, L0, H1, L1);
00015 
00016 const int colorbuf[NUM_COLORS] = {0x000000, 0x2f0000,0x2f2f00,0x002f00,0x002f2f,0x00002f,0x2f002f, 0x2f2f2f};
00017 
00018 enum ws2812_color {
00019     WS2812_BLACK = 0,
00020     WS2812_RED,
00021     WS2812_YELLOW,
00022     WS2812_GREEN,
00023     WS2812_CYAN,
00024     WS2812_BLUE,
00025     WS2812_PURPLE,
00026     WS2812_WHITE
00027 };
00028 
00029 void setcolor(int color)
00030 {
00031     px.Set(0, colorbuf[color]);
00032     px.SetI(0, 0x80);
00033     ws.write_offsets(px.getBuf(), 0, 0, 0);
00034 
00035 }