Switch element pro UI
This commit is contained in:
parent
22cd8ef1e0
commit
0445129e48
13
src/elements/switch.cpp
Normal file
13
src/elements/switch.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "switch.h"
|
||||||
|
#include "../graphics/glyphs.h"
|
||||||
|
|
||||||
|
void drawSwitch(OLEDDisplay *display, int16_t x, int16_t y, bool state)
|
||||||
|
{
|
||||||
|
String str = F("0");
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
str = F("1");
|
||||||
|
display->setFont(CHECKBOX);
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display->drawString(x, y, str);
|
||||||
|
}
|
7
src/elements/switch.h
Normal file
7
src/elements/switch.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef _SWITCH_H_
|
||||||
|
#define _SWITCH_H_
|
||||||
|
#include "OLEDUIPlus.h"
|
||||||
|
|
||||||
|
void drawSwitch(OLEDDisplay *display, int16_t x, int16_t y, bool state);
|
||||||
|
|
||||||
|
#endif
|
21
src/graphics/switch.h
Normal file
21
src/graphics/switch.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#define switch_on_width 34
|
||||||
|
#define switch_on_height 16
|
||||||
|
const uint8_t switch_on_bits[] PROGMEM = {
|
||||||
|
0xff, 0x00, 0x00, 0xfc, 0x03, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x1f, 0x00,
|
||||||
|
0x00, 0xe0, 0x03, 0x0f, 0x00, 0xe0, 0xc3, 0x03, 0x07, 0x00, 0xf0, 0x87,
|
||||||
|
0x03, 0x07, 0x00, 0xf8, 0x8f, 0x03, 0x07, 0x00, 0xf8, 0x9f, 0x03, 0x07,
|
||||||
|
0x00, 0xfc, 0x9f, 0x03, 0x03, 0x00, 0xf8, 0x0f, 0x03, 0x07, 0x00, 0xf8,
|
||||||
|
0x9f, 0x03, 0x07, 0x00, 0xf8, 0x8f, 0x03, 0x07, 0x00, 0xf0, 0x87, 0x03,
|
||||||
|
0x0f, 0x00, 0xe0, 0xc3, 0x03, 0x1f, 0x00, 0x00, 0xe0, 0x03, 0x3f, 0x00,
|
||||||
|
0x00, 0xf0, 0x03, 0xff, 0x00, 0x00, 0xfc, 0x03 };
|
||||||
|
|
||||||
|
#define switch_off_width 34
|
||||||
|
#define switch_off_height 16
|
||||||
|
const uint8_t switch_off_bits[] PROGMEM = {
|
||||||
|
0xff, 0x00, 0x00, 0xfc, 0x03, 0x3f, 0x48, 0xa9, 0xf0, 0x03, 0x9f, 0xff,
|
||||||
|
0xff, 0xe7, 0x03, 0x4f, 0xe0, 0xff, 0xcf, 0x03, 0x27, 0x80, 0xff, 0x9f,
|
||||||
|
0x03, 0x27, 0x80, 0xff, 0x9f, 0x03, 0x17, 0x00, 0xff, 0xbf, 0x03, 0x13,
|
||||||
|
0x00, 0xff, 0x3f, 0x03, 0x17, 0x00, 0xff, 0xbf, 0x03, 0x17, 0x00, 0xff,
|
||||||
|
0xbf, 0x03, 0x27, 0x80, 0xff, 0x9f, 0x03, 0x27, 0xc0, 0xff, 0x9f, 0x03,
|
||||||
|
0xcf, 0xe0, 0xff, 0xcf, 0x03, 0x9f, 0xff, 0xff, 0xe7, 0x03, 0x3f, 0x40,
|
||||||
|
0x92, 0xf0, 0x03, 0xff, 0x00, 0x00, 0xfc, 0x03 };
|
10
src/graphics/switch_off.xbm
Normal file
10
src/graphics/switch_off.xbm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#define switch_off_width 34
|
||||||
|
#define switch_off_height 16
|
||||||
|
static unsigned char switch_off_bits[] = {
|
||||||
|
0xff, 0x00, 0x00, 0xfc, 0x03, 0x3f, 0x48, 0xa9, 0xf0, 0x03, 0x9f, 0xff,
|
||||||
|
0xff, 0xe7, 0x03, 0x4f, 0xe0, 0xff, 0xcf, 0x03, 0x27, 0x80, 0xff, 0x9f,
|
||||||
|
0x03, 0x27, 0x80, 0xff, 0x9f, 0x03, 0x17, 0x00, 0xff, 0xbf, 0x03, 0x13,
|
||||||
|
0x00, 0xff, 0x3f, 0x03, 0x17, 0x00, 0xff, 0xbf, 0x03, 0x17, 0x00, 0xff,
|
||||||
|
0xbf, 0x03, 0x27, 0x80, 0xff, 0x9f, 0x03, 0x27, 0xc0, 0xff, 0x9f, 0x03,
|
||||||
|
0xcf, 0xe0, 0xff, 0xcf, 0x03, 0x9f, 0xff, 0xff, 0xe7, 0x03, 0x3f, 0x40,
|
||||||
|
0x92, 0xf0, 0x03, 0xff, 0x00, 0x00, 0xfc, 0x03 };
|
10
src/graphics/switch_on.xbm
Normal file
10
src/graphics/switch_on.xbm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#define switch_on_width 34
|
||||||
|
#define switch_on_height 16
|
||||||
|
static unsigned char switch_on_bits[] = {
|
||||||
|
0xff, 0x00, 0x00, 0xfc, 0x03, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x1f, 0x00,
|
||||||
|
0x00, 0xe0, 0x03, 0x0f, 0x00, 0xe0, 0xc3, 0x03, 0x07, 0x00, 0xf0, 0x87,
|
||||||
|
0x03, 0x07, 0x00, 0xf8, 0x8f, 0x03, 0x07, 0x00, 0xf8, 0x9f, 0x03, 0x07,
|
||||||
|
0x00, 0xfc, 0x9f, 0x03, 0x03, 0x00, 0xf8, 0x0f, 0x03, 0x07, 0x00, 0xf8,
|
||||||
|
0x9f, 0x03, 0x07, 0x00, 0xf8, 0x8f, 0x03, 0x07, 0x00, 0xf0, 0x87, 0x03,
|
||||||
|
0x0f, 0x00, 0xe0, 0xc3, 0x03, 0x1f, 0x00, 0x00, 0xe0, 0x03, 0x3f, 0x00,
|
||||||
|
0x00, 0xf0, 0x03, 0xff, 0x00, 0x00, 0xfc, 0x03 };
|
Loading…
Reference in New Issue
Block a user