void drawChar8x12(uint8_t x, uint8_t y, char c) { uint8_t col = 0; uint8_t row = 0; uint8_t bit = 0x80; uint8_t oc = c - 0x20; setAddr(x, y, x + 7, y + 11); while (row < 12) { while (col < 8) { if (font_8x12[oc][row] & bit) { //foreground lcd_data_send(colorHighByte); lcd_data_send(colorLowByte); } else { //background lcd_data_send(bgColorHighByte); lcd_data_send(bgColorLowByte); } bit >>= 1; col++; } bit = 0x80; col = 0; row++; } }
void drawChar(uint8_t x, uint8_t y, char c) { uint8_t col = 0; uint8_t row = 0; uint8_t bit = 0x01; uint8_t oc = c - 0x20; setAddr(x, y, x + 4, y + 7); // if you want to fill column between chars, change x + 4 to x + 5 while (row < 8) { while (col < 5) { if (font[oc][col] & bit) { //foreground lcd_data_send(colorHighByte); lcd_data_send(colorLowByte); } else { //background lcd_data_send(bgColorHighByte); lcd_data_send(bgColorLowByte); } col++; } // if you want to fill column between chars, writeData(bgColor) here col = 0; bit <<= 1; row++; } }
void setAddr(uint8_t xStart, uint8_t yStart, uint8_t xEnd, uint8_t yEnd) { lcd_command_send(ST7735_CASET); lcd_data_send(0x00); lcd_data_send(xStart); lcd_data_send(0x00); lcd_data_send(xEnd); lcd_command_send(ST7735_RASET); lcd_data_send(0x00); lcd_data_send(yStart); lcd_data_send(0x00); lcd_data_send(yEnd); lcd_command_send(ST7735_RAMWR); }
void setAddr(uint8_t xStart, uint8_t yStart, uint8_t xEnd, uint8_t yEnd) { lcd_command_send(ST7735_CASET); lcd_data_send(0x00); //High byte for address, not used since our screen is small lcd_data_send(xStart); lcd_data_send(0x00); lcd_data_send(xEnd); lcd_command_send(ST7735_RASET); lcd_data_send(0x00); lcd_data_send(yStart); lcd_data_send(0x00); lcd_data_send(yEnd); lcd_command_send(ST7735_RAMWR); }
void drawChar(uint8_t x, uint8_t y, char c) { uint8_t col = 0; uint8_t row = 0; uint8_t bit = 0x01; uint8_t oc = c - 0x20; setAddr(x, y, x + 4, y + 7); while (row < 8) { while (col < 5) { if (font[oc][col] & bit) { lcd_data_send(colorHighByte); lcd_data_send(colorLowByte); } else { lcd_data_send(bgColorHighByte); lcd_data_send(bgColorLowByte); } col++; } col = 0; bit <<= 1; row++; } }
void writeConfig(uint8_t command, uint8_t num_args, const uint8_t *args) { lcd_command_send(command); // Send Command first while (num_args--) { lcd_data_send(*args++); //Send data per arg } }