Moderators: adafruit_support_bill, adafruit
void ST7565::drawchar(uint8_t x, uint8_t line, char c) {
for (uint8_t i =0; i<5; i++ ) {
st7565_buffer[x + (line*128) ] = pgm_read_byte(font+(c*5)+i);
x++;
}
updateBoundingBox(x, line*8, x+5, line*8 + 8);
}void ST7565::my_setpixel(uint8_t x, uint8_t y, uint8_t color) {
if ((x >= LCDWIDTH) || (y >= LCDHEIGHT))
return;
// x is which column
if (color)
st7565_buffer[x+ (y/8)*128] |= _BV(7-(y%8));
else
st7565_buffer[x+ (y/8)*128] &= ~_BV(7-(y%8));
}
if (flipped)
{
x = LCDWIDTH - x;
y = LCDHEIGHT - y;
}adafruit_support wrote:Looks like "my_setpixel" is the one to hack:
- Code: Select all
void ST7565::my_setpixel(uint8_t x, uint8_t y, uint8_t color) {
if ((x >= LCDWIDTH) || (y >= LCDHEIGHT))
return;
// x is which column
if (color)
st7565_buffer[x+ (y/8)*128] |= _BV(7-(y%8));
else
st7565_buffer[x+ (y/8)*128] &= ~_BV(7-(y%8));
}
You could add a test at the beginning:
- Code: Select all
if (flipped)
{
x = LCDWIDTH - x;
y = LCDHEIGHT - y;
}
adafruit_support wrote:It is only references in one place:
- Code: Select all
void ST7565::drawchar(uint8_t x, uint8_t line, char c) {
for (uint8_t i =0; i<5; i++ ) {
st7565_buffer[x + (line*128) ] = pgm_read_byte(font+(c*5)+i);
x++;
}
updateBoundingBox(x, line*8, x+5, line*8 + 8);
}
adafruit_support wrote:The memory layout of the ST7565 is optimized for displaying characters on 8-pixel line boundaries. You are writing 8 pixels at a time vertically with each byte. See the screen layout section of this tutorial:
http://edeca.net/wp/electronics/the-st7 ... ontroller/
#define CMD_SET_ADC_NORMAL 0xA0
#define CMD_SET_ADC_REVERSE 0xA1
#define CMD_SET_COM_NORMAL 0xC0
#define CMD_SET_COM_REVERSE 0xC8Return to Glowy things (LCD, LED, TFT, EL) purchased at Adafruit
Users browsing this forum: Google [Bot], mibignistinly and 4 guests