41 uint8_t text_index = 0;
42 uint8_t page_offset = 0;
45 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
49 if ( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] ==
'\0') )
53 if (y >= (
lcdint_t)( this->m_h >> 3))
58 if (page_offset == this->m_font->getPages())
71 this->m_intf.endBlock();
72 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
77 unicode = this->m_font->unicode16FromUtf8(ch[j]);
81 this->m_font->getCharBitmap(unicode, &char_info);
84 if (char_info.
height > page_offset * 8)
86 char_info.
glyph += page_offset * char_info.
width;
87 for( i = char_info.
width; i>0; i--)
90 if ( style == STYLE_NORMAL )
92 data = pgm_read_byte(&char_info.
glyph[0]);
94 else if ( style == STYLE_BOLD )
96 uint8_t temp = pgm_read_byte(&char_info.
glyph[0]);
102 uint8_t temp = pgm_read_byte(&char_info.
glyph[1]);
103 data = (temp & 0xF0) | ldata;
104 ldata = (temp & 0x0F);
106 this->m_intf.send(data^s_ssd1306_invertByte);
114 for (i = 0; i < char_info.
spacing; i++)
115 this->m_intf.send(s_ssd1306_invertByte);
117 this->m_intf.endBlock();
120 #ifndef DOXYGEN_SHOULD_SKIP_THIS 125 uint8_t text_index = 0;
126 uint8_t page_offset = 0;
129 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
135 if( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] ==
'\0') )
139 if (y >= (this->m_h >> 3))
144 if (page_offset == this->m_font->getPages())
157 this->m_intf.endBlock();
158 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
161 if ( c >= this->m_font->getHeader().ascii_offset )
163 c -= this->m_font->getHeader().ascii_offset;
166 offset = (c * this->m_font->getPages() + page_offset) * this->m_font->getHeader().
width;
167 for( i=this->m_font->getHeader().width; i>0; i--)
170 if ( style == STYLE_NORMAL )
172 data = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
174 else if ( style == STYLE_BOLD )
176 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
182 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset + 1]);
183 data = (temp & 0xF0) | ldata;
184 ldata = (temp & 0x0F);
186 this->m_intf.send(data^s_ssd1306_invertByte);
189 x += this->m_font->getHeader().width;
192 this->m_intf.endBlock();
200 uint8_t text_index = 0;
201 uint8_t page_offset = 0;
204 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
208 if( (x > this->m_w - (this->m_font->getHeader().width << factor)) || (ch[j] ==
'\0') )
212 if (y >= (this->m_h >> 3))
217 if (page_offset == (this->m_font->getPages() << factor))
230 this->m_intf.endBlock();
231 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
236 unicode = this->m_font->unicode16FromUtf8(ch[j]);
240 this->m_font->getCharBitmap(unicode, &char_info);
243 if (char_info.
height > (page_offset >> factor) * 8)
245 char_info.
glyph += (page_offset >> factor) * char_info.
width;
246 for( i=char_info.
width; i>0; i--)
249 if ( style == STYLE_NORMAL )
251 data = pgm_read_byte(char_info.
glyph);
253 else if ( style == STYLE_BOLD )
255 uint8_t temp = pgm_read_byte(char_info.
glyph);
261 uint8_t temp = pgm_read_byte(char_info.
glyph+1);
262 data = (temp & 0xF0) | ldata;
263 ldata = (temp & 0x0F);
268 uint8_t mask = ~((0xFF) << (1<<factor));
273 data >>= ((page_offset & ((1<<factor) - 1))<<(3-factor));
274 for (uint8_t idx = 0; idx < 1<<(3-factor); idx++)
276 accum |= (((data>>idx) & 0x01) ? (mask<<(idx<<factor)) : 0);
280 for (uint8_t z=(1<<factor); z>0; z--)
282 this->m_intf.send(data^s_ssd1306_invertByte);
291 for (i = 0; i < (char_info.
spacing << factor); i++)
292 this->m_intf.send(s_ssd1306_invertByte);
300 this->m_intf.startBlock(x, y >> 3, 1);
301 this->m_intf.send((1 << (y & 0x07))^s_ssd1306_invertByte);
302 this->m_intf.endBlock();
308 this->m_intf.startBlock(x1, y1 >> 3, x2 - x1 + 1);
309 for (uint8_t x = x1; x <= x2; x++)
311 this->m_intf.send((1 << (y1 & 0x07))^s_ssd1306_invertByte);
313 this->m_intf.endBlock();
319 uint8_t topPage = y1 >> 3;
320 uint8_t bottomPage = y2 >> 3;
321 uint8_t height = y2-y1;
323 this->m_intf.startBlock(x1, topPage, 1);
324 if (topPage == bottomPage)
326 this->m_intf.send( ((0xFF >> (0x07 - height)) << (y1 & 0x07))^s_ssd1306_invertByte );
327 this->m_intf.endBlock();
330 this->m_intf.send( (0xFF << (y1 & 0x07))^s_ssd1306_invertByte );
331 for ( y = (topPage + 1); y <= (bottomPage - 1); y++)
333 this->m_intf.nextBlock();
334 this->m_intf.send( 0xFF^s_ssd1306_invertByte );
336 this->m_intf.nextBlock();
337 this->m_intf.send( (0xFF >> (0x07 - (y2 & 0x07)))^s_ssd1306_invertByte );
338 this->m_intf.endBlock();
344 uint8_t templ = this->m_color^s_ssd1306_invertByte;
349 uint8_t bank1 = (y1 >> 3);
350 uint8_t bank2 = (y2 >> 3);
351 this->m_intf.startBlock(x1, bank1, x2 - x1 + 1);
352 for (uint8_t bank = bank1; bank<=bank2; bank++)
357 mask = (mask >> ((y1 & 7) + 7 - (y2 & 7))) << (y1 & 7);
359 else if (bank1 == bank)
361 mask = (mask << (y1 & 7));
363 else if (bank2 == bank)
365 mask = (mask >> (7 - (y2 & 7)));
367 for (uint8_t x=x1; x<=x2; x++)
371 this->m_intf.send(templ & mask);
373 this->m_intf.nextBlock();
375 this->m_intf.endBlock();
399 this->m_intf.startBlock(x, y, w);
400 for(j=(h >> 3); j>0; j--)
406 for (uint8_t k = 0; k<8; k++)
408 data |= ( ((pgm_read_byte(&bitmap[k*pitch]) >> bit) & 0x01) << k );
410 this->m_intf.send( s_ssd1306_invertByte^data );
423 this->m_intf.nextBlock();
425 this->m_intf.endBlock();
432 uint8_t offset = y & 0x07;
433 uint8_t complexFlag = 0;
434 uint8_t mainFlag = 1;
439 if (y >= (
lcdint_t)this->m_h)
return;
441 if (x >= (
lcdint_t)this->m_w)
return;
444 bitmap += ((
lcduint_t)((-y) + 7) >> 3) * w;
455 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
464 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
466 uint8_t color = this->m_color ? 0xFF: 0x00;
467 this->m_intf.startBlock(x, y >> 3, w);
468 for(j=0; j < pages; j++)
470 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
471 for( i=w; i > 0; i--)
474 if ( mainFlag ) data |= ((pgm_read_byte(bitmap) << offset) & color);
475 if ( complexFlag ) data |= ((pgm_read_byte(bitmap - origin_width) >> (8 - offset)) & color);
477 this->m_intf.send(s_ssd1306_invertByte^data);
479 bitmap += origin_width - w;
480 complexFlag = offset;
481 this->m_intf.nextBlock();
483 this->m_intf.endBlock();
490 uint8_t offset = y & 0x07;
491 uint8_t complexFlag = 0;
492 uint8_t mainFlag = 1;
497 if (y >= (
lcdint_t)this->m_h)
return;
499 if (x >= (
lcdint_t)this->m_w)
return;
513 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
522 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
524 uint8_t color = this->m_color ? 0xFF: 0x00;
525 this->m_intf.startBlock(x, y >> 3, w);
526 for(j=0; j < pages; j++)
528 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
529 for( i=w; i > 0; i--)
532 if ( mainFlag ) data |= ((pgm_read_byte(buf) << offset) & color);
533 if ( complexFlag ) data |= ((pgm_read_byte(buf - origin_width) >> (8 - offset)) & color);
535 this->m_intf.send(s_ssd1306_invertByte^data);
537 buf += origin_width - w;
538 complexFlag = offset;
539 this->m_intf.nextBlock();
541 this->m_intf.endBlock();
566 uint8_t offset = y & 0x07;
567 uint8_t complexFlag = 0;
568 uint8_t mainFlag = 1;
573 if (y >= (
lcdint_t)this->m_h)
return;
575 if (x >= (
lcdint_t)this->m_w)
return;
578 buffer += ((
lcduint_t)((-y) + 7) >> 3) * w;
589 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
598 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
600 this->m_intf.startBlock(x, y >> 3, w);
601 for(j=0; j < pages; j++)
603 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
604 for( i=w; i > 0; i--)
607 if ( mainFlag ) data |= ((*buffer << offset) & this->m_color);
608 if ( complexFlag ) data |= ((*(buffer - origin_width) >> (8 - offset)) & this->m_color);
610 this->m_intf.send(s_ssd1306_invertByte^data);
612 buffer += origin_width - w;
613 complexFlag = offset;
614 this->m_intf.nextBlock();
616 this->m_intf.endBlock();
623 this->m_intf.startBlock(x, y >> 3, w);
624 for(j=(h >> 3); j>0; j--)
626 this->m_intf.sendBuffer( buf, w );
628 this->m_intf.nextBlock();
630 this->m_intf.endBlock();
654 color ^= s_ssd1306_invertByte;
655 this->m_intf.startBlock(0, 0, 0);
656 for(uint8_t m=(this->m_h >> 3); m>0; m--)
658 for(uint8_t n=this->m_w; n>0; n--)
660 this->m_intf.send(color);
662 this->m_intf.nextBlock();
664 this->m_intf.endBlock();
void drawBitmap8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Draws 8-bit color bitmap in color buffer. Draws 8-bit color bitmap in color buffer.
void fill(uint16_t color)
void drawBitmap16(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
uint8_t height
char height in pixels
void drawBitmap1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap) __attribute__((noinline))
Draws monochrome bitmap in color buffer using color, specified via setColor() method Draws monochrome...
void drawBuffer4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
void fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
#define SSD1306_MORE_CHARS_REQUIRED
void gfx_drawMonoBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf)
void drawBuffer1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
void drawBuffer1Fast(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer)
void drawXBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
void putPixel(lcdint_t x, lcdint_t y) __attribute__((noinline))
uint8_t width
char width in pixels
void printFixedN(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style, uint8_t factor) __attribute__((noinline))
void drawBuffer8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
const uint8_t * glyph
char data, located in progmem.
void printFixed(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style=STYLE_NORMAL) __attribute__((noinline))
void drawBitmap4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Draws 4-bit gray-color bitmap in color buffer. Draws 4-bit gray-color bitmap in color buffer...
uint8_t spacing
additional spaces after char in pixels
void drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2)
void drawHLine(lcdint_t x1, lcdint_t y1, lcdint_t x2)
void drawBuffer16(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))