display update

This commit is contained in:
gemu2015 2019-08-23 10:26:09 +02:00
parent 3fe57e0841
commit 8c3c3f1709
7 changed files with 67 additions and 58 deletions

View File

@ -219,27 +219,27 @@ void Epd42::SetLut(void) {
unsigned int count;
SendCommand(LUT_FOR_VCOM); //vcom
for(count = 0; count < 44; count++) {
SendData(lut_vcom0[count]);
SendData(pgm_read_byte(&lut_vcom0[count]));
}
SendCommand(LUT_WHITE_TO_WHITE); //ww --
for(count = 0; count < 42; count++) {
SendData(lut_ww[count]);
SendData(pgm_read_byte(&lut_ww[count]));
}
SendCommand(LUT_BLACK_TO_WHITE); //bw r
for(count = 0; count < 42; count++) {
SendData(lut_bw[count]);
SendData(pgm_read_byte(&lut_bw[count]));
}
SendCommand(LUT_WHITE_TO_BLACK); //wb w
for(count = 0; count < 42; count++) {
SendData(lut_wb[count]);
SendData(pgm_read_byte(&lut_wb[count]));
}
SendCommand(LUT_BLACK_TO_BLACK); //bb b
for(count = 0; count < 42; count++) {
SendData(lut_bb[count]);
SendData(pgm_read_byte(&lut_bb[count]));
}
}
@ -252,27 +252,27 @@ void Epd42::SetLutQuick(void) {
unsigned int count;
SendCommand(LUT_FOR_VCOM); //vcom
for(count = 0; count < 44; count++) {
SendData(lut_vcom0_quick[count]);
SendData(pgm_read_byte(&lut_vcom0_quick[count]));
}
SendCommand(LUT_WHITE_TO_WHITE); //ww --
for(count = 0; count < 42; count++) {
SendData(lut_ww_quick[count]);
SendData(pgm_read_byte(&lut_ww_quick[count]));
}
SendCommand(LUT_BLACK_TO_WHITE); //bw r
for(count = 0; count < 42; count++) {
SendData(lut_bw_quick[count]);
SendData(pgm_read_byte(&lut_bw_quick[count]));
}
SendCommand(LUT_WHITE_TO_BLACK); //wb w
for(count = 0; count < 42; count++) {
SendData(lut_wb_quick[count]);
SendData(pgm_read_byte(&lut_wb_quick[count]));
}
SendCommand(LUT_BLACK_TO_BLACK); //bb b
for(count = 0; count < 42; count++) {
SendData(lut_bb_quick[count]);
SendData(pgm_read_byte(&lut_bb_quick[count]));
}
}
@ -387,7 +387,7 @@ void Epd42::Sleep() {
SendData(0xA5);
}
const unsigned char lut_vcom0[] =
const unsigned char lut_vcom0[] PROGMEM =
{
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x00, 0x17, 0x17, 0x00, 0x00, 0x02,
@ -398,7 +398,7 @@ const unsigned char lut_vcom0[] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char lut_vcom0_quick[] =
const unsigned char lut_vcom0_quick[] PROGMEM =
{
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -411,7 +411,8 @@ const unsigned char lut_vcom0_quick[] =
const unsigned char lut_ww[] ={
const unsigned char lut_ww[] PROGMEM =
{
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
@ -421,7 +422,8 @@ const unsigned char lut_ww[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char lut_ww_quick[] ={
const unsigned char lut_ww_quick[] PROGMEM =
{
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -432,7 +434,8 @@ const unsigned char lut_ww_quick[] ={
};
const unsigned char lut_bw[] ={
const unsigned char lut_bw[] PROGMEM =
{
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
@ -443,7 +446,8 @@ const unsigned char lut_bw[] ={
};
const unsigned char lut_bw_quick[] ={
const unsigned char lut_bw_quick[] PROGMEM =
{
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -453,7 +457,8 @@ const unsigned char lut_bw_quick[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char lut_bb[] ={
const unsigned char lut_bb[] PROGMEM =
{
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
@ -463,7 +468,8 @@ const unsigned char lut_bb[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char lut_bb_quick[] ={
const unsigned char lut_bb_quick[] PROGMEM =
{
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -474,7 +480,8 @@ const unsigned char lut_bb_quick[] ={
};
const unsigned char lut_wb[] ={
const unsigned char lut_wb[] PROGMEM =
{
0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
@ -484,7 +491,8 @@ const unsigned char lut_wb[] ={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char lut_wb_quick[] ={
const unsigned char lut_wb_quick[] PROGMEM =
{
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -180,7 +180,7 @@ void EpdRefresh29(void) // Every second
* Interface
\*********************************************************************************************/
bool Xdsp05(byte function)
bool Xdsp05(uint8_t function)
{
bool result = false;
if (FUNC_DISPLAY_INIT_DRIVER == function) {

View File

@ -17,9 +17,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef USE_SPI
#ifdef USE_DISPLAY
#ifdef USE_DISPLAY_EPAPER_42
#ifdef USE_DISPLAY_E_42
#define XDSP_06 6
@ -33,11 +34,11 @@
#include <epd4in2.h>
#include <epdpaint.h>
//unsigned char image[(EPD_HEIGHT * EPD_WIDTH) / 8];
extern uint8_t *buffer;
Epd42 *epd42;
/*********************************************************************************************/
void EpdInitDriver42()
@ -124,15 +125,15 @@ void EpdRefresh42() // Every second
#endif // USE_DISPLAY_MODES1TO5
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xdsp06(byte function)
bool Xdsp06(uint8_t function)
{
bool result = false;
//if (spi_flg) {
if (FUNC_DISPLAY_INIT_DRIVER == function) {
EpdInitDriver42();
}
@ -150,10 +151,10 @@ bool Xdsp06(byte function)
#endif // USE_DISPLAY_MODES1TO5
}
}
//}
return result;
}
#endif // USE_DISPLAY_EPAPER42
#endif // USE_DISPLAY
#endif // USE_SPI

View File

@ -163,7 +163,7 @@ void SH1106Refresh(void) // Every second
* Interface
\*********************************************************************************************/
bool Xdsp07(byte function)
bool Xdsp07(uint8_t function)
{
bool result = false;

View File

@ -37,8 +37,8 @@
#include <ILI9488.h>
#include <FT6236.h>
TouchLocation pLoc;
uint8_t ctouch_counter = 0;
TouchLocation ili9488_pLoc;
uint8_t ili9488_ctouch_counter = 0;
// currently fixed
#define BACKPLANE_PIN 2
@ -131,34 +131,34 @@ void ILI9488_MQTT(uint8_t count,const char *cp) {
// check digitizer hit
void FT6236Check() {
uint16_t temp;
ctouch_counter++;
if (2 == ctouch_counter) {
ili9488_ctouch_counter++;
if (2 == ili9488_ctouch_counter) {
// every 100 ms should be enough
ctouch_counter=0;
if (FT6236readTouchLocation(&pLoc,1)) {
ili9488_ctouch_counter=0;
if (FT6236readTouchLocation(&ili9488_pLoc,1)) {
// did find a hit
if (renderer) {
uint8_t rot=renderer->getRotation();
switch (rot) {
case 0:
temp=pLoc.y;
pLoc.y=renderer->height()-pLoc.x;
pLoc.x=temp;
temp=ili9488_pLoc.y;
ili9488_pLoc.y=renderer->height()-ili9488_pLoc.x;
ili9488_pLoc.x=temp;
break;
case 1:
break;
case 2:
break;
case 3:
temp=pLoc.y;
pLoc.y=pLoc.x;
pLoc.x=renderer->width()-temp;
temp=ili9488_pLoc.y;
ili9488_pLoc.y=ili9488_pLoc.x;
ili9488_pLoc.x=renderer->width()-temp;
break;
}
// now must compare with defined buttons
for (uint8_t count=0; count<MAXBUTTONS; count++) {
if (buttons[count]) {
if (buttons[count]->contains(pLoc.x,pLoc.y)) {
if (buttons[count]->contains(ili9488_pLoc.x,ili9488_pLoc.y)) {
// did hit
buttons[count]->press(true);
if (buttons[count]->justPressed()) {
@ -205,8 +205,8 @@ if (2 == ctouch_counter) {
}
}
}
pLoc.x=0;
pLoc.y=0;
ili9488_pLoc.x=0;
ili9488_pLoc.y=0;
}
}
}
@ -215,7 +215,7 @@ if (2 == ctouch_counter) {
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xdsp08(byte function)
bool Xdsp08(uint8_t function)
{
bool result = false;

View File

@ -157,7 +157,7 @@ void SSD1351Refresh(void) // Every second
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xdsp09(byte function)
bool Xdsp09(uint8_t function)
{
bool result = false;

View File

@ -36,8 +36,8 @@
#include <RA8876.h>
#include <FT6236.h>
TouchLocation pLoc;
uint8_t ctouch_counter = 0;
TouchLocation ra8876_pLoc;
uint8_t ra8876_ctouch_counter = 0;
#ifdef USE_TOUCH_BUTTONS
extern VButton *buttons[];
@ -117,21 +117,21 @@ void RA8876_MQTT(uint8_t count,const char *cp) {
// check digitizer hit
void FT5316Check() {
uint16_t temp;
ctouch_counter++;
if (2 == ctouch_counter) {
ra8876_ctouch_counter++;
if (2 == ra8876_ctouch_counter) {
// every 100 ms should be enough
ctouch_counter=0;
ra8876_ctouch_counter=0;
// panel has 800x480
if (FT6236readTouchLocation(&pLoc,1)) {
pLoc.x=pLoc.x*RA8876_TFTWIDTH/800;
pLoc.y=pLoc.y*RA8876_TFTHEIGHT/480;
if (FT6236readTouchLocation(&ra8876_pLoc,1)) {
ra8876_pLoc.x=ra8876_pLoc.x*RA8876_TFTWIDTH/800;
ra8876_pLoc.y=ra8876_pLoc.y*RA8876_TFTHEIGHT/480;
// did find a hit
if (renderer) {
// rotation not supported
pLoc.x=RA8876_TFTWIDTH-pLoc.x;
pLoc.y=RA8876_TFTHEIGHT-pLoc.y;
ra8876_pLoc.x=RA8876_TFTWIDTH-ra8876_pLoc.x;
ra8876_pLoc.y=RA8876_TFTHEIGHT-ra8876_pLoc.y;
/*
uint8_t rot=renderer->getRotation();
@ -159,7 +159,7 @@ if (2 == ctouch_counter) {
// now must compare with defined buttons
for (uint8_t count=0; count<MAXBUTTONS; count++) {
if (buttons[count]) {
if (buttons[count]->contains(pLoc.x,pLoc.y)) {
if (buttons[count]->contains(ra8876_pLoc.x,ra8876_pLoc.y)) {
// did hit
buttons[count]->press(true);
if (buttons[count]->justPressed()) {
@ -206,8 +206,8 @@ if (2 == ctouch_counter) {
}
}
}
pLoc.x=0;
pLoc.y=0;
ra8876_pLoc.x=0;
ra8876_pLoc.y=0;
}
}
}
@ -396,7 +396,7 @@ Serial.print("Text test took "); Serial.print(elapsedtime); Serial.println(" ms"
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xdsp10(byte function)
bool Xdsp10(uint8_t function)
{
bool result = false;