LCDGFX LCD display driver  1.1.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
ssd1306_1bit.inl
1 /*
2  MIT License
3 
4  Copyright (c) 2016-2021, Alexey Dynda
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all
14  copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  SOFTWARE.
23 */
24 
28 
29 #include "lcd_hal/io.h"
30 
32 //
33 // 1-BIT GRAPHICS
34 //
36 
37 template <class I> void NanoDisplayOps1<I>::printFixed(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style)
38 {
39  uint8_t i, j = 0;
40  uint8_t text_index = 0;
41  uint8_t page_offset = 0;
42  uint8_t x = xpos;
43  y >>= 3;
44  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
45  for ( ;; )
46  {
47  uint8_t ldata;
48  if ( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] == '\0') )
49  {
50  x = xpos;
51  y++;
52  if ( y >= (lcdint_t)(this->m_h >> 3) )
53  {
54  break;
55  }
56  page_offset++;
57  if ( page_offset == this->m_font->getPages() )
58  {
59  text_index = j;
60  page_offset = 0;
61  if ( ch[j] == '\0' )
62  {
63  break;
64  }
65  }
66  else
67  {
68  j = text_index;
69  }
70  this->m_intf.endBlock();
71  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
72  }
73  uint16_t unicode;
74  do
75  {
76  unicode = this->m_font->unicode16FromUtf8(ch[j]);
77  j++;
78  } while ( unicode == SSD1306_MORE_CHARS_REQUIRED );
79  SCharInfo char_info;
80  this->m_font->getCharBitmap(unicode, &char_info);
81  ldata = 0;
82  x += char_info.width + char_info.spacing;
83  if ( char_info.height > page_offset * 8 )
84  {
85  char_info.glyph += page_offset * char_info.width;
86  for ( i = char_info.width; i > 0; i-- )
87  {
88  uint8_t data;
89  if ( style == STYLE_NORMAL )
90  {
91  data = pgm_read_byte(&char_info.glyph[0]);
92  }
93  else if ( style == STYLE_BOLD )
94  {
95  uint8_t temp = pgm_read_byte(&char_info.glyph[0]);
96  data = temp | ldata;
97  ldata = temp;
98  }
99  else
100  {
101  uint8_t temp = pgm_read_byte(&char_info.glyph[1]);
102  data = (temp & 0xF0) | ldata;
103  ldata = (temp & 0x0F);
104  }
105  this->m_intf.send(data ^ this->m_bgColor);
106  char_info.glyph++;
107  }
108  }
109  else
110  {
111  char_info.spacing += char_info.width;
112  }
113  for ( i = 0; i < char_info.spacing; i++ )
114  this->m_intf.send(this->m_bgColor);
115  }
116  this->m_intf.endBlock();
117 }
118 
119 template <class I> uint8_t NanoDisplayOps1<I>::printChar(uint8_t c)
120 {
121  uint16_t unicode = this->m_font->unicode16FromUtf8(c);
122  if ( unicode == SSD1306_MORE_CHARS_REQUIRED )
123  return 0;
124  SCharInfo char_info;
125  this->m_font->getCharBitmap(unicode, &char_info);
126  uint8_t mode = this->m_textMode;
127  for ( uint8_t i = 0; i < (this->m_fontStyle == STYLE_BOLD ? 2 : 1); i++ )
128  {
129  this->drawBitmap1(this->m_cursorX + i, this->m_cursorY, char_info.width, char_info.height, char_info.glyph);
130  this->m_textMode |= CANVAS_MODE_TRANSPARENT;
131  }
132  this->m_textMode = mode;
133  this->m_cursorX += (lcdint_t)(char_info.width + char_info.spacing);
134  if ( ((this->m_textMode & CANVAS_TEXT_WRAP_LOCAL) &&
135  (this->m_cursorX > ((lcdint_t)this->m_w - (lcdint_t)this->m_font->getHeader().width))) ||
136  ((this->m_textMode & CANVAS_TEXT_WRAP) &&
137  (this->m_cursorX > ((lcdint_t)this->m_w - (lcdint_t)this->m_font->getHeader().width))) )
138  {
139  this->m_cursorY += (lcdint_t)this->m_font->getHeader().height;
140  this->m_cursorX = 0;
141  if ( (this->m_textMode & CANVAS_TEXT_WRAP_LOCAL) &&
142  (this->m_cursorY > ((lcdint_t)this->m_h - (lcdint_t)this->m_font->getHeader().height)) )
143  {
144  this->m_cursorY = 0;
145  }
146  }
147  return 1;
148 }
149 
150 template <class I> size_t NanoDisplayOps1<I>::write(uint8_t c)
151 {
152  if ( c == '\n' )
153  {
154  this->m_cursorY += (lcdint_t)this->m_font->getHeader().height;
155  this->m_cursorX = 0;
156  }
157  else if ( c == '\r' )
158  {
159  // skip non-printed char
160  }
161  else
162  {
163  return printChar(c);
164  }
165  return 1;
166 }
167 
168 #ifndef DOXYGEN_SHOULD_SKIP_THIS
169 template <class I>
170 void NanoDisplayOps1<I>::printFixed_oldStyle(uint8_t xpos, uint8_t y, const char *ch, EFontStyle style)
171 {
172  uint8_t i, j = 0;
173  uint8_t text_index = 0;
174  uint8_t page_offset = 0;
175  uint8_t x = xpos;
176  y >>= 3;
177  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
178  for ( ;; )
179  {
180  uint8_t c;
181  uint8_t ldata;
182  uint16_t offset;
183  if ( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] == '\0') )
184  {
185  x = xpos;
186  y++;
187  if ( y >= (this->m_h >> 3) )
188  {
189  break;
190  }
191  page_offset++;
192  if ( page_offset == this->m_font->getPages() )
193  {
194  text_index = j;
195  page_offset = 0;
196  if ( ch[j] == '\0' )
197  {
198  break;
199  }
200  }
201  else
202  {
203  j = text_index;
204  }
205  this->m_intf.endBlock();
206  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
207  }
208  c = ch[j];
209  if ( c >= this->m_font->getHeader().ascii_offset )
210  {
211  c -= this->m_font->getHeader().ascii_offset;
212  }
213  ldata = 0;
214  offset = (c * this->m_font->getPages() + page_offset) * this->m_font->getHeader().width;
215  for ( i = this->m_font->getHeader().width; i > 0; i-- )
216  {
217  uint8_t data;
218  if ( style == STYLE_NORMAL )
219  {
220  data = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
221  }
222  else if ( style == STYLE_BOLD )
223  {
224  uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
225  data = temp | ldata;
226  ldata = temp;
227  }
228  else
229  {
230  uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset + 1]);
231  data = (temp & 0xF0) | ldata;
232  ldata = (temp & 0x0F);
233  }
234  this->m_intf.send(data ^ this->m_bgColor);
235  offset++;
236  }
237  x += this->m_font->getHeader().width;
238  j++;
239  }
240  this->m_intf.endBlock();
241 }
242 #endif
243 
244 template <class I>
245 void NanoDisplayOps1<I>::printFixedN(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style, uint8_t factor)
246 {
247  uint8_t i, j = 0;
248  uint8_t text_index = 0;
249  uint8_t page_offset = 0;
250  uint8_t x = xpos;
251  y >>= 3;
252  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
253  for ( ;; )
254  {
255  uint8_t ldata;
256  if ( (x > this->m_w - (this->m_font->getHeader().width << factor)) || (ch[j] == '\0') )
257  {
258  x = xpos;
259  y++;
260  if ( y >= (this->m_h >> 3) )
261  {
262  break;
263  }
264  page_offset++;
265  if ( page_offset == (this->m_font->getPages() << factor) )
266  {
267  text_index = j;
268  page_offset = 0;
269  if ( ch[j] == '\0' )
270  {
271  break;
272  }
273  }
274  else
275  {
276  j = text_index;
277  }
278  this->m_intf.endBlock();
279  this->m_intf.startBlock(xpos, y, this->m_w - xpos);
280  }
281  uint16_t unicode;
282  do
283  {
284  unicode = this->m_font->unicode16FromUtf8(ch[j]);
285  j++;
286  } while ( unicode == SSD1306_MORE_CHARS_REQUIRED );
287  SCharInfo char_info;
288  this->m_font->getCharBitmap(unicode, &char_info);
289  ldata = 0;
290  x += ((char_info.width + char_info.spacing) << factor);
291  if ( char_info.height > (page_offset >> factor) * 8 )
292  {
293  char_info.glyph += (page_offset >> factor) * char_info.width;
294  for ( i = char_info.width; i > 0; i-- )
295  {
296  uint8_t data;
297  if ( style == STYLE_NORMAL )
298  {
299  data = pgm_read_byte(char_info.glyph);
300  }
301  else if ( style == STYLE_BOLD )
302  {
303  uint8_t temp = pgm_read_byte(char_info.glyph);
304  data = temp | ldata;
305  ldata = temp;
306  }
307  else
308  {
309  uint8_t temp = pgm_read_byte(char_info.glyph + 1);
310  data = (temp & 0xF0) | ldata;
311  ldata = (temp & 0x0F);
312  }
313  if ( factor > 0 )
314  {
315  uint8_t accum = 0;
316  uint8_t mask = ~((0xFF) << (1 << factor));
317  // N=0 -> right shift is always 0
318  // N=1 -> right shift goes through 0, 4
319  // N=2 -> right shift goes through 0, 2, 4, 6
320  // N=3 -> right shift goes through 0, 1, 2, 3, 4, 5, 6, 7
321  data >>= ((page_offset & ((1 << factor) - 1)) << (3 - factor));
322  for ( uint8_t idx = 0; idx < 1 << (3 - factor); idx++ )
323  {
324  accum |= (((data >> idx) & 0x01) ? (mask << (idx << factor)) : 0);
325  }
326  data = accum;
327  }
328  for ( uint8_t z = (1 << factor); z > 0; z-- )
329  {
330  this->m_intf.send(data ^ this->m_bgColor);
331  }
332  char_info.glyph++;
333  }
334  }
335  else
336  {
337  char_info.spacing += char_info.width;
338  }
339  for ( i = 0; i < (char_info.spacing << factor); i++ )
340  this->m_intf.send(this->m_bgColor);
341  }
342  this->m_intf.stop();
343 }
344 
345 template <class I> void NanoDisplayOps1<I>::putPixel(lcdint_t x, lcdint_t y)
346 {
347  this->m_intf.startBlock(x, y >> 3, 1);
348  this->m_intf.send((1 << (y & 0x07)) ^ this->m_bgColor);
349  this->m_intf.endBlock();
350 }
351 
352 template <class I> void NanoDisplayOps1<I>::drawHLine(lcdint_t x1, lcdint_t y1, lcdint_t x2)
353 {
354  this->m_intf.startBlock(x1, y1 >> 3, x2 - x1 + 1);
355  for ( uint8_t x = x1; x <= x2; x++ )
356  {
357  this->m_intf.send((1 << (y1 & 0x07)) ^ (~this->m_color));
358  }
359  this->m_intf.endBlock();
360 }
361 
362 template <class I> void NanoDisplayOps1<I>::drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2)
363 {
364  uint8_t topPage = y1 >> 3;
365  uint8_t bottomPage = y2 >> 3;
366  uint8_t height = y2 - y1;
367  uint8_t y;
368  this->m_intf.startBlock(x1, topPage, 1);
369  if ( topPage == bottomPage )
370  {
371  this->m_intf.send(((0xFF >> (0x07 - height)) << (y1 & 0x07)) ^ (~this->m_color));
372  this->m_intf.endBlock();
373  return;
374  }
375  this->m_intf.send((0xFF << (y1 & 0x07)) ^ (~this->m_color));
376  for ( y = (topPage + 1); y <= (bottomPage - 1); y++ )
377  {
378  this->m_intf.nextBlock();
379  this->m_intf.send(0xFF ^ (~this->m_color));
380  }
381  this->m_intf.nextBlock();
382  this->m_intf.send((0xFF >> (0x07 - (y2 & 0x07))) ^ (~this->m_color));
383  this->m_intf.endBlock();
384 }
385 
386 template <class I> void NanoDisplayOps1<I>::fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
387 {
388  uint8_t templ = this->m_color;
389  if ( x1 > x2 )
390  return;
391  if ( y1 > y2 )
392  return;
393  if ( (lcduint_t)x2 >= this->m_w )
394  x2 = (lcdint_t)this->m_w - 1;
395  if ( (lcduint_t)y2 >= this->m_h )
396  y2 = (lcdint_t)this->m_h - 1;
397  uint8_t bank1 = (y1 >> 3);
398  uint8_t bank2 = (y2 >> 3);
399  this->m_intf.startBlock(x1, bank1, x2 - x1 + 1);
400  for ( uint8_t bank = bank1; bank <= bank2; bank++ )
401  {
402  uint8_t mask = 0xFF;
403  if ( bank1 == bank2 )
404  {
405  mask = (mask >> ((y1 & 7) + 7 - (y2 & 7))) << (y1 & 7);
406  }
407  else if ( bank1 == bank )
408  {
409  mask = (mask << (y1 & 7));
410  }
411  else if ( bank2 == bank )
412  {
413  mask = (mask >> (7 - (y2 & 7)));
414  }
415  for ( uint8_t x = x1; x <= x2; x++ )
416  {
417  // m_bytes[BADDR(bank) + x] &= ~mask;
418  // m_bytes[BADDR(bank) + x] |= (templ & mask);
419  this->m_intf.send(templ & mask);
420  }
421  this->m_intf.nextBlock();
422  }
423  this->m_intf.endBlock();
424 }
425 
426 template <class I> void NanoDisplayOps1<I>::clear()
427 {
428  this->fill(0);
429  /* this->m_intf.startBlock(0, 0, 0);
430  for(uint8_t m=(this->m_h >> 3); m>0; m--)
431  {
432  for(uint8_t n=this->m_w; n>0; n--)
433  {
434  this->m_intf.send( this->m_bgColor );
435  }
436  this->m_intf.nextBlock();
437  }
438  this->m_intf.endBlock(); */
439 }
440 
441 template <class I>
442 void NanoDisplayOps1<I>::drawXBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
443 {
444  uint8_t i, j;
445  lcduint_t pitch = (w + 7) >> 3;
446  this->m_intf.startBlock(x, y, w);
447  for ( j = (h >> 3); j > 0; j-- )
448  {
449  uint8_t bit = 0;
450  for ( i = w; i > 0; i-- )
451  {
452  uint8_t data = 0;
453  for ( uint8_t k = 0; k < 8; k++ )
454  {
455  data |= (((pgm_read_byte(&bitmap[k * pitch]) >> bit) & 0x01) << k);
456  }
457  this->m_intf.send(this->m_bgColor ^ data);
458  bit++;
459  if ( bit >= 8 )
460  {
461  bitmap++;
462  bit = 0;
463  }
464  }
465  if ( bit )
466  {
467  bitmap++;
468  }
469  bitmap += pitch * 7;
470  this->m_intf.nextBlock();
471  }
472  this->m_intf.endBlock();
473 }
474 
475 template <class I>
476 void NanoDisplayOps1<I>::drawBitmap1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
477 {
478  lcduint_t origin_width = w;
479  uint8_t offset = y & 0x07;
480  uint8_t complexFlag = 0;
481  uint8_t mainFlag = 1;
482  uint8_t max_pages;
483  uint8_t pages;
484  lcduint_t i, j;
485  if ( y + (lcdint_t)h <= 0 )
486  return;
487  if ( y >= (lcdint_t)this->m_h )
488  return;
489  if ( x + (lcdint_t)w <= 0 )
490  return;
491  if ( x >= (lcdint_t)this->m_w )
492  return;
493  if ( y < 0 )
494  {
495  bitmap += ((lcduint_t)((-y) + 7) >> 3) * w;
496  h += y;
497  y = 0;
498  complexFlag = 1;
499  }
500  if ( x < 0 )
501  {
502  bitmap += -x;
503  w += x;
504  x = 0;
505  }
506  max_pages = (lcduint_t)(h + 15 - offset) >> 3;
507  if ( (lcduint_t)((lcduint_t)y + h) > (lcduint_t)this->m_h )
508  {
509  h = (lcduint_t)(this->m_h - (lcduint_t)y);
510  }
511  if ( (lcduint_t)((lcduint_t)x + w) > (lcduint_t)this->m_w )
512  {
513  w = (lcduint_t)(this->m_w - (lcduint_t)x);
514  }
515  pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
516 
517  this->m_intf.startBlock(x, y >> 3, w);
518  for ( j = 0; j < pages; j++ )
519  {
520  if ( j == (lcduint_t)(max_pages - 1) )
521  mainFlag = !offset;
522  for ( i = w; i > 0; i-- )
523  {
524  uint8_t data = 0;
525  if ( mainFlag )
526  data |= (pgm_read_byte(bitmap) << offset);
527  if ( complexFlag )
528  data |= (pgm_read_byte(bitmap - origin_width) >> (8 - offset));
529  if (!this->m_color)
530  {
531  data ^= 0x00;
532  }
533  bitmap++;
534  this->m_intf.send(this->m_bgColor ^ data);
535  }
536  bitmap += origin_width - w;
537  complexFlag = offset;
538  this->m_intf.nextBlock();
539  }
540  this->m_intf.endBlock();
541 }
542 
543 template <class I>
545 {
546  lcduint_t origin_width = w;
547  uint8_t offset = y & 0x07;
548  uint8_t complexFlag = 0;
549  uint8_t mainFlag = 1;
550  uint8_t max_pages;
551  uint8_t pages;
552  lcduint_t i, j;
553  if ( y + (lcdint_t)h <= 0 )
554  return;
555  if ( y >= (lcdint_t)this->m_h )
556  return;
557  if ( x + (lcdint_t)w <= 0 )
558  return;
559  if ( x >= (lcdint_t)this->m_w )
560  return;
561  if ( y < 0 )
562  {
563  buf += ((lcduint_t)((-y) + 7) >> 3) * w;
564  h += y;
565  y = 0;
566  complexFlag = 1;
567  }
568  if ( x < 0 )
569  {
570  buf += -x;
571  w += x;
572  x = 0;
573  }
574  max_pages = (lcduint_t)(h + 15 - offset) >> 3;
575  if ( (lcduint_t)((lcduint_t)y + h) > (lcduint_t)this->m_h )
576  {
577  h = (lcduint_t)(this->m_h - (lcduint_t)y);
578  }
579  if ( (lcduint_t)((lcduint_t)x + w) > (lcduint_t)this->m_w )
580  {
581  w = (lcduint_t)(this->m_w - (lcduint_t)x);
582  }
583  pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
584 
585  uint8_t color = this->m_color ? 0xFF : 0x00;
586  this->m_intf.startBlock(x, y >> 3, w);
587  for ( j = 0; j < pages; j++ )
588  {
589  if ( j == (lcduint_t)(max_pages - 1) )
590  mainFlag = !offset;
591  for ( i = w; i > 0; i-- )
592  {
593  uint8_t data = 0;
594  if ( mainFlag )
595  data |= ((pgm_read_byte(buf) << offset) & color);
596  if ( complexFlag )
597  data |= ((pgm_read_byte(buf - origin_width) >> (8 - offset)) & color);
598  buf++;
599  this->m_intf.send(this->m_bgColor ^ data);
600  }
601  buf += origin_width - w;
602  complexFlag = offset;
603  this->m_intf.nextBlock();
604  }
605  this->m_intf.endBlock();
606 }
607 
608 template <class I>
609 void NanoDisplayOps1<I>::drawBitmap4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
610 {
611  // NOT IMPLEMENTED
612 }
613 
614 template <class I>
615 void NanoDisplayOps1<I>::drawBitmap8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
616 {
617  // NOT IMPLEMENTED
618 }
619 
620 template <class I>
622 {
623  // NOT IMPLEMENTED
624 }
625 
626 template <class I>
627 void NanoDisplayOps1<I>::drawBuffer1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer)
628 {
629  lcduint_t origin_width = w;
630  uint8_t offset = y & 0x07;
631  uint8_t complexFlag = 0;
632  uint8_t mainFlag = 1;
633  uint8_t max_pages;
634  uint8_t pages;
635  lcduint_t i, j;
636  if ( y + (lcdint_t)h <= 0 )
637  return;
638  if ( y >= (lcdint_t)this->m_h )
639  return;
640  if ( x + (lcdint_t)w <= 0 )
641  return;
642  if ( x >= (lcdint_t)this->m_w )
643  return;
644  if ( y < 0 )
645  {
646  buffer += ((lcduint_t)((-y) + 7) >> 3) * w;
647  h += y;
648  y = 0;
649  complexFlag = 1;
650  }
651  if ( x < 0 )
652  {
653  buffer += -x;
654  w += x;
655  x = 0;
656  }
657  max_pages = (lcduint_t)(h + 15 - offset) >> 3;
658  if ( (lcduint_t)((lcduint_t)y + h) > (lcduint_t)this->m_h )
659  {
660  h = (lcduint_t)(this->m_h - (lcduint_t)y);
661  }
662  if ( (lcduint_t)((lcduint_t)x + w) > (lcduint_t)this->m_w )
663  {
664  w = (lcduint_t)(this->m_w - (lcduint_t)x);
665  }
666  pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
667 
668  this->m_intf.startBlock(x, y >> 3, w);
669  for ( j = 0; j < pages; j++ )
670  {
671  if ( j == (lcduint_t)(max_pages - 1) )
672  mainFlag = !offset;
673  for ( i = w; i > 0; i-- )
674  {
675  uint8_t data = 0;
676  if ( mainFlag )
677  data |= ((*buffer << offset) & this->m_color);
678  if ( complexFlag )
679  data |= ((*(buffer - origin_width) >> (8 - offset)) & this->m_color);
680  buffer++;
681  this->m_intf.send(this->m_bgColor ^ data);
682  }
683  buffer += origin_width - w;
684  complexFlag = offset;
685  this->m_intf.nextBlock();
686  }
687  this->m_intf.endBlock();
688 }
689 
690 template <class I>
692 {
693  uint8_t j;
694  this->m_intf.startBlock(x, y >> 3, w);
695  for ( j = (h >> 3); j > 0; j-- )
696  {
697  this->m_intf.sendBuffer(buf, w);
698  buf += w;
699  this->m_intf.nextBlock();
700  }
701  this->m_intf.endBlock();
702 }
703 
704 template <class I>
705 void NanoDisplayOps1<I>::drawBuffer4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer)
706 {
707  // NOT IMPLEMENTED
708 }
709 
710 template <class I>
711 void NanoDisplayOps1<I>::drawBuffer8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer)
712 {
713  // NOT IMPLEMENTED
714 }
715 
716 template <class I>
718 {
719  // NOT IMPLEMENTED
720 }
721 
722 template <class I> void NanoDisplayOps1<I>::fill(uint16_t color)
723 {
724  color ^= this->m_bgColor;
725  this->m_intf.startBlock(0, 0, 0);
726  for ( lcduint_t m = (this->m_h >> 3); m > 0; m-- )
727  {
728  for ( lcduint_t n = this->m_w; n > 0; n-- )
729  {
730  this->m_intf.send(color);
731  }
732  this->m_intf.nextBlock();
733  }
734  this->m_intf.endBlock();
735 }
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
Definition: canvas_types.h:144
uint8_t lcduint_t
Definition: canvas_types.h:79
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))
lcduint_t width()
Definition: display_base.h:98
int8_t lcdint_t
Definition: canvas_types.h:77
void fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
#define SSD1306_MORE_CHARS_REQUIRED
Definition: canvas_types.h:43
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
Definition: canvas_types.h:143
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.
Definition: canvas_types.h:146
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
Definition: canvas_types.h:145
void drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2)
EFontStyle
Definition: canvas_types.h:88
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))