void ssd1306_fill_screen(uint8_t chXpos1, uint8_t chYpos1, uint8_t chXpos2, uint8_t chYpos2, uint8_t chDot)
{
uint8_t chXpos, chYpos;
for (chXpos = chXpos1; chXpos <= chXpos2; chXpos ++) {
for (chYpos = chYpos1; chYpos <= chYpos2; chYpos ++) {
ssd1306_draw_point(chXpos, chYpos, chDot);
}
}
ssd1306_refresh_gram();
}
/**
* @brief Displays one character at the specified position
*
* @param chXpos: Specifies the X position
* @param chYpos: Specifies the Y position
* @param chSize:
* @param chMode
* @retval
**/
void ssd1306_display_char(uint8_t chXpos, uint8_t chYpos, uint8_t chChr, uint8_t chSize, uint8_t chMode)
{
uint8_t i, j;
uint8_t chTemp, chYpos0 = chYpos;
chChr = chChr - ' ';
for (i = 0; i < chSize; i ++) {
if (chMode) {
chTemp = c_chFont1608[chChr][i];
} else {
chTemp = ~c_chFont1608[chChr][i];
}
for (j = 0; j < 8; j ++) {
if (chTemp & 0x80) {
ssd1306_draw_point(chXpos, chYpos, 1);
} else {
ssd1306_draw_point(chXpos, chYpos, 0);
}
chTemp <<= 1;
chYpos ++;
if ((chYpos - chYpos0) == chSize) {
chYpos = chYpos0;
chXpos ++;
break;
}
}
}
}
/**
* @brief Displays a string on the screen
*
* @param chXpos: Specifies the X position
* @param chYpos: Specifies the Y position
* @param pchString: Pointer to a string to display on the screen
*
* @retval None
**/
void ssd1306_display_string(uint8_t chXpos, uint8_t chYpos, const uint8_t *pchString, uint8_t chSize, uint8_t chMode)
{
while (*pchString != '\0') {
if (chXpos > (SSD1306_WIDTH - chSize / 2)) {
chXpos = 0;
chYpos += chSize;
if (chYpos > (SSD1306_HEIGHT - chSize)) {
chYpos = chXpos = 0;
ssd1306_clear_screen(0x00);
}
}
ssd1306_display_char(chXpos, chYpos, *pchString, chSize, chMode);
chXpos += chSize / 2;
pchString ++;
}
}