v0.5.010
This commit is contained in:
284
yoRadio/src/displays/displayLC1602.cpp
Normal file
284
yoRadio/src/displays/displayLC1602.cpp
Normal file
@@ -0,0 +1,284 @@
|
||||
#include "../../options.h"
|
||||
|
||||
#if DSP_MODEL==DSP_1602I2C
|
||||
|
||||
#include "displayLC1602.h"
|
||||
#include "../../player.h"
|
||||
#include "../../config.h"
|
||||
#include "../../network.h"
|
||||
|
||||
#ifndef SCREEN_ADDRESS
|
||||
#define SCREEN_ADDRESS 0x27 ///< See datasheet for Address or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
|
||||
#endif
|
||||
|
||||
const byte controlspaces[] = { CLOCK_SPACE, VOL_SPACE };
|
||||
|
||||
DisplayLC1602::DisplayLC1602(): LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::apScreen() {
|
||||
setCursor(0,0);
|
||||
print("YORADIO AP MODE");
|
||||
setCursor(0,1);
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
}
|
||||
|
||||
void DisplayLC1602::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
init();
|
||||
backlight();
|
||||
screenwidth = 16;
|
||||
screenheight = 2;
|
||||
swidth = screenwidth;
|
||||
sheight = screenheight;
|
||||
fillSpaces = true;
|
||||
}
|
||||
|
||||
void DisplayLC1602::drawLogo() {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
centerText("NEXT STATION", 0, 0, 0);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem, PLMITEMS);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayLC1602::clearDsp() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void DisplayLC1602::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||
tWidth = strlen(text);
|
||||
tHeight = 1;
|
||||
sWidth = strlen(separator);
|
||||
}
|
||||
|
||||
void DisplayLC1602::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
for(uint16_t x=0; x<swidth-controlspaces[texttop]; x++){
|
||||
setCursor(x, texttop);
|
||||
print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayLC1602::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||
byte x=(strlen(text)>swidth)?0:(swidth-strlen(text))/2;
|
||||
setCursor(x, y);
|
||||
print(text);
|
||||
}
|
||||
|
||||
void DisplayLC1602::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||
byte x=swidth-strlen(text);
|
||||
setCursor(x-1, y);
|
||||
print(" ");
|
||||
setCursor(x, y);
|
||||
print(text);
|
||||
}
|
||||
|
||||
void DisplayLC1602::displayHeapForDebug() {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::printClock(const char* timestr) {
|
||||
rightText(timestr, 0, 0, 0);
|
||||
}
|
||||
|
||||
void DisplayLC1602::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::drawVolumeBar(bool withNumber) {
|
||||
char volstr[4];
|
||||
sprintf(volstr, "%02d", config.store.volume);
|
||||
if (withNumber) {;
|
||||
centerText(" ", 1, 0, 0);
|
||||
centerText(volstr, 1, TFT_LOGO, TFT_BG);
|
||||
}else{
|
||||
rightText(" ", 1, 0, 0);
|
||||
rightText(volstr, 1, TFT_LOGO, TFT_BG);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayLC1602::drawNextStationNum(uint16_t num) {
|
||||
char numstr[7];
|
||||
sprintf(numstr, "%d", num);
|
||||
centerText(" ", 1, 0, 0);
|
||||
centerText(numstr, 1, TFT_LOGO, TFT_BG);
|
||||
}
|
||||
|
||||
void DisplayLC1602::frameTitle(const char* str) {
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
}
|
||||
|
||||
void DisplayLC1602::rssi(const char* str) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::ip(const char* str) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::set_TextSize(uint8_t s) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||
|
||||
}
|
||||
|
||||
void DisplayLC1602::set_Cursor(int16_t x, int16_t y) {
|
||||
if(x<0) {
|
||||
xOffset=-x;
|
||||
x=0;
|
||||
}else{
|
||||
xOffset=0;
|
||||
}
|
||||
nextX=0;
|
||||
yOffset = y;
|
||||
setCursor(x, y);
|
||||
}
|
||||
|
||||
void DisplayLC1602::printText(const char* txt) {
|
||||
char tmp[swidth+1] = {0};
|
||||
int16_t numchars = fillSpaces?swidth-controlspaces[yOffset]:swidth;
|
||||
strlcpy(tmp, txt+xOffset, numchars+1-nextX);
|
||||
print(tmp);
|
||||
xOffset=(int16_t)(strlen(txt)-xOffset)<=0?xOffset-strlen(txt):0;
|
||||
nextX=nextX+strlen(tmp);
|
||||
if(nextX>numchars) nextX=numchars;
|
||||
setCursor(nextX, yOffset);
|
||||
}
|
||||
|
||||
void DisplayLC1602::loop() {
|
||||
if (checkdelay(SCROLLTIME, loopdelay)) {
|
||||
//display();
|
||||
}
|
||||
yield();
|
||||
}
|
||||
|
||||
boolean DisplayLC1602::checkdelay(int m, unsigned long & tstamp) {
|
||||
if (millis() - tstamp > m) {
|
||||
tstamp = millis();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
char* DisplayLC1602::utf8Rus(const char* str, bool uppercase) {
|
||||
int index = 0;
|
||||
static char strn[BUFLEN];
|
||||
static char newStr[BUFLEN];
|
||||
bool E = false;
|
||||
strlcpy(strn, str, BUFLEN);
|
||||
newStr[0] = '\0';
|
||||
bool next = false;
|
||||
for (char *iter = strn; *iter != '\0'; ++iter)
|
||||
{
|
||||
if (E) {
|
||||
E = false;
|
||||
continue;
|
||||
}
|
||||
byte rus = (byte) * iter;
|
||||
if (rus == 208 && (byte) * (iter + 1) == 129) { // ёКостыли
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (rus == 209 && (byte) * (iter + 1) == 145) {
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (next) {
|
||||
if (rus >= 128 && rus <= 143) *iter = (char)(rus + 32);
|
||||
if (rus >= 176 && rus <= 191) *iter = (char)(rus - 32);
|
||||
next = false;
|
||||
}
|
||||
if (rus == 208) next = true;
|
||||
if (rus == 209) {
|
||||
*iter = (char)208;
|
||||
next = true;
|
||||
}
|
||||
*iter = toupper(*iter);
|
||||
}
|
||||
|
||||
while (strn[index])
|
||||
{
|
||||
if (strlen(newStr) > BUFLEN - 2) break;
|
||||
if (strn[index] >= 0xBF)
|
||||
{
|
||||
switch (strn[index]) {
|
||||
case 0xD0: {
|
||||
switch (strn[index + 1])
|
||||
{
|
||||
case 0x90: strcat(newStr, "A"); break;
|
||||
case 0x91: strcat(newStr, "B"); break;
|
||||
case 0x92: strcat(newStr, "V"); break;
|
||||
case 0x93: strcat(newStr, "G"); break;
|
||||
case 0x94: strcat(newStr, "D"); break;
|
||||
case 0x95: strcat(newStr, "E"); break;
|
||||
case 0x96: strcat(newStr, "ZH"); break;
|
||||
case 0x97: strcat(newStr, "Z"); break;
|
||||
case 0x98: strcat(newStr, "I"); break;
|
||||
case 0x99: strcat(newStr, "Y"); break;
|
||||
case 0x9A: strcat(newStr, "K"); break;
|
||||
case 0x9B: strcat(newStr, "L"); break;
|
||||
case 0x9C: strcat(newStr, "M"); break;
|
||||
case 0x9D: strcat(newStr, "N"); break;
|
||||
case 0x9E: strcat(newStr, "O"); break;
|
||||
case 0x9F: strcat(newStr, "P"); break;
|
||||
case 0xA0: strcat(newStr, "R"); break;
|
||||
case 0xA1: strcat(newStr, "S"); break;
|
||||
case 0xA2: strcat(newStr, "T"); break;
|
||||
case 0xA3: strcat(newStr, "U"); break;
|
||||
case 0xA4: strcat(newStr, "F"); break;
|
||||
case 0xA5: strcat(newStr, "H"); break;
|
||||
case 0xA6: strcat(newStr, "TS"); break;
|
||||
case 0xA7: strcat(newStr, "CH"); break;
|
||||
case 0xA8: strcat(newStr, "SH"); break;
|
||||
case 0xA9: strcat(newStr, "SHCH"); break;
|
||||
case 0xAA: strcat(newStr, "'"); break;
|
||||
case 0xAB: strcat(newStr, "YU"); break;
|
||||
case 0xAC: strcat(newStr, "'"); break;
|
||||
case 0xAD: strcat(newStr, "E"); break;
|
||||
case 0xAE: strcat(newStr, "YU"); break;
|
||||
case 0xAF: strcat(newStr, "YA"); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0xD1: {
|
||||
if (strn[index + 1] == 0x91) {
|
||||
strcat(newStr, "YO"); break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
int sind = index + 2;
|
||||
while (strn[sind]) {
|
||||
strn[sind - 1] = strn[sind];
|
||||
sind++;
|
||||
}
|
||||
strn[sind - 1] = 0;
|
||||
} else {
|
||||
char Temp[2] = {(char) strn[index] , 0 } ;
|
||||
strcat(newStr, Temp);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
#endif
|
||||
73
yoRadio/src/displays/displayLC1602.h
Normal file
73
yoRadio/src/displays/displayLC1602.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef displayLC1602_h
|
||||
#define displayLC1602_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "../LiquidCrystalI2C/LiquidCrystalI2CEx.h"
|
||||
|
||||
#define TFT_LINEHGHT 1
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define PLMITEMS 1
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 9
|
||||
#define TITLE_TOP1 1
|
||||
#define TITLE_SIZE2 0
|
||||
#define PL_TOP 1
|
||||
#define PLCURRENT_SIZE 1
|
||||
|
||||
#define SCROLLDELTA 1
|
||||
#define SCROLLTIME 250
|
||||
#define BOOTSTR_TOP2 0
|
||||
#define BOOTSTR_TOP1 1
|
||||
#define STARTTIME_PL 2000
|
||||
|
||||
class DisplayLC1602: public LiquidCrystal_I2C {
|
||||
public:
|
||||
bool fillSpaces;
|
||||
DisplayLC1602();
|
||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||
uint16_t clockY;
|
||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||
void apScreen();
|
||||
void drawLogo();
|
||||
void clearDsp();
|
||||
void centerText(const char* text, byte y, uint16_t fg, uint16_t bg);
|
||||
void rightText(const char* text, byte y, uint16_t fg, uint16_t bg);
|
||||
void set_TextSize(uint8_t s);
|
||||
void set_TextColor(uint16_t fg, uint16_t bg);
|
||||
void set_Cursor(int16_t x, int16_t y);
|
||||
void printText(const char* txt);
|
||||
void printClock(const char* timestr);
|
||||
void printClock(struct tm timeinfo, bool dots, bool redraw = false);
|
||||
void displayHeapForDebug();
|
||||
void drawVolumeBar(bool withNumber);
|
||||
void drawNextStationNum(uint16_t num);
|
||||
char* utf8Rus(const char* str, bool uppercase=true);
|
||||
void drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth);
|
||||
void clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void frameTitle(const char* str);
|
||||
void rssi(const char* str);
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop();
|
||||
private:
|
||||
uint16_t swidth, sheight, xOffset, yOffset;
|
||||
int16_t nextX;
|
||||
unsigned long loopdelay;
|
||||
boolean checkdelay(int m, unsigned long &tstamp);
|
||||
};
|
||||
|
||||
extern DisplayLC1602 dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define CLOCK_SPACE 6
|
||||
#define VOL_SPACE 3
|
||||
#define SILVER 0
|
||||
#define TFT_BG 0
|
||||
#define TFT_FG CLOCK_SPACE
|
||||
#define TFT_LOGO VOL_SPACE
|
||||
|
||||
#endif
|
||||
@@ -122,7 +122,10 @@ void DisplayN5110::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
setContrast(TFT_CONTRAST);
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
byte tftRotate = TFT_ROTATE;
|
||||
if(tftRotate>2) tftRotate=2;
|
||||
if(tftRotate==1) tftRotate=0;
|
||||
setRotation(tftRotate);
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
|
||||
@@ -11,6 +11,14 @@
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define SCROLLDELTA 8
|
||||
#define SCROLLTIME 332
|
||||
#define META_SIZE 1
|
||||
#define TITLE_TOP1 TFT_FRAMEWDT + TFT_LINEHGHT+1
|
||||
#define TITLE_SIZE2 0
|
||||
#define PLCURRENT_SIZE 1
|
||||
|
||||
|
||||
#define PLMITEMS 7
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 10
|
||||
|
||||
333
yoRadio/src/displays/displaySH1106.cpp
Normal file
333
yoRadio/src/displays/displaySH1106.cpp
Normal file
@@ -0,0 +1,333 @@
|
||||
#include "../../options.h"
|
||||
#if DSP_MODEL==5
|
||||
|
||||
#include "displaySH1106.h"
|
||||
#include <Wire.h>
|
||||
#include "../../player.h"
|
||||
#include "../../config.h"
|
||||
#include "../../network.h"
|
||||
|
||||
#ifndef SCREEN_ADDRESS
|
||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
|
||||
#endif
|
||||
|
||||
#define LOGO_WIDTH 21
|
||||
#define LOGO_HEIGHT 32
|
||||
|
||||
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
||||
|
||||
const unsigned char logo [] PROGMEM=
|
||||
{
|
||||
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
|
||||
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
|
||||
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
|
||||
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
|
||||
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
|
||||
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
|
||||
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
|
||||
};
|
||||
|
||||
TwoWire I2CSH1106 = TwoWire(0);
|
||||
|
||||
DisplaySH1106::DisplaySH1106(): Adafruit_SH1106G(128, 64, &I2CSH1106, -1) {
|
||||
|
||||
}
|
||||
|
||||
char* DisplaySH1106::utf8Rus(const char* str, bool uppercase) {
|
||||
int index = 0;
|
||||
static char strn[BUFLEN];
|
||||
bool E = false;
|
||||
strlcpy(strn, str, BUFLEN);
|
||||
if (uppercase) {
|
||||
bool next = false;
|
||||
for (char *iter = strn; *iter != '\0'; ++iter)
|
||||
{
|
||||
if (E) {
|
||||
E = false;
|
||||
continue;
|
||||
}
|
||||
byte rus = (byte) * iter;
|
||||
if (rus == 208 && (byte) * (iter + 1) == 129) { // ёКостыли
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (rus == 209 && (byte) * (iter + 1) == 145) {
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (next) {
|
||||
if (rus >= 128 && rus <= 143) *iter = (char)(rus + 32);
|
||||
if (rus >= 176 && rus <= 191) *iter = (char)(rus - 32);
|
||||
next = false;
|
||||
}
|
||||
if (rus == 208) next = true;
|
||||
if (rus == 209) {
|
||||
*iter = (char)208;
|
||||
next = true;
|
||||
}
|
||||
*iter = toupper(*iter);
|
||||
}
|
||||
}
|
||||
while (strn[index])
|
||||
{
|
||||
if (strn[index] >= 0xBF)
|
||||
{
|
||||
switch (strn[index]) {
|
||||
case 0xD0: {
|
||||
if (strn[index + 1] == 0x81) {
|
||||
strn[index] = 0xA8;
|
||||
break;
|
||||
}
|
||||
if (strn[index + 1] >= 0x90 && strn[index + 1] <= 0xBF) strn[index] = strn[index + 1] + 0x30;
|
||||
break;
|
||||
}
|
||||
case 0xD1: {
|
||||
if (strn[index + 1] == 0x91) {
|
||||
//strn[index] = 0xB7;
|
||||
strn[index] = 0xB8;
|
||||
break;
|
||||
}
|
||||
if (strn[index + 1] >= 0x80 && strn[index + 1] <= 0x8F) strn[index] = strn[index + 1] + 0x70;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int sind = index + 2;
|
||||
while (strn[sind]) {
|
||||
strn[sind - 1] = strn[sind];
|
||||
sind++;
|
||||
}
|
||||
strn[sind - 1] = 0;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return strn;
|
||||
}
|
||||
|
||||
void DisplaySH1106::apScreen() {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 3 * TFT_LINEHGHT);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, sheight - TFT_LINEHGHT * 2);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, sheight - TFT_LINEHGHT);
|
||||
print("http://");
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
}
|
||||
|
||||
void DisplaySH1106::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
I2CSH1106.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
||||
if (!begin(SCREEN_ADDRESS, true)) {
|
||||
Serial.println(F("SH1106 allocation failed"));
|
||||
for (;;); // Don't proceed, loop forever
|
||||
}
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
swidth = screenwidth;
|
||||
sheight = screenheight;
|
||||
}
|
||||
|
||||
void DisplaySH1106::drawLogo() {
|
||||
clearDisplay();
|
||||
drawBitmap(
|
||||
(width() - LOGO_WIDTH ) / 2,
|
||||
8,
|
||||
logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
||||
display();
|
||||
}
|
||||
|
||||
void DisplaySH1106::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS);
|
||||
setTextSize(1);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) + 1, swidth, PLMITEMHEIGHT, TFT_LOGO);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 3) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaySH1106::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
}
|
||||
|
||||
void DisplaySH1106::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
if (TFT_FRAMEWDT == 0) return;
|
||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||
}
|
||||
|
||||
void DisplaySH1106::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
setTextSize(textsize);
|
||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||
tWidth = w;
|
||||
tHeight = h;
|
||||
getTextBounds(separator, 0, 0, &x1, &y1, &w, &h);
|
||||
sWidth = w;
|
||||
}
|
||||
|
||||
void DisplaySH1106::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
fillRect(0, texttop, swidth, textheight, bg);
|
||||
}
|
||||
|
||||
void DisplaySH1106::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
const char* txt = text;
|
||||
getTextBounds(txt, 0, 0, &x1, &y1, &w, &h);
|
||||
setTextColor(fg,bg);
|
||||
if(y==90) y=sheight-TFT_LINEHGHT*2-5;
|
||||
if(y==110) y=sheight-TFT_LINEHGHT;
|
||||
setCursor((swidth - w) / 2, y);
|
||||
fillRect(0, y, swidth, h, bg);
|
||||
print(txt);
|
||||
}
|
||||
|
||||
void DisplaySH1106::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||
setTextColor(fg,bg);
|
||||
setCursor(swidth - w - TFT_FRAMEWDT, y);
|
||||
fillRect(swidth - w - TFT_FRAMEWDT, y, w, h, bg);
|
||||
print(text);
|
||||
}
|
||||
|
||||
void DisplaySH1106::displayHeapForDebug() {
|
||||
|
||||
}
|
||||
|
||||
void DisplaySH1106::printClock(const char* timestr) {
|
||||
setTextSize(2);
|
||||
centerText(timestr, 34, TFT_FG, TFT_BG);
|
||||
setTextSize(1);
|
||||
}
|
||||
|
||||
#define CLCLF 34
|
||||
|
||||
void DisplaySH1106::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
||||
char timeStringBuff[20] = { 0 };
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%H:%M", &timeinfo);
|
||||
setTextSize(2);
|
||||
setCursor(CLCLF, 34);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
print(timeStringBuff);
|
||||
setTextSize(1);
|
||||
setCursor(CLCLF + 6*2*5+1, 34+1);
|
||||
sprintf(timeStringBuff, "%02d", timeinfo.tm_sec);
|
||||
print(timeStringBuff);
|
||||
}
|
||||
|
||||
void DisplaySH1106::drawVolumeBar(bool withNumber) {
|
||||
int16_t vTop = sheight - 4;
|
||||
int16_t vWidth = swidth;
|
||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop, vWidth, 3, TFT_BG);
|
||||
drawRect(TFT_FRAMEWDT, vTop, vWidth, 3, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop + 1, ww, 1, TFT_LOGO);
|
||||
if (withNumber) {
|
||||
setTextSize(2);
|
||||
setTextColor(TFT_FG);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, 24, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
setCursor((swidth - wv) / 2, 24);
|
||||
print(volstr);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaySH1106::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(2);
|
||||
setTextColor(TFT_FG);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, 24, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
setCursor((swidth - wv) / 2, 24);
|
||||
print(numstr);
|
||||
}
|
||||
|
||||
void DisplaySH1106::frameTitle(const char* str) {
|
||||
setTextSize(2);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
}
|
||||
|
||||
void DisplaySH1106::rssi(const char* str) {
|
||||
char buf[4];
|
||||
strlcpy(buf, str, strlen(str)-2);
|
||||
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
||||
setTextSize(1);
|
||||
rightText(buf, vTop, SILVER, TFT_BG);
|
||||
}
|
||||
|
||||
void DisplaySH1106::ip(const char* str) {
|
||||
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setCursor(0, vTop);
|
||||
print(str);
|
||||
}
|
||||
|
||||
void DisplaySH1106::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
void DisplaySH1106::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||
setTextColor(fg, bg);
|
||||
}
|
||||
|
||||
void DisplaySH1106::set_Cursor(int16_t x, int16_t y) {
|
||||
setCursor(x, y);
|
||||
}
|
||||
|
||||
void DisplaySH1106::printText(const char* txt) {
|
||||
print(txt);
|
||||
}
|
||||
|
||||
void DisplaySH1106::loop() {
|
||||
if (checkdelay(SCROLLTIME, loopdelay)) {
|
||||
display();
|
||||
}
|
||||
yield();
|
||||
}
|
||||
|
||||
boolean DisplaySH1106::checkdelay(int m, unsigned long &tstamp) {
|
||||
if (millis() - tstamp > m) {
|
||||
tstamp = millis();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
65
yoRadio/src/displays/displaySH1106.h
Normal file
65
yoRadio/src/displays/displaySH1106.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef displaySH1106_h
|
||||
#define displaySH1106_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define PLMITEMS 7
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 9
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||
#define PLCURRENT_SIZE 1
|
||||
#define TFT_FULLTIME 1
|
||||
#define SCROLLDELTA 5
|
||||
#define SCROLLTIME 110
|
||||
|
||||
class DisplaySH1106: public Adafruit_SH1106G {
|
||||
public:
|
||||
DisplaySH1106();
|
||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||
uint16_t clockY;
|
||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||
void apScreen();
|
||||
void drawLogo();
|
||||
void clearDsp();
|
||||
void centerText(const char* text, byte y, uint16_t fg, uint16_t bg);
|
||||
void rightText(const char* text, byte y, uint16_t fg, uint16_t bg);
|
||||
void set_TextSize(uint8_t s);
|
||||
void set_TextColor(uint16_t fg, uint16_t bg);
|
||||
void set_Cursor(int16_t x, int16_t y);
|
||||
void printText(const char* txt);
|
||||
void printClock(const char* timestr);
|
||||
void printClock(struct tm timeinfo, bool dots, bool redraw = false);
|
||||
void displayHeapForDebug();
|
||||
void drawVolumeBar(bool withNumber);
|
||||
void drawNextStationNum(uint16_t num);
|
||||
char* utf8Rus(const char* str, bool uppercase);
|
||||
void drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth);
|
||||
void clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void frameTitle(const char* str);
|
||||
void rssi(const char* str);
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
boolean checkdelay(int m, unsigned long &tstamp);
|
||||
};
|
||||
|
||||
extern DisplaySH1106 dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define SILVER SH110X_WHITE
|
||||
#define TFT_BG SH110X_BLACK
|
||||
#define TFT_FG SH110X_WHITE
|
||||
#define TFT_LOGO SH110X_WHITE
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "../../config.h"
|
||||
#include "../../network.h"
|
||||
|
||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
||||
#ifndef SCREEN_ADDRESS
|
||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
|
||||
#endif
|
||||
|
||||
#define LOGO_WIDTH 21
|
||||
#define LOGO_HEIGHT 32
|
||||
@@ -123,7 +125,7 @@ void DisplaySSD1306::apScreen() {
|
||||
}
|
||||
|
||||
void DisplaySSD1306::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
I2CSSD1306.begin(I2C_SDA, I2C_SCL, (uint32_t)400000);
|
||||
I2CSSD1306.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
||||
if (!begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for (;;); // Don't proceed, loop forever
|
||||
@@ -151,13 +153,13 @@ void DisplaySSD1306::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem - 2, PLMITEMS);
|
||||
setTextSize(2);
|
||||
config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS);
|
||||
setTextSize(1);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) + 1, swidth, PLMITEMHEIGHT, TFT_LOGO);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 2) {
|
||||
if (i == 3) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define PLMITEMS 5
|
||||
#define PLMITEMS 7
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 18
|
||||
#define PLMITEMHEIGHT 9
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||
#define PLCURRENT_SIZE 1
|
||||
|
||||
class DisplaySSD1306: public Adafruit_SSD1306 {
|
||||
public:
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define PLMITEMS 7
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 22
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||
|
||||
class DisplayST7735: public Adafruit_ST7735 {
|
||||
public:
|
||||
|
||||
358
yoRadio/src/displays/displayST7789.cpp
Normal file
358
yoRadio/src/displays/displayST7789.cpp
Normal file
@@ -0,0 +1,358 @@
|
||||
#include "../../options.h"
|
||||
#if DSP_MODEL==4
|
||||
|
||||
#include "displayST7789.h"
|
||||
#include <SPI.h>
|
||||
#include "fonts/bootlogo.h"
|
||||
#include "../../player.h"
|
||||
#include "../../config.h"
|
||||
#include "../../network.h"
|
||||
|
||||
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
||||
const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"};
|
||||
|
||||
DisplayST7789::DisplayST7789(): Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
||||
|
||||
}
|
||||
|
||||
char* DisplayST7789::utf8Rus(const char* str, bool uppercase) {
|
||||
int index = 0;
|
||||
static char strn[BUFLEN];
|
||||
bool E = false;
|
||||
strlcpy(strn, str, BUFLEN);
|
||||
if (uppercase) {
|
||||
bool next = false;
|
||||
for (char *iter = strn; *iter != '\0'; ++iter)
|
||||
{
|
||||
if (E) {
|
||||
E = false;
|
||||
continue;
|
||||
}
|
||||
byte rus = (byte) * iter;
|
||||
if (rus == 208 && (byte) * (iter + 1) == 129) { // ёКостыли
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (rus == 209 && (byte) * (iter + 1) == 145) {
|
||||
*iter = (char)209;
|
||||
*(iter + 1) = (char)145;
|
||||
E = true;
|
||||
continue;
|
||||
}
|
||||
if (next) {
|
||||
if (rus >= 128 && rus <= 143) *iter = (char)(rus + 32);
|
||||
if (rus >= 176 && rus <= 191) *iter = (char)(rus - 32);
|
||||
next = false;
|
||||
}
|
||||
if (rus == 208) next = true;
|
||||
if (rus == 209) {
|
||||
*iter = (char)208;
|
||||
next = true;
|
||||
}
|
||||
*iter = toupper(*iter);
|
||||
}
|
||||
}
|
||||
while (strn[index])
|
||||
{
|
||||
if (strn[index] >= 0xBF)
|
||||
{
|
||||
switch (strn[index]) {
|
||||
case 0xD0: {
|
||||
if (strn[index + 1] == 0x81) {
|
||||
strn[index] = 0xA8;
|
||||
break;
|
||||
}
|
||||
if (strn[index + 1] >= 0x90 && strn[index + 1] <= 0xBF) strn[index] = strn[index + 1] + 0x30;
|
||||
break;
|
||||
}
|
||||
case 0xD1: {
|
||||
if (strn[index + 1] == 0x91) {
|
||||
//strn[index] = 0xB7;
|
||||
strn[index] = 0xB8;
|
||||
break;
|
||||
}
|
||||
if (strn[index + 1] >= 0x80 && strn[index + 1] <= 0x8F) strn[index] = strn[index + 1] + 0x70;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int sind = index + 2;
|
||||
while (strn[sind]) {
|
||||
strn[sind - 1] = strn[sind];
|
||||
sind++;
|
||||
}
|
||||
strn[sind - 1] = 0;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return strn;
|
||||
}
|
||||
|
||||
void DisplayST7789::apScreen() {
|
||||
setTextSize(TITLE_SIZE1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP2);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*4);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*2);
|
||||
print("http://");
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
}
|
||||
|
||||
void DisplayST7789::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
init(240,320);
|
||||
invertDisplay(TFT_INVERT);
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
setTextWrap(false);
|
||||
setTextSize(1);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
swidth = screenwidth;
|
||||
sheight = screenheight;
|
||||
}
|
||||
|
||||
void DisplayST7789::drawLogo() {
|
||||
drawRGBBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
||||
void DisplayST7789::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem - 4, PLMITEMS);
|
||||
setTextSize(2);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, TFT_LOGO);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 4) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setTextColor(iclrs[abs(i - 4)-1], TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayST7789::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
}
|
||||
|
||||
void DisplayST7789::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
if (TFT_FRAMEWDT==0) return;
|
||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||
}
|
||||
|
||||
void DisplayST7789::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
setTextSize(textsize);
|
||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||
tWidth = w;
|
||||
tHeight = h;
|
||||
getTextBounds(separator, 0, 0, &x1, &y1, &w, &h);
|
||||
sWidth = w;
|
||||
}
|
||||
|
||||
void DisplayST7789::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
fillRect(0, texttop, swidth, textheight, bg);
|
||||
}
|
||||
|
||||
void DisplayST7789::centerText(const char* text, uint16_t y, uint16_t fg, uint16_t bg) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
const char* txt = text;
|
||||
if(y==90) y=(sheight-64)/2 + 64 + TFT_LINEHGHT;
|
||||
if(y==110) y=(sheight-64)/2 + 64 + TFT_LINEHGHT*3;
|
||||
getTextBounds(txt, 0, 0, &x1, &y1, &w, &h);
|
||||
setTextColor(fg);
|
||||
setCursor((swidth - w) / 2, y);
|
||||
fillRect((swidth-w)/2-5, y, w+10, h, bg);
|
||||
print(txt);
|
||||
}
|
||||
|
||||
void DisplayST7789::rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg, bool fliprect, uint16_t delta) {
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||
setTextColor(fg,bg);
|
||||
setCursor(swidth - w - TFT_FRAMEWDT - delta, y);
|
||||
fillRect(swidth - w - TFT_FRAMEWDT, fliprect?y-h:y, w, h, bg);
|
||||
print(text);
|
||||
}
|
||||
|
||||
void DisplayST7789::displayHeapForDebug() {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(DARK_GRAY, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, TFT_BG);
|
||||
print(ESP.getFreeHeap());
|
||||
print(" / ");
|
||||
print(ESP.getMaxAllocHeap());
|
||||
#if VS1053_CS==255
|
||||
// audio buffer;
|
||||
fillRect(0, sheight - 2, swidth, 2, TFT_BG);
|
||||
int astored = player.inBufferFilled();
|
||||
int afree = player.inBufferFree();
|
||||
int aprcnt = 100 * astored / (astored + afree);
|
||||
byte sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, SILVER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DisplayST7789::printClock(const char* timestr) {
|
||||
|
||||
}
|
||||
|
||||
uint16_t cltop = 0;
|
||||
uint8_t clsp = 24;
|
||||
uint16_t clleft = 0;
|
||||
uint16_t clwidth = 0;
|
||||
|
||||
void DisplayST7789::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
char timeBuf[50] = { 0 };
|
||||
strftime(timeBuf, sizeof(timeBuf), "%H:%M", &timeinfo);
|
||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||
int16_t x1, y1;
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
getTextBounds(oldTimeBuf, 0, 0, &x1, &y1, &wot, &hot);
|
||||
if(cltop==0){
|
||||
cltop=sheight-(TFT_FRAMEWDT * 2 + TFT_LINEHGHT + 38) - hot;
|
||||
}
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
fillRect(swidth-TFT_FRAMEWDT-clwidth, cltop-hot, clwidth, hot+3, TFT_BG);
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wot, &hot);
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setCursor(clleft, cltop);
|
||||
print(timeBuf);
|
||||
|
||||
setFont();
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+32);
|
||||
print(utf8Rus(dow[timeinfo.tm_wday], false));
|
||||
|
||||
sprintf(timeBuf, "%2d %s %d", timeinfo.tm_mday,mnths[timeinfo.tm_mon], timeinfo.tm_year+1900);
|
||||
setTextSize(1);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, TFT_FG, TFT_BG, false, swidth>240?12:0);
|
||||
drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, SILVER);
|
||||
drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, SILVER);
|
||||
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
}
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+1);
|
||||
sprintf(timeBuf, "%02d", timeinfo.tm_sec);
|
||||
print(timeBuf);
|
||||
}
|
||||
|
||||
void DisplayST7789::drawVolumeBar(bool withNumber) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
|
||||
int16_t volTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, TFT_LOGO);
|
||||
if(swidth>240){
|
||||
char buf[20];
|
||||
sprintf(buf, "VOL %d", config.store.volume);
|
||||
setTextSize(1);
|
||||
centerText(buf, volTop, SILVER, TFT_BG);
|
||||
}
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(volstr);
|
||||
setFont();
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayST7789::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(numstr);
|
||||
setFont();
|
||||
}
|
||||
|
||||
void DisplayST7789::frameTitle(const char* str) {
|
||||
setTextSize(META_SIZE);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
}
|
||||
|
||||
void DisplayST7789::rssi(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
char buf[20];
|
||||
sprintf(buf, "RSSI:%s", str);
|
||||
setTextSize(1);
|
||||
rightText(buf, vTop, SILVER, TFT_BG);
|
||||
}
|
||||
|
||||
void DisplayST7789::ip(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
char buf[30];
|
||||
sprintf(buf, "IP: %s", str);
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
print(buf);
|
||||
}
|
||||
|
||||
void DisplayST7789::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
void DisplayST7789::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||
setTextColor(fg, bg);
|
||||
}
|
||||
|
||||
void DisplayST7789::set_Cursor(int16_t x, int16_t y) {
|
||||
setCursor(x, y);
|
||||
}
|
||||
|
||||
void DisplayST7789::printText(const char* txt) {
|
||||
print(txt);
|
||||
}
|
||||
|
||||
void DisplayST7789::loop() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
98
yoRadio/src/displays/displayST7789.h
Normal file
98
yoRadio/src/displays/displayST7789.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#ifndef displayST7789_h
|
||||
#define displayST7789_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_ST7789.h>
|
||||
// https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
|
||||
#include "fonts/DS_DIGI42pt7b.h"
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 8
|
||||
#define META_SIZE 3
|
||||
#define TITLE_SIZE1 2
|
||||
#define TITLE_SIZE2 2
|
||||
|
||||
#define SCROLLDELTA 6
|
||||
#define SCROLLTIME 83
|
||||
|
||||
#define PLMITEMS 9
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 22
|
||||
#define TFT_FULLTIME 1
|
||||
|
||||
#define TITLE_TOP1 TFT_FRAMEWDT + META_SIZE * TFT_LINEHGHT + 8
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT + 8
|
||||
#define TITLE_FG2 SILVER
|
||||
|
||||
class DisplayST7789: public Adafruit_ST7789 {
|
||||
public:
|
||||
DisplayST7789();
|
||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||
uint16_t clockY;
|
||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||
void apScreen();
|
||||
void drawLogo();
|
||||
void clearDsp();
|
||||
void centerText(const char* text, uint16_t y, uint16_t fg, uint16_t bg);
|
||||
void rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg, bool fliprect=false, uint16_t delta = 0);
|
||||
void set_TextSize(uint8_t s);
|
||||
void set_TextColor(uint16_t fg, uint16_t bg);
|
||||
void set_Cursor(int16_t x, int16_t y);
|
||||
void printText(const char* txt);
|
||||
void printClock(const char* timestr);
|
||||
void printClock(struct tm timeinfo, bool dots, bool redraw = false);
|
||||
void displayHeapForDebug();
|
||||
void drawVolumeBar(bool withNumber);
|
||||
void drawNextStationNum(uint16_t num);
|
||||
char* utf8Rus(const char* str, bool uppercase);
|
||||
void drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth);
|
||||
void clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg);
|
||||
void frameTitle(const char* str);
|
||||
void rssi(const char* str);
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
uint16_t wot, hot;
|
||||
|
||||
};
|
||||
|
||||
extern DisplayST7789 dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
#define MAGENTA 0xF81F
|
||||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
#define GRAY 0x7BEF
|
||||
#define DARK_GRAY 0x2945
|
||||
#define LIGHT_GRAY 0xC618
|
||||
#define LIME 0x87E0
|
||||
#define AQUA 0x5D1C
|
||||
#define CYAN 0x07FF
|
||||
#define DARK_CYAN 0x03EF
|
||||
#define ORANGE 0xFCA0
|
||||
#define PINK 0xF97F
|
||||
#define BROWN 0x8200
|
||||
#define VIOLET 0x9199
|
||||
#define SILVER 0xA510
|
||||
#define GOLD 0xA508
|
||||
#define NAVY 0x000F
|
||||
#define MAROON 0x7800
|
||||
#define PURPLE 0x780F
|
||||
#define OLIVE 0x7BE0
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
|
||||
#endif
|
||||
199
yoRadio/src/displays/fonts/DS_DIGI42pt7b.h
Normal file
199
yoRadio/src/displays/fonts/DS_DIGI42pt7b.h
Normal file
@@ -0,0 +1,199 @@
|
||||
const uint8_t DS_DIGI42pt7bBitmaps[] PROGMEM = {
|
||||
0x04, 0x31, 0xCF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xCE, 0x10, 0x00, 0x04, 0x39, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xCF,
|
||||
0x1C, 0x30, 0x40, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF,
|
||||
0xF9, 0x3F, 0xFF, 0xFF, 0xE7, 0x3F, 0xFF, 0xFF, 0x9F, 0x3F, 0xFF, 0xFE,
|
||||
0x7F, 0x3F, 0xFF, 0xF9, 0xFF, 0x3F, 0xFF, 0xE7, 0xFF, 0x00, 0x00, 0x1F,
|
||||
0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF,
|
||||
0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF,
|
||||
0x80, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC,
|
||||
0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0,
|
||||
0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x00,
|
||||
0x00, 0x0F, 0xB8, 0x00, 0x00, 0x0E, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00,
|
||||
0x01, 0xDF, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00,
|
||||
0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01,
|
||||
0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F,
|
||||
0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F,
|
||||
0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF,
|
||||
0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x7F, 0xFF, 0xCF, 0xF9,
|
||||
0xFF, 0xFF, 0xCF, 0xE7, 0xFF, 0xFF, 0xCF, 0x9F, 0xFF, 0xFF, 0xCE, 0x7F,
|
||||
0xFF, 0xFF, 0xC9, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x10, 0xC7, 0x3D, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xF3,
|
||||
0x84, 0x00, 0x01, 0x0E, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xF3, 0xC7, 0x0C, 0x10, 0x00, 0x3F, 0xFF,
|
||||
0xFF, 0xF8, 0x3F, 0xFF, 0xFF, 0xE4, 0x3F, 0xFF, 0xFF, 0x98, 0x3F, 0xFF,
|
||||
0xFE, 0x70, 0x3F, 0xFF, 0xF9, 0xE0, 0x3F, 0xFF, 0xE7, 0xC0, 0x00, 0x00,
|
||||
0x1F, 0x80, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00,
|
||||
0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07,
|
||||
0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3F,
|
||||
0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8,
|
||||
0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0,
|
||||
0x00, 0x00, 0x0F, 0x81, 0xFF, 0xFF, 0xCE, 0x07, 0xFF, 0xFF, 0xC8, 0x1F,
|
||||
0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0x81, 0x3F, 0xFF, 0xFE, 0x07, 0x3F,
|
||||
0xFF, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00,
|
||||
0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00,
|
||||
0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3E, 0x7F, 0xFF, 0xC0,
|
||||
0x79, 0xFF, 0xFF, 0xC0, 0xE7, 0xFF, 0xFF, 0xC1, 0x9F, 0xFF, 0xFF, 0xC2,
|
||||
0x7F, 0xFF, 0xFF, 0xC1, 0xFF, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0xF0,
|
||||
0x7F, 0xFF, 0xFF, 0x90, 0xFF, 0xFF, 0xFC, 0xC1, 0xFF, 0xFF, 0xE7, 0x03,
|
||||
0xFF, 0xFF, 0x3C, 0x07, 0xFF, 0xF9, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03,
|
||||
0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xC0, 0xFF,
|
||||
0xFF, 0xCE, 0x07, 0xFF, 0xFF, 0x90, 0x3F, 0xFF, 0xFF, 0x00, 0xFF, 0xFF,
|
||||
0xFC, 0x01, 0xFF, 0xFF, 0xE4, 0x03, 0xFF, 0xFF, 0x38, 0x00, 0x00, 0x01,
|
||||
0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03,
|
||||
0xF0, 0x1F, 0xFF, 0xE7, 0xC0, 0xFF, 0xFF, 0xCF, 0x07, 0xFF, 0xFF, 0x9C,
|
||||
0x3F, 0xFF, 0xFF, 0x31, 0xFF, 0xFF, 0xFE, 0x4F, 0xFF, 0xFF, 0xFC, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x7F, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x07, 0xFF, 0x00,
|
||||
0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00,
|
||||
0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00,
|
||||
0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00,
|
||||
0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01,
|
||||
0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F,
|
||||
0xFE, 0x00, 0x00, 0x0F, 0xB9, 0xFF, 0xFF, 0xCE, 0x27, 0xFF, 0xFF, 0xC8,
|
||||
0x1F, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFE, 0x40,
|
||||
0x3F, 0xFF, 0xF9, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x1F, 0x80,
|
||||
0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00,
|
||||
0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00,
|
||||
0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3F, 0x00, 0x00,
|
||||
0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00,
|
||||
0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00,
|
||||
0x0F, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
|
||||
0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF,
|
||||
0xF9, 0x3F, 0xFF, 0xFF, 0xE3, 0x3F, 0xFF, 0xFF, 0x87, 0x3F, 0xFF, 0xFE,
|
||||
0x0F, 0x3F, 0xFF, 0xF8, 0x1F, 0x3F, 0xFF, 0xE0, 0x3F, 0x00, 0x00, 0x00,
|
||||
0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03,
|
||||
0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F,
|
||||
0x80, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0,
|
||||
0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3E, 0x00,
|
||||
0x00, 0x00, 0x39, 0xFF, 0xFF, 0xC0, 0x27, 0xFF, 0xFF, 0xC0, 0x1F, 0xFF,
|
||||
0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFE, 0x40, 0x3F, 0xFF,
|
||||
0xF9, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00,
|
||||
0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01,
|
||||
0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F,
|
||||
0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0,
|
||||
0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x7F, 0xFF, 0xCF, 0x81,
|
||||
0xFF, 0xFF, 0xCF, 0x07, 0xFF, 0xFF, 0xCE, 0x1F, 0xFF, 0xFF, 0xCC, 0x7F,
|
||||
0xFF, 0xFF, 0xC9, 0xFF, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0xF9, 0x3F,
|
||||
0xFF, 0xFF, 0xE3, 0x3F, 0xFF, 0xFF, 0x87, 0x3F, 0xFF, 0xFE, 0x0F, 0x3F,
|
||||
0xFF, 0xF8, 0x1F, 0x3F, 0xFF, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00,
|
||||
0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00,
|
||||
0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x39, 0xFF, 0xFF, 0xC0, 0x27, 0xFF, 0xFF, 0xC0, 0x1F, 0xFF, 0xFF, 0xC0,
|
||||
0x3F, 0xFF, 0xFF, 0x81, 0x3F, 0xFF, 0xFE, 0x47, 0x3F, 0xFF, 0xF9, 0xDF,
|
||||
0x00, 0x00, 0x07, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC,
|
||||
0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0,
|
||||
0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFF, 0x00,
|
||||
0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00,
|
||||
0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00,
|
||||
0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x7F, 0xFF, 0xCF, 0xF9, 0xFF, 0xFF,
|
||||
0xCF, 0xE7, 0xFF, 0xFF, 0xCF, 0x9F, 0xFF, 0xFF, 0xCE, 0x7F, 0xFF, 0xFF,
|
||||
0xC9, 0xFF, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0xF0, 0x7F, 0xFF, 0xFF,
|
||||
0x90, 0xFF, 0xFF, 0xFC, 0xC1, 0xFF, 0xFF, 0xE7, 0x03, 0xFF, 0xFF, 0x3C,
|
||||
0x07, 0xFF, 0xF9, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03,
|
||||
0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x0E, 0x00,
|
||||
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x00,
|
||||
0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03,
|
||||
0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0x00,
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x0F, 0xC0, 0x00,
|
||||
0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00,
|
||||
0x07, 0xC0, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
|
||||
0x30, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xF9,
|
||||
0x3F, 0xFF, 0xFF, 0xE7, 0x3F, 0xFF, 0xFF, 0x9F, 0x3F, 0xFF, 0xFE, 0x7F,
|
||||
0x3F, 0xFF, 0xF9, 0xFF, 0x3F, 0xFF, 0xE7, 0xFF, 0x00, 0x00, 0x1F, 0xFE,
|
||||
0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0,
|
||||
0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80,
|
||||
0x00, 0x0F, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00,
|
||||
0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00,
|
||||
0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x00, 0x00,
|
||||
0x0F, 0xB9, 0xFF, 0xFF, 0xCE, 0x27, 0xFF, 0xFF, 0xC8, 0x1F, 0xFF, 0xFF,
|
||||
0xC0, 0x3F, 0xFF, 0xFF, 0x83, 0x3F, 0xFF, 0xFE, 0x4F, 0x3F, 0xFF, 0xF9,
|
||||
0xDF, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F,
|
||||
0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF,
|
||||
0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFF,
|
||||
0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8,
|
||||
0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0,
|
||||
0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x7F, 0xFF, 0xCF, 0xF9, 0xFF,
|
||||
0xFF, 0xCF, 0xE7, 0xFF, 0xFF, 0xCF, 0x9F, 0xFF, 0xFF, 0xCE, 0x7F, 0xFF,
|
||||
0xFF, 0xC9, 0xFF, 0xFF, 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0xF9, 0x3F, 0xFF,
|
||||
0xFF, 0xE7, 0x3F, 0xFF, 0xFF, 0x9F, 0x3F, 0xFF, 0xFE, 0x7F, 0x3F, 0xFF,
|
||||
0xF9, 0xFF, 0x3F, 0xFF, 0xE7, 0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00,
|
||||
0x3F, 0xFC, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01,
|
||||
0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F,
|
||||
0xFF, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x7F,
|
||||
0xF8, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x03, 0xFF,
|
||||
0xC0, 0x00, 0x07, 0xFF, 0x80, 0x00, 0x0F, 0xFE, 0x00, 0x00, 0x0F, 0xB9,
|
||||
0xFF, 0xFF, 0xCE, 0x27, 0xFF, 0xFF, 0xC8, 0x1F, 0xFF, 0xFF, 0xC0, 0x3F,
|
||||
0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFE, 0x40, 0x3F, 0xFF, 0xF9, 0xC0, 0x00,
|
||||
0x00, 0x07, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x3F, 0x00, 0x00,
|
||||
0x00, 0x7E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00,
|
||||
0x03, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00,
|
||||
0x1F, 0x80, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00,
|
||||
0xFC, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07,
|
||||
0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x7F, 0xFF, 0xCF, 0x81, 0xFF, 0xFF, 0xCF,
|
||||
0x07, 0xFF, 0xFF, 0xCE, 0x1F, 0xFF, 0xFF, 0xCC, 0x7F, 0xFF, 0xFF, 0xC9,
|
||||
0xFF, 0xFF, 0xFF, 0xC0, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00
|
||||
};
|
||||
|
||||
const GFXglyph DS_DIGI42pt7bGlyphs[] PROGMEM = {
|
||||
{ 0, 0, 0, 19, 0, 1 }, // 0x20 ' '
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x21 '!'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x22 '"'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x23 '#'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x24 '$'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x25 '%'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x26 '&'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x27 '''
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x28 '('
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x29 ')'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2A '*'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2B '+'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2C ','
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2D '-'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2E '.'
|
||||
{ 0, 0, 0, 0, 0, 0 }, // 0x2F '/'
|
||||
{ 45, 31, 52, 40, 4, -51 }, // 0x30 '0'
|
||||
{ 247, 6, 51, 17, 6, -50 }, // 0x31 '1'
|
||||
{ 286, 31, 52, 40, 4, -51 }, // 0x32 '2'
|
||||
{ 488, 30, 52, 39, 4, -51 }, // 0x33 '3'
|
||||
{ 683, 31, 52, 40, 4, -51 }, // 0x34 '4'
|
||||
{ 885, 31, 52, 40, 4, -51 }, // 0x35 '5'
|
||||
{ 1087, 31, 52, 40, 4, -51 }, // 0x36 '6'
|
||||
{ 1289, 30, 52, 39, 4, -51 }, // 0x37 '7'
|
||||
{ 1484, 31, 52, 40, 4, -51 }, // 0x38 '8'
|
||||
{ 1686, 31, 52, 40, 4, -51 }, // 0x39 '9'
|
||||
{ 1888, 6, 43, 15, 4, -42 } // 0x3A ':'
|
||||
};
|
||||
|
||||
const GFXfont DS_DIGI42pt7b PROGMEM = {
|
||||
(uint8_t *)DS_DIGI42pt7bBitmaps,
|
||||
(GFXglyph *)DS_DIGI42pt7bGlyphs, 0x20, 0x3A, 82 };
|
||||
|
||||
// Approx. 3774 bytes
|
||||
Reference in New Issue
Block a user