Coordinate safe SetPixel. I will need it.
This commit is contained in:
parent
33af906622
commit
932455ccd3
|
@ -100,7 +100,14 @@ void lcdFill(char f){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void lcdSafeSetPixel(char x, char y, bool f){
|
||||||
|
if (x>=0 && x<=RESX && y>=0 && y <= RESY)
|
||||||
|
lcdSetPixel(x, y, f);
|
||||||
|
}
|
||||||
|
|
||||||
void lcdSetPixel(char x, char y, bool f){
|
void lcdSetPixel(char x, char y, bool f){
|
||||||
|
if (x<0 || x> RESX || y<0 || y > RESY)
|
||||||
|
return;
|
||||||
char y_byte = (RESY-(y+1)) / 8;
|
char y_byte = (RESY-(y+1)) / 8;
|
||||||
char y_off = (RESY-(y+1)) % 8;
|
char y_off = (RESY-(y+1)) % 8;
|
||||||
char byte = lcdBuffer[y_byte*RESX+(RESX-(x+1))];
|
char byte = lcdBuffer[y_byte*RESX+(RESX-(x+1))];
|
||||||
|
|
|
@ -26,6 +26,7 @@ void lcdDisplay(uint32_t shift);
|
||||||
void lcdInvert(void);
|
void lcdInvert(void);
|
||||||
void lcdToggleFlag(int flag);
|
void lcdToggleFlag(int flag);
|
||||||
void lcdSetPixel(char x, char y, bool f);
|
void lcdSetPixel(char x, char y, bool f);
|
||||||
|
void lcdSafeSetPixel(char x, char y, bool f);
|
||||||
bool lcdGetPixel(char x, char y);
|
bool lcdGetPixel(char x, char y);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue