Support for x-inverted display
This commit is contained in:
parent
51286999ea
commit
b726d0d7bd
|
@ -11,7 +11,7 @@
|
|||
/**************************************************************************/
|
||||
|
||||
uint8_t lcdBuffer[RESX*RESY_B];
|
||||
int inverted = 0;
|
||||
int lcd_layout = 0;
|
||||
uint32_t intstatus;
|
||||
|
||||
#define TYPE_CMD 0
|
||||
|
@ -115,6 +115,7 @@ bool lcdGetPixel(char x, char y){
|
|||
}
|
||||
|
||||
void lcdDisplay(uint32_t shift) {
|
||||
char byte;
|
||||
select();
|
||||
|
||||
lcdWrite(TYPE_CMD,0xB0);
|
||||
|
@ -123,18 +124,25 @@ void lcdDisplay(uint32_t shift) {
|
|||
uint16_t i,page;
|
||||
for(page=0; page<RESY_B;page++) {
|
||||
for(i=0; i<RESX; i++) {
|
||||
if (inverted) {
|
||||
lcdWrite(TYPE_DATA,~lcdBuffer[page*RESX+((i+shift)%RESX)]);
|
||||
} else {
|
||||
lcdWrite(TYPE_DATA,lcdBuffer[page*RESX+((i+shift)%RESX)]);
|
||||
}
|
||||
if (lcd_layout & LCD_MIRRORX)
|
||||
byte=lcdBuffer[page*RESX+RESX-((i+shift)%RESX)];
|
||||
else
|
||||
byte=lcdBuffer[page*RESX+((i+shift)%RESX)];
|
||||
|
||||
if (lcd_layout & LCD_INVERTED)
|
||||
byte=~byte;
|
||||
|
||||
lcdWrite(TYPE_DATA,byte);
|
||||
}
|
||||
}
|
||||
|
||||
deselect();
|
||||
}
|
||||
|
||||
void lcdInvert(void) {
|
||||
inverted = ~inverted;
|
||||
inline void lcdInvert(void) {
|
||||
lcdToggleFlag(LCD_INVERTED);
|
||||
}
|
||||
|
||||
void lcdToggleFlag(int flag) {
|
||||
lcd_layout=lcd_layout ^ flag;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
#define RESY 68
|
||||
#define RESY_B 9
|
||||
|
||||
#define LCD_INVERTED (1<<0)
|
||||
#define LCD_MIRRORX (1<<1)
|
||||
#define LCD_MIRRORY (1<<2)
|
||||
|
||||
/* Display buffer */
|
||||
extern uint8_t lcdBuffer[RESX*RESY_B];
|
||||
|
@ -21,6 +24,7 @@ void lcdInit(void);
|
|||
void lcdFill(char f);
|
||||
void lcdDisplay(uint32_t shift);
|
||||
void lcdInvert(void);
|
||||
void lcdToggleFlag(int flag);
|
||||
void lcdSetPixel(char x, char y, bool f);
|
||||
bool lcdGetPixel(char x, char y);
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#include "lcd/allfonts.h"
|
||||
#include "lcd/backlight.h"
|
||||
#include "lcd/decoder.h"
|
||||
#include "lcd/display.h"
|
||||
#include "lcd/render.h"
|
Loading…
Reference in New Issue