This commit is contained in:
e2002
2022-03-22 15:03:42 +03:00
parent ee2350e28f
commit 86cb367312
22 changed files with 323 additions and 224 deletions

View File

@@ -44,11 +44,11 @@ class GFXClock {
GFXClock gclock;
DisplayST7735::DisplayST7735(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {
DspCore::DspCore(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {
}
char* DisplayST7735::utf8Rus(const char* str, bool uppercase) {
char* DspCore::utf8Rus(const char* str, bool uppercase) {
int index = 0;
static char strn[BUFLEN];
bool E = false;
@@ -122,7 +122,7 @@ char* DisplayST7735::utf8Rus(const char* str, bool uppercase) {
return strn;
}
void DisplayST7735::apScreen() {
void DspCore::apScreen() {
setTextSize(1);
setTextColor(TFT_FG, TFT_BG);
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
@@ -140,7 +140,7 @@ void DisplayST7735::apScreen() {
print("/");
}
void DisplayST7735::initD(uint16_t &screenwidth, uint16_t &screenheight) {
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
initR(DTYPE);
cp437(true);
fillScreen(TFT_BG);
@@ -153,7 +153,7 @@ void DisplayST7735::initD(uint16_t &screenwidth, uint16_t &screenheight) {
gclock.init(dsp, &DS_DIGI28pt7b, TFT_LOGO, BLACK);
}
void DisplayST7735::drawLogo() {
void DspCore::drawLogo() {
drawRGBBitmap((swidth - 99) / 2, 18, bootlogo2, 99, 64);
}
@@ -162,7 +162,7 @@ void DisplayST7735::drawLogo() {
#define CLR_ITEM2 0x39C7
#define CLR_ITEM3 0x18E3
void DisplayST7735::drawPlaylist(uint16_t currentItem, char* currentItemText) {
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
for (byte i = 0; i < PLMITEMS; i++) {
plMenu[i][0] = '\0';
}
@@ -183,16 +183,16 @@ void DisplayST7735::drawPlaylist(uint16_t currentItem, char* currentItemText) {
}
}
void DisplayST7735::clearDsp() {
void DspCore::clearDsp() {
fillScreen(TFT_BG);
}
void DisplayST7735::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
}
void DisplayST7735::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
void DspCore::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);
@@ -203,11 +203,11 @@ void DisplayST7735::getScrolBbounds(const char* text, const char* separator, byt
sWidth = w;
}
void DisplayST7735::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
fillRect(0, texttop, swidth, textheight, bg);
}
void DisplayST7735::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
int16_t x1, y1;
uint16_t w, h;
const char* txt = text;
@@ -218,7 +218,7 @@ void DisplayST7735::centerText(const char* text, byte y, uint16_t fg, uint16_t b
print(txt);
}
void DisplayST7735::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
void DspCore::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);
@@ -228,7 +228,7 @@ void DisplayST7735::rightText(const char* text, byte y, uint16_t fg, uint16_t bg
print(text);
}
void DisplayST7735::displayHeapForDebug() {
void DspCore::displayHeapForDebug() {
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
setTextSize(1);
setTextColor(DARK_GRAY, TFT_BG);
@@ -248,11 +248,11 @@ void DisplayST7735::displayHeapForDebug() {
#endif
}
void DisplayST7735::printClock(const char* timestr) {
void DspCore::printClock(const char* timestr) {
gclock.print(timestr);
}
void DisplayST7735::drawVolumeBar(bool withNumber) {
void DspCore::drawVolumeBar(bool withNumber) {
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
int16_t vWidth = swidth - TFT_FRAMEWDT - 4;
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
@@ -275,7 +275,7 @@ void DisplayST7735::drawVolumeBar(bool withNumber) {
}
}
void DisplayST7735::drawNextStationNum(uint16_t num) {
void DspCore::drawNextStationNum(uint16_t num) {
setTextSize(1);
setTextColor(TFT_FG);
setFont(&DS_DIGI28pt7b);
@@ -290,18 +290,18 @@ void DisplayST7735::drawNextStationNum(uint16_t num) {
setFont();
}
void DisplayST7735::frameTitle(const char* str) {
void DspCore::frameTitle(const char* str) {
setTextSize(2);
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
}
void DisplayST7735::rssi(const char* str) {
void DspCore::rssi(const char* str) {
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
setTextSize(1);
rightText(str, vTop, SILVER, TFT_BG);
}
void DisplayST7735::ip(const char* str) {
void DspCore::ip(const char* str) {
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
setTextSize(1);
setTextColor(SILVER, TFT_BG);
@@ -309,23 +309,23 @@ void DisplayST7735::ip(const char* str) {
print(str);
}
void DisplayST7735::set_TextSize(uint8_t s) {
void DspCore::set_TextSize(uint8_t s) {
setTextSize(s);
}
void DisplayST7735::set_TextColor(uint16_t fg, uint16_t bg) {
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
setTextColor(fg, bg);
}
void DisplayST7735::set_Cursor(int16_t x, int16_t y) {
void DspCore::set_Cursor(int16_t x, int16_t y) {
setCursor(x, y);
}
void DisplayST7735::printText(const char* txt) {
void DspCore::printText(const char* txt) {
print(txt);
}
void DisplayST7735::loop() {
void DspCore::loop() {
}