-
Notifications
You must be signed in to change notification settings - Fork 2
/
BlinkyShield.h
46 lines (41 loc) · 1.17 KB
/
BlinkyShield.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef BLINKYSHIELD_H
#define BLINKYSHIELD_H
#include "mbed.h"
#include "PixelArray.h"
#include "WS2812.h"
#include "Adafruit_GFX.h"
#define STRIPLEN 40
#define RED (0x1f << 11)
#define GREEN (0x3f << 5)
#define BLUE (0x1f)
#define YELLOW RED|GREEN
#define MAGENTA RED|BLUE
#define CYAN GREEN|BLUE
#define WHITE RED|GREEN|BLUE
class BlinkyShield : public Adafruit_GFX
{
public:
BlinkyShield(PinName pin=D6);
~BlinkyShield();
void wipeColor(uint16_t color, uint8_t n_pixels=STRIPLEN);
void red(uint8_t n_pixels=STRIPLEN);
void green(uint8_t n_pixels=STRIPLEN);
void blue(uint8_t n_pixels=STRIPLEN);
void off();
void drawPixel(int16_t x, int16_t y, uint16_t color);
void scroll(const char *fmt, ...);
void clear();
void setIntensity(uint8_t intensity);
uint16_t colorCvt(uint32_t color);
uint32_t colorCvtRev(uint16_t color);
uint16_t color(uint8_t r, uint8_t g, uint8_t b);
uint32_t numPixels();
void setPixelColor(uint8_t x, uint8_t y, uint16_t color);
void setPixelColor(uint16_t n, uint16_t color);
void show();
uint32_t colorWheel(uint8_t wheel_pos);
private:
PixelArray* _px;
WS2812* _shield;
};
#endif