znalazlem blad w write_to_buffer
This commit is contained in:
@@ -320,7 +320,7 @@ void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_
|
||||
mask_buf |= 0xFF >> (8 - (b.shift % 8));
|
||||
}
|
||||
|
||||
uint8_t shifted_pixels_left = (pos_y + bitmap_height) - b.bitmap_row * 8;
|
||||
uint8_t shifted_pixels_left = (pos_y%8 + bitmap_height) - b.bitmap_row * 8;
|
||||
if (shifted_pixels_left < 8) {
|
||||
mask_buf |= (0xFF << shifted_pixels_left);
|
||||
}
|
||||
@@ -385,7 +385,7 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
|
||||
mask_buf |= 0xFF >> (8 - (b.shift % 8));
|
||||
}
|
||||
|
||||
uint8_t shifted_pixels_left = (pos_y + height) - b.bitmap_row * 8;
|
||||
uint8_t shifted_pixels_left = (pos_y%8 + height) - b.bitmap_row * 8;
|
||||
if (shifted_pixels_left < 8) {
|
||||
mask_buf |= (0xFF << shifted_pixels_left);
|
||||
}
|
||||
@@ -395,9 +395,9 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
|
||||
if (bitmap_idx < b.bitmap_max_idx)
|
||||
{
|
||||
if (pos_y < 0) {
|
||||
tmp_buf16 |= color >> (b.shift % 8);
|
||||
tmp_buf16 |= (color >> (b.shift % 8)) & ~(mask_buf);
|
||||
} else {
|
||||
tmp_buf16 |= color << (b.shift % 8);
|
||||
tmp_buf16 |= (color << (b.shift % 8)) & ~(mask_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
|
||||
uint8_t char_nr = actual_char - font->startChar;
|
||||
const FONT_CHAR_INFO *charinfo = &font->charInfo[char_nr];
|
||||
|
||||
ssd1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, WHITE);
|
||||
SSD1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, BLACK);
|
||||
|
||||
x += charinfo->widthBits + font->interspacePixels;
|
||||
}
|
||||
|
||||
@@ -97,8 +97,9 @@ int main(void)
|
||||
SSD1306_display_all();
|
||||
// fctprintf(_ITM_SendChar, NULL, "This is a test: %X", 0xAA);
|
||||
// ssd1306_write_to_buffer(dualshock_btn[0], 24, 24, 10, 3);
|
||||
font_print_str(&arial_8ptFontInfo,(uint8_t *) "AgBj0yH", 0, 10);
|
||||
font_print_str(&arial_8ptFontInfo,(uint8_t *) "gBj0yHa", 0, 0);
|
||||
// font_print_str(&arial_8ptFontInfo,(uint8_t *) "AgBj0yH", 0, 10);
|
||||
// font_print_str(&arial_8ptFontInfo,(uint8_t *) "gBj0yHa", 0, 0);
|
||||
SSD1306_clear_buffer(10, 10, 64, 24, WHITE);
|
||||
SSD1306_display_all();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user