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();
123 uint16_t unicode = this->m_font->unicode16FromUtf8(c);
126 this->m_font->getCharBitmap(unicode, &char_info);
127 uint8_t mode = this->m_textMode;
128 for (uint8_t i = 0; i<(this->m_fontStyle == STYLE_BOLD ? 2: 1); i++)
130 this->drawBitmap1(this->m_cursorX + i,
137 this->m_textMode = mode;
140 (this->m_cursorX > ((
lcdint_t)this->m_w - (
lcdint_t)this->m_font->getHeader().width) ) )
142 (this->m_cursorX > ((
lcdint_t)this->m_w - (
lcdint_t)this->m_font->getHeader().width)) ) )
144 this->m_cursorY += (
lcdint_t)this->m_font->getHeader().height;
146 if ( (this->m_textMode & CANVAS_TEXT_WRAP_LOCAL) &&
147 (this->m_cursorY > ((
lcdint_t)this->m_h - (
lcdint_t)this->m_font->getHeader().height)) )
160 this->m_cursorY += (
lcdint_t)this->m_font->getHeader().height;
169 return printChar( c );
174 #ifndef DOXYGEN_SHOULD_SKIP_THIS 179 uint8_t text_index = 0;
180 uint8_t page_offset = 0;
183 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
189 if( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] ==
'\0') )
193 if (y >= (this->m_h >> 3))
198 if (page_offset == this->m_font->getPages())
211 this->m_intf.endBlock();
212 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
215 if ( c >= this->m_font->getHeader().ascii_offset )
217 c -= this->m_font->getHeader().ascii_offset;
220 offset = (c * this->m_font->getPages() + page_offset) * this->m_font->getHeader().
width;
221 for( i=this->m_font->getHeader().width; i>0; i--)
224 if ( style == STYLE_NORMAL )
226 data = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
228 else if ( style == STYLE_BOLD )
230 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
236 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset + 1]);
237 data = (temp & 0xF0) | ldata;
238 ldata = (temp & 0x0F);
240 this->m_intf.send(data^s_ssd1306_invertByte);
243 x += this->m_font->getHeader().width;
246 this->m_intf.endBlock();
254 uint8_t text_index = 0;
255 uint8_t page_offset = 0;
258 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
262 if( (x > this->m_w - (this->m_font->getHeader().width << factor)) || (ch[j] ==
'\0') )
266 if (y >= (this->m_h >> 3))
271 if (page_offset == (this->m_font->getPages() << factor))
284 this->m_intf.endBlock();
285 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
290 unicode = this->m_font->unicode16FromUtf8(ch[j]);
294 this->m_font->getCharBitmap(unicode, &char_info);
297 if (char_info.
height > (page_offset >> factor) * 8)
299 char_info.
glyph += (page_offset >> factor) * char_info.
width;
300 for( i=char_info.
width; i>0; i--)
303 if ( style == STYLE_NORMAL )
305 data = pgm_read_byte(char_info.
glyph);
307 else if ( style == STYLE_BOLD )
309 uint8_t temp = pgm_read_byte(char_info.
glyph);
315 uint8_t temp = pgm_read_byte(char_info.
glyph+1);
316 data = (temp & 0xF0) | ldata;
317 ldata = (temp & 0x0F);
322 uint8_t mask = ~((0xFF) << (1<<factor));
327 data >>= ((page_offset & ((1<<factor) - 1))<<(3-factor));
328 for (uint8_t idx = 0; idx < 1<<(3-factor); idx++)
330 accum |= (((data>>idx) & 0x01) ? (mask<<(idx<<factor)) : 0);
334 for (uint8_t z=(1<<factor); z>0; z--)
336 this->m_intf.send(data^s_ssd1306_invertByte);
345 for (i = 0; i < (char_info.
spacing << factor); i++)
346 this->m_intf.send(s_ssd1306_invertByte);
354 this->m_intf.startBlock(x, y >> 3, 1);
355 this->m_intf.send((1 << (y & 0x07))^s_ssd1306_invertByte);
356 this->m_intf.endBlock();
362 this->m_intf.startBlock(x1, y1 >> 3, x2 - x1 + 1);
363 for (uint8_t x = x1; x <= x2; x++)
365 this->m_intf.send((1 << (y1 & 0x07))^s_ssd1306_invertByte);
367 this->m_intf.endBlock();
373 uint8_t topPage = y1 >> 3;
374 uint8_t bottomPage = y2 >> 3;
375 uint8_t height = y2-y1;
377 this->m_intf.startBlock(x1, topPage, 1);
378 if (topPage == bottomPage)
380 this->m_intf.send( ((0xFF >> (0x07 - height)) << (y1 & 0x07))^s_ssd1306_invertByte );
381 this->m_intf.endBlock();
384 this->m_intf.send( (0xFF << (y1 & 0x07))^s_ssd1306_invertByte );
385 for ( y = (topPage + 1); y <= (bottomPage - 1); y++)
387 this->m_intf.nextBlock();
388 this->m_intf.send( 0xFF^s_ssd1306_invertByte );
390 this->m_intf.nextBlock();
391 this->m_intf.send( (0xFF >> (0x07 - (y2 & 0x07)))^s_ssd1306_invertByte );
392 this->m_intf.endBlock();
398 uint8_t templ = this->m_color^s_ssd1306_invertByte;
403 uint8_t bank1 = (y1 >> 3);
404 uint8_t bank2 = (y2 >> 3);
405 this->m_intf.startBlock(x1, bank1, x2 - x1 + 1);
406 for (uint8_t bank = bank1; bank<=bank2; bank++)
411 mask = (mask >> ((y1 & 7) + 7 - (y2 & 7))) << (y1 & 7);
413 else if (bank1 == bank)
415 mask = (mask << (y1 & 7));
417 else if (bank2 == bank)
419 mask = (mask >> (7 - (y2 & 7)));
421 for (uint8_t x=x1; x<=x2; x++)
425 this->m_intf.send(templ & mask);
427 this->m_intf.nextBlock();
429 this->m_intf.endBlock();
453 this->m_intf.startBlock(x, y, w);
454 for(j=(h >> 3); j>0; j--)
460 for (uint8_t k = 0; k<8; k++)
462 data |= ( ((pgm_read_byte(&bitmap[k*pitch]) >> bit) & 0x01) << k );
464 this->m_intf.send( s_ssd1306_invertByte^data );
477 this->m_intf.nextBlock();
479 this->m_intf.endBlock();
486 uint8_t offset = y & 0x07;
487 uint8_t complexFlag = 0;
488 uint8_t mainFlag = 1;
493 if (y >= (
lcdint_t)this->m_h)
return;
495 if (x >= (
lcdint_t)this->m_w)
return;
498 bitmap += ((
lcduint_t)((-y) + 7) >> 3) * w;
509 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
518 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
520 uint8_t color = this->m_color ? 0xFF: 0x00;
521 this->m_intf.startBlock(x, y >> 3, w);
522 for(j=0; j < pages; j++)
524 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
525 for( i=w; i > 0; i--)
528 if ( mainFlag ) data |= ((pgm_read_byte(bitmap) << offset) & color);
529 if ( complexFlag ) data |= ((pgm_read_byte(bitmap - origin_width) >> (8 - offset)) & color);
531 this->m_intf.send(s_ssd1306_invertByte^data);
533 bitmap += origin_width - w;
534 complexFlag = offset;
535 this->m_intf.nextBlock();
537 this->m_intf.endBlock();
544 uint8_t offset = y & 0x07;
545 uint8_t complexFlag = 0;
546 uint8_t mainFlag = 1;
551 if (y >= (
lcdint_t)this->m_h)
return;
553 if (x >= (
lcdint_t)this->m_w)
return;
567 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
576 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
578 uint8_t color = this->m_color ? 0xFF: 0x00;
579 this->m_intf.startBlock(x, y >> 3, w);
580 for(j=0; j < pages; j++)
582 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
583 for( i=w; i > 0; i--)
586 if ( mainFlag ) data |= ((pgm_read_byte(buf) << offset) & color);
587 if ( complexFlag ) data |= ((pgm_read_byte(buf - origin_width) >> (8 - offset)) & color);
589 this->m_intf.send(s_ssd1306_invertByte^data);
591 buf += origin_width - w;
592 complexFlag = offset;
593 this->m_intf.nextBlock();
595 this->m_intf.endBlock();
620 uint8_t offset = y & 0x07;
621 uint8_t complexFlag = 0;
622 uint8_t mainFlag = 1;
627 if (y >= (
lcdint_t)this->m_h)
return;
629 if (x >= (
lcdint_t)this->m_w)
return;
632 buffer += ((
lcduint_t)((-y) + 7) >> 3) * w;
643 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
652 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
654 this->m_intf.startBlock(x, y >> 3, w);
655 for(j=0; j < pages; j++)
657 if ( j == (
lcduint_t)(max_pages - 1) ) mainFlag = !offset;
658 for( i=w; i > 0; i--)
661 if ( mainFlag ) data |= ((*buffer << offset) & this->m_color);
662 if ( complexFlag ) data |= ((*(buffer - origin_width) >> (8 - offset)) & this->m_color);
664 this->m_intf.send(s_ssd1306_invertByte^data);
666 buffer += origin_width - w;
667 complexFlag = offset;
668 this->m_intf.nextBlock();
670 this->m_intf.endBlock();
677 this->m_intf.startBlock(x, y >> 3, w);
678 for(j=(h >> 3); j>0; j--)
680 this->m_intf.sendBuffer( buf, w );
682 this->m_intf.nextBlock();
684 this->m_intf.endBlock();
708 color ^= s_ssd1306_invertByte;
709 this->m_intf.startBlock(0, 0, 0);
710 for(
lcduint_t m=(this->m_h >> 3); m>0; m--)
714 this->m_intf.send(color);
716 this->m_intf.nextBlock();
718 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))
uint8_t printChar(uint8_t c)
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.
size_t write(uint8_t c) __attribute__((noinline))
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))