-
-
Save anonymous/ab0351022bb99f67d803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void draw_character(font_t* font, uint8_t x, uint8_t y, char chr) { | |
for (uint8_t cy=0; cy < 8; cy++) { | |
for (uint8_t cx=0; cx < 8; cx++) { | |
uint8_t d = (y + cy) % 8; | |
uint8_t* b = &gfx_buffer[((y + cy) / 8 * 128) + x + cx]; | |
uint8_t** flash_data = pgm_read_word(&font->data); | |
uint8_t* chr_data = pgm_read_word(&flash_data[chr]); | |
if (pgm_read_byte(&chr_data[7 - cy]) & (0x01 << cx)) { | |
*b |= 0x80 >> d; | |
} else { | |
*b &= ~(0x80 >> d); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment