前回は途中でめげてしまい中断してしまったが気を取り直して再挑戦。とりあえずコードを最小化し機能追加して見た。
ちなみに、ATtiny85で128×64グラフィックス対応というのは私が知ってる限りたぶん世界で初めてかもしれない。普通の人はフレームバッファとなるRAMが足りないということですんなり諦めてしまうところだが考え方次第ではどうにでもなるという見本にして頂けたら幸いである。もちろん、得る物あれば失う物もあるのは当然のこと...今回は性能を犠牲にしているがそれでも平均的に30FPS以上は出ると思われるので表示性能的にはほとんど問題にはならないはず。
【グラフィック描画のサンプル動画】
【描画関数】
void beginPaint();
bool endPaint();
bool pixel(int x, int y);
void moveto(int x, int y);
void lineto(int x, int y);
void rect(int x, int y, int w, int h);
void fillRect(int x, int y, int w, int h);
void drawImage(int x, int y, int w, int h, uint8_t *image, uint8_t opt = 0);
void drawText(int x, int y, char *str);
まぁ、こんだけあればなんかに使えるだろう...たぶん。
基本的なロジックは前回と同じく画面領域を分割し少しずつ描画していく方法。今回のコードでは32分割しているのでendPaint()ループが32回ることになる。従って、注意点としてはグラフィック描画が完了するまで描画内容を変更してはいけない。
1 2 3 4 5 6 |
oled.beginPaint(); do { //グラフィック描画 } while (!oled.endPaint()); |
【アップデート】
2018-08-11
大中サイズの数字グリフをオリジナルな7セグLED風に変更&時計表示用に便利そうな関数を追加。
使い方はサンプルスケッチのClock()を参考にしてほしい。
void drawDigitAnimation(int x, int y, uint8_t num1, uint8_t num2, uint8_t anime, uint8_t size)
void drawDigit(int x, int y, uint8_t num, uint8_t size)
void drawcColon(int x, int y, uint8_t size)
2018-08-02
下記修正&機能追加を行った。この結果、コードサイズが超過してしまったためサンプルスケッチからグラフィック文字列描画をコメントアウトした。
・文字出力関数(printChar/printStr/printInt)実行後のカーソル位置が次行先頭に移動後の次文字列出力が誤動作するバグを修正。
・文字出力関数に制御文字処理(‘\b’,’\r’,’\n’)を追加。
・文字出力関数が最下位行から改行した時にスクロールする機能を追加。
・関数追加
void scroll();
void newline();
void circle(int x, int y, int radius);
【コンパイル情報】
最大6012バイトのフラッシュメモリのうち、スケッチが5944バイト(98%)を使っています。
グローバル変数は133バイトのRAMを使用しています。
【サンプルスケッチ】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
#include "USITWI.h" #include "SSD1306.h" #define OLED_ADDR 0x3C #define TWI_BUS USITWI<USITWI_400K> TWI_BUS bus; SSD1306<TWI_BUS, bus, OLED_ADDR> lcd; void StopWatch(uint32_t milliseconds) { uint8_t h = milliseconds / 60000 % 100; uint8_t m = milliseconds / 1000 % 60; uint8_t s = milliseconds / 10 % 100; lcd.beginPaint(); do { // hour lcd.drawDigit( 0, 20, h / 10, 2); lcd.drawDigit(23, 20, h % 10, 2); // colon if ((milliseconds / 500 & 1) == 0) lcd.drawcColon(46, 20, 2); // minute lcd.drawDigit(56, 20, m / 10, 2); lcd.drawDigit(79, 20, m % 10, 2); // second lcd.drawDigit(102, 28, s / 10, 1); lcd.drawDigit(117, 28, s % 10, 1); } while (!lcd.endPaint()); } void Clock(uint32_t milliseconds) { static uint8_t hour, minute, second, interval; static uint8_t anime = 8; uint8_t h = milliseconds / 3600000 % 24; uint8_t m = milliseconds / 60000 % 60; uint8_t s = milliseconds / 1000 % 60; // animation if (anime >= 8) { anime = 0; hour = h; minute = m; second = s; } else if (anime) { if ((uint8_t)(milliseconds - interval) >= 33) { interval += 33; ++anime; } } else if ((h != hour) || (m != minute) || (s != second)) { interval = milliseconds; anime = 1; } // lcd.beginPaint(); do { // hour lcd.drawDigitAnimation( 0, 20, hour / 10, h / 10, anime, 2); lcd.drawDigitAnimation(23, 20, hour % 10, h % 10, anime, 2); // colon if ((milliseconds / 500 & 1) == 0) lcd.drawcColon(46, 20, 2); // minute lcd.drawDigitAnimation(56, 20, minute / 10, m / 10, anime, 2); lcd.drawDigitAnimation(79, 20, minute % 10, m % 10, anime, 2); // second lcd.drawDigitAnimation(102, 28, second / 10, s / 10, anime, 1); lcd.drawDigitAnimation(117, 28, second % 10, s % 10, anime, 1); } while (!lcd.endPaint()); } void RotatingCube() { uint8_t n = millis() / 1000 % 10; const int Delta = 9; // Approximation to 1 degree in radians * 2^9 static int x = 0, y = 22 << 9; int x9 = x >> 9, y9 = y >> 9, x10 = x >> 10, y10 = y >> 10; lcd.beginPaint(); do { // Box Top lcd.moveto( x9 + 64, y10 + 52); lcd.lineto( y9 + 64, -x10 + 52); lcd.lineto(-x9 + 64, -y10 + 52); lcd.lineto(-y9 + 64, x10 + 52); lcd.lineto( x9 + 64, y10 + 52); lcd.lineto( x9 + 64, y10 + 28); // Box Bottom lcd.lineto( y9 + 64, -x10 + 28); lcd.lineto(-x9 + 64, -y10 + 28); lcd.lineto(-y9 + 64, x10 + 28); lcd.lineto( x9 + 64, y10 + 28); // Box Sides lcd.moveto( y9 + 64, -x10 + 52); lcd.lineto( y9 + 64, -x10 + 28); lcd.moveto(-x9 + 64, -y10 + 52); lcd.lineto(-x9 + 64, -y10 + 28); lcd.moveto(-y9 + 64, x10 + 52); lcd.lineto(-y9 + 64, x10 + 28); } while (!lcd.endPaint()); // Rotate cube x = x + (y9 * Delta); y = y - ((x >> 9) * Delta); } void setup() { bus.begin(); lcd.begin(); } void loop() { uint16_t cnt = 0; uint16_t t = millis(); while ((uint16_t)millis() - t < 1000) { // RotatingCube(); // StopWatch(millis()); Clock(millis()); ++cnt; } lcd.cursor(0, 0); lcd.printInt<uint16_t>(cnt); lcd.printStr(" FPS"); lcd.flush(); } |
【ライブラリ】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
#ifndef _SSD1306_H #define _SSD1306_H #include <Arduino.h> #include <string.h> #include <avr/pgmspace.h> #include <avr/eeprom.h> #define OPT_DATA_PTR 0 #define OPT_CODE_PTR 1 #define OPT_EROM_PTR 2 #define OPT_FONT_LARGE_DIGIT 1 #define OPT_FONT_MEDIUM_DIGIT 1 #define OPT_FONT_LOWER_CASE 1 #define FONT_START_CHAR 0x20 #define FONT_END_CHAR 0x7E #define SSD1306_MAX_WIDTH 128 #define SSD1306_MAX_HEIGHT 64 #define SSD1306_REPT 0x00 #define SSD1306_WORD 0x80 #define SSD1306_DATA 0x40 //+-------------------+--------+ //| SSD1306 | SH1106 | //+-------------------+--------+ //#define SH1106_SET_PUMP_VOLTAGE_VALUE 0x30 //| (none) | | //#define SH1106_DC_DC_OFF 0x8A //| (none) | | //#define SH1106_DC_DC_ON 0x8B //| (none) | | //#define SH1106_DC_DC_CONTROL_MODE_SET 0xAD //| (none) | | //#define SH1106_READ_MODIFY_WRITE_START 0xE0 //| (none) | | //#define SH1106_READ_MODIFY_WRITE_END 0xEE //| (none) | | //+-------------------+--------+ #define SSD1306_SET_LOWER_COLUMN_START_ADDRESS 0x00 //| | | #define SSD1306_SET_HIGHER_COLUMN_START_ADDRESS 0x10 //| | | #define SSD1306_SET_MEMORY_ADDRESSING_MODE 0x20 //| 02 | (none) | #define SSD1306_SET_COLUMN_ADDRESS 0x21 //| 00:7F | (none) | #define SSD1306_SET_PAGE_ADDRESS 0x22 //| 00:07 | (none) | #define SSD1306_RIGHT_SCROLL 0x26 //| 00:07:07:07:00:FF | (none) | #define SSD1306_LEFT_SCROLL 0x27 //| 00:07:07:07:00:FF | (none) | #define SSD1306_VERTICAL_AND_RIGHT_SCROLL 0x29 //| 00:07:07:07:00 | (none) | #define SSD1306_VERTICAL_AND_LEFT_SCROLL 0x2A //| 00:07:07:07:00 | (none) | #define SSD1306_DEACTIVATE_SCROLL 0x2E //| | (none) | #define SSD1306_ACTIVATE_SCROLL 0x2F //| | (none) | #define SSD1306_SET_DISPLAY_START_LINE 0x40 //| | | #define SSD1306_SET_CONTRAST_CONTROL 0x81 //| 7F | FF | #define SSD1306_CHARGE_PUMP_SETTING 0x8D //| 10 | (none) | #define SSD1306_SET_SEGMENT_NORMAL 0xA0 //| | | #define SSD1306_SET_SEGMENT_REMAP 0xA1 //| | | #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 //| 3F:7F | (none) | #define SSD1306_ENTIRE_DISPLAY_OFF 0xA4 //| | | #define SSD1306_ENTIRE_DISPLAY_ON 0xA5 //| | | #define SSD1306_SET_NORMAL_DISPLAY 0xA6 //| | | #define SSD1306_SET_INVERSE_DISPLAY 0xA7 //| | | #define SSD1306_SET_MULTIPLEX_RATIO 0xA8 //| | | #define SSD1306_SET_DISPLAY_OFF 0xAE //| | | #define SSD1306_SET_DISPLAY_ON 0xAF //| | | #define SSD1306_SET_PAGE_START_ADDRESS 0xB0 //| B0-B7 | B0-BF | #define SSD1306_SET_COM_OUTPUT_SCAN_NORMAL 0xC0 //| | | #define SSD1306_SET_COM_OUTPUT_SCAN_REMAP 0xC8 //| | | #define SSD1306_SET_DISPLAY_OFFSET 0xD3 //| | | #define SSD1306_SET_CLOCK_DIVIDE_OSCILLATOR 0xD5 //| 80 | 50 | #define SSD1306_SET_PRECHARGE_PERIOD 0xD9 //| | | #define SSD1306_SET_COM_PINS_HARDWARE_CONFIGURATION 0xDA //| | | #define SSD1306_SET_VCOMH_DESELECT_LEVEL 0xDB //| 20 | 35 | #define SSD1306_NOP 0xE3 //| | | #define SSD1306_GDDRAM 0xFF //| | | //+-------------------+--------+ extern PROGMEM const uint8_t SSD1306_FONT[][8]; #if OPT_FONT_LARGE_DIGIT extern PROGMEM const uint8_t FONT_LARGE_DIGIT[][19 * 3]; extern PROGMEM const uint8_t FONT_LARGE_COLON[6 * 3]; #endif #if OPT_FONT_MEDIUM_DIGIT extern PROGMEM const uint8_t FONT_MEDIUM_DIGIT[][11 * 2]; #endif template<typename IOBUS_T, IOBUS_T& IOBUS, uint8_t ADDR = 0xFF, uint8_t SIZE = 32> class SSD1306 { private: typedef struct { int left, top, right, bottom; } RECT; typedef struct { int x, y; } POINT; uint8_t _g_buf[32]; RECT _g_cur; POINT _g_org; bool _g_wrt; uint8_t _buffer[SIZE]; uint8_t _count; uint8_t _ctrlb; uint8_t _lines; uint8_t _y_off; uint8_t _y_pos; uint8_t _x_pos; protected: void ctrl(uint8_t cmd, uint8_t len) { if (cmd != SSD1306_GDDRAM) { if ((_ctrlb != SSD1306_WORD) || (_count + len + 2 >= sizeof(_buffer))) flush(); _buffer[_count++] = _ctrlb = (len ? SSD1306_REPT : SSD1306_WORD); _buffer[_count++] = cmd; } else if ((_count == 0) || (_ctrlb != SSD1306_DATA)) { if ((_ctrlb != SSD1306_WORD) || (_count + len + 1 >= sizeof(_buffer))) flush(); _buffer[_count++] = _ctrlb = SSD1306_DATA; } } void data(uint8_t val) { if (_count == 0) _buffer[_count++] = _ctrlb; _buffer[_count] = val; if (++_count >= sizeof(_buffer)) flush(); } uint8_t read_byte(const uint8_t *address, uint8_t opt) { switch (opt) { case OPT_CODE_PTR: return pgm_read_byte_near(address); case OPT_EROM_PTR: return eeprom_read_byte(address); } return *address; } uint8_t *glyph(uint8_t c) { if ((c < FONT_START_CHAR) || (c > FONT_END_CHAR)) c = 0; else { #if OPT_FONT_LOWER_CASE c -= FONT_START_CHAR; #else if ((c >= 'a') && (c <= 'z')) c -= FONT_START_CHAR + 'a' - 'A'; else if (c > 'z') c -= FONT_START_CHAR + 'z' - 'a' + 1; else c -= FONT_START_CHAR; #endif } return (uint8_t *)SSD1306_FONT[c]; } void charge_pump(bool enable) { ctrl(SSD1306_CHARGE_PUMP_SETTING, 1); data(enable ? 0x14 : 0x10); } void multiplex(uint8_t nlines) { if ((nlines >= 2) && (nlines <= (SSD1306_MAX_HEIGHT >> 3)) && (nlines != _lines)) { _lines = nlines; ctrl(SSD1306_SET_MULTIPLEX_RATIO, 1); data((nlines << 3) - 1); } } void address(uint8_t x, uint8_t y) { // // set column start address // ctrl(SSD1306_SET_LOWER_COLUMN_START_ADDRESS | ((x >> 0) & 0x0F), 0); ctrl(SSD1306_SET_HIGHER_COLUMN_START_ADDRESS | ((x >> 4) & 0x0F), 0); // // set page start address // ctrl(SSD1306_SET_PAGE_START_ADDRESS | ((y + _y_off) & 0x07), 0); } bool ptInVisible(int x, int y) { return (x >= _g_cur.left) && (x < _g_cur.right) && (y >= _g_cur.top) && (y < _g_cur.bottom); } bool hasIntersectClipRect(int x0, int y0, int x1, int y1) { return (x0 < x1 ? (x0 >= _g_cur.right ) || (x1 <= _g_cur.left) : (x0 < _g_cur.left) || (x1 >= _g_cur.right )) || (y0 < y1 ? (y0 >= _g_cur.bottom) || (y1 <= _g_cur.top ) : (y0 < _g_cur.top ) || (y1 >= _g_cur.bottom)) ? false : true; } bool intersectClipRect(RECT *rc) { if ((rc->left >= rc->right) || (rc->top >= rc->bottom)) return false; if ((rc->left >= _g_cur.right) || (rc->right <= _g_cur.left)) return false; if ((rc->top >= _g_cur.bottom) || (rc->bottom <= _g_cur.top)) return false; if (rc->left < _g_cur.left) rc->left = _g_cur.left; if (rc->top < _g_cur.top) rc->top = _g_cur.top; if (rc->right > _g_cur.right) rc->right = _g_cur.right; if (rc->bottom > _g_cur.bottom) rc->bottom = _g_cur.bottom; return true; } public: SSD1306() : _ctrlb(SSD1306_WORD) , _lines(SSD1306_MAX_HEIGHT >> 3) , _y_off(0) , _y_pos(0) , _x_pos(0) { } void begin(uint8_t nlines = 8) { // // enable charge pump // charge_pump(true); // // set multiplex // multiplex(nlines); // // display clear // clear(); // // display on // display(true); // // flush // flush(); // // delay for SH1106 // delay(150); } void flush() { if (_count) { IOBUS.write(_buffer, _count, ADDR); _count = 0; } } uint8_t status() { uint8_t rv = 0xFF; IOBUS.read(&rv, sizeof(rv), ADDR); return rv; } void clear() { for (uint8_t y = 0; y < _lines; ++y) { cursor(0, y); ctrl(SSD1306_GDDRAM, 1); for (uint8_t x = 0; x < SSD1306_MAX_WIDTH; ++x) data(0); } cursor(0, 0); } void display(bool enable) { ctrl(enable ? SSD1306_SET_DISPLAY_ON : SSD1306_SET_DISPLAY_OFF, 0); } void flip(bool enable) { ctrl(enable ? SSD1306_SET_COM_OUTPUT_SCAN_REMAP : SSD1306_SET_COM_OUTPUT_SCAN_NORMAL, 0); ctrl(enable ? SSD1306_SET_SEGMENT_REMAP : SSD1306_SET_SEGMENT_NORMAL, 0); } void white(bool enable) { ctrl(enable ? SSD1306_ENTIRE_DISPLAY_ON : SSD1306_ENTIRE_DISPLAY_OFF, 0); } void invert(bool enable) { ctrl(enable ? SSD1306_SET_INVERSE_DISPLAY : SSD1306_SET_NORMAL_DISPLAY, 0); } void contrast(uint8_t val) { ctrl(SSD1306_SET_CONTRAST_CONTROL, 1); data(val); } void cursor(uint8_t x, uint8_t y) { if ((x < (SSD1306_MAX_WIDTH >> 3)) && (y < _lines)) { _x_pos = x; _y_pos = y; address(x << 3, y); } } void scroll() { _y_off = (_y_off + 1) & 0x07; ctrl(SSD1306_SET_DISPLAY_START_LINE | (_y_off << 3), 0); address(0, _lines - 1); ctrl(SSD1306_GDDRAM, 1); for (uint8_t x = 0; x < SSD1306_MAX_WIDTH; ++x) data(0); } void newline() { _x_pos = 0; if (_y_pos + 1 < _lines) ++_y_pos; else scroll(); cursor(_x_pos, _y_pos); } void putChar(char c) { switch (c) { // // back space // case '\b': if (_x_pos) cursor(--_x_pos, _y_pos); break; // // caridge return // case '\r': if (_x_pos) cursor(_x_pos = 0, _y_pos); break; // // line feed // case '\n': newline(); break; // // character // default: if ((c >= FONT_START_CHAR) && (c <= FONT_END_CHAR)) { ctrl(SSD1306_GDDRAM, 1); const uint8_t *p = glyph(c); for (uint8_t i = 0; i < 8; ++i) data(read_byte(p++, OPT_CODE_PTR)); if (++_x_pos >= (SSD1306_MAX_WIDTH >> 3)) newline(); } break; } } void printStr(char *str) { char c; while (c = *str++) putChar(c); } template <typename T> bool printInt(T val) { char buf[12]; int8_t len = sizeof(buf); int8_t neg = (val < 0); buf[--len] = 0; if (neg) val = -val; do { if (--len < neg) return false; buf[len] = (char)(val % 10) | '0'; } while ((val /= 10) >= 1); if (neg) buf[--len] = '-'; printStr(&buf[len]); return true; } void beginPaint() { _g_cur.left = 0; _g_cur.right = sizeof(_g_buf); _g_cur.top = 0; _g_cur.bottom = 8; _g_wrt = false; memset(_g_buf, 0, sizeof(_g_buf)); } bool endPaint() { // // flush page // if (_g_wrt) { address(_g_cur.left, _g_cur.top >> 3); ctrl(SSD1306_GDDRAM, 1); uint8_t *p = _g_buf; for (int8_t i = sizeof(_g_buf); i; --i) data(*p++); _g_wrt = false; memset(_g_buf, 0, sizeof(_g_buf)); } // // select next page // if (_g_cur.right < SSD1306_MAX_WIDTH) { _g_cur.left += sizeof(_g_buf); _g_cur.right += sizeof(_g_buf); } else { if (_g_cur.bottom >= (_lines << 3)) { address(_x_pos << 3, _y_pos); return true; } _g_cur.left = 0; _g_cur.right = sizeof(_g_buf); _g_cur.top += 8; _g_cur.bottom += 8; } return false; } bool pixel(int x, int y) { if (ptInVisible(x, y)) { _g_buf[x - _g_cur.left] |= _BV(y & 7); return _g_wrt = true; } return false; } void moveto(int x, int y) { _g_org.x = x; _g_org.y = y; } void lineto(int x, int y) { int x0 = _g_org.x; int y0 = _g_org.y; int dx = abs(x - x0); int dy = abs(y - y0); int sx = (x0 < x ? 1 : -1); int sy = (y0 < y ? 1 : -1); int er = dx - dy; while (dx >= dy ? x0 != x : y0 != y) { if (!pixel(x0, y0)) { if (!hasIntersectClipRect(x0, y0, x, y)) break; } int e2 = er + er; if (e2 > -dy) { er -= dy; x0 += sx; } if (e2 < dx) { er += dx; y0 += sy; } } _g_org.x = x; _g_org.y = y; } void circle(int x, int y, int radius) { RECT rc = {x - radius + 1, y - radius + 1, x + radius, y + radius}; if (intersectClipRect(&rc)) { int x0 = radius - 1; int y0 = 0; int dx = 1; int dy = 1; radius <<= 1; int er = dx - radius + 4; // 4 = Correction value for small circle while (x0 >= y0) { pixel(x + x0, y + y0); pixel(x + y0, y + x0); pixel(x - y0, y + x0); pixel(x - x0, y + y0); pixel(x - x0, y - y0); pixel(x - y0, y - x0); pixel(x + y0, y - x0); pixel(x + x0, y - y0); if (er <= 0) { er += dy; dy += 2; ++y0; } if (er > 0) { dx += 2; er += dx - radius; --x0; } } } } void rect(int x, int y, int w, int h) { if ((w > 0) && (h > 0)) { moveto(x, y); if (w == 1) lineto(x, y + h); else if (h == 1) lineto(x + w, y); else { --w; --h; lineto(x + w, y); lineto(x + w, y + h); lineto(x, y + h); lineto(x, y); } } } void fillRect(int x, int y, int w, int h) { RECT rc = {x, y, x + w, y + h}; if (intersectClipRect(&rc)) { uint8_t fill = ~(_BV(rc.top & 7) - 1); if (rc.bottom & 7) fill &= (_BV(rc.bottom & 7) - 1); do _g_buf[rc.left - _g_cur.left] |= fill; while (++rc.left < rc.right); _g_wrt = true; } } void drawImage(int x, int y, int w, int h, uint8_t *image, uint8_t opt = OPT_DATA_PTR, uint8_t row = 0) { RECT rc = {x, y, x + w, y + h}; if (intersectClipRect(&rc)) { y -= row; uint8_t b_off = rc.left - _g_cur.left; uint8_t i_off = rc.left - x + ((rc.top - y) >> 3) * w; uint8_t r_off = y & 7; uint8_t mask = (_BV(rc.top & 7) - 1); if (rc.bottom & 7) mask |= ~(_BV(rc.bottom & 7) - 1); do { uint8_t b = read_byte(&image[i_off], opt); if (r_off) { if (y == rc.top) b <<= r_off; else { b >>= 8 - r_off; if ((rc.bottom & 7) == 0) b |= read_byte(&image[i_off + w], opt) << r_off; } } _g_buf[b_off] |= b & ~mask; ++b_off; ++i_off; } while (++rc.left < rc.right); _g_wrt = true; } } void drawDigitAnimation(int x, int y, uint8_t num1, uint8_t num2, uint8_t anime, uint8_t size) { uint8_t w, h, *f, *n; if ((num1 < 10) && (num2 < 10)) { switch (size) { default: w = 8; h = 8; f = (uint8_t *)&SSD1306_FONT[num1 + ('0' - FONT_START_CHAR)]; n = (uint8_t *)&SSD1306_FONT[num2 + ('0' - FONT_START_CHAR)]; break; #if OPT_FONT_MEDIUM_DIGIT case 1: w = 11; h = 16; f = (uint8_t *)&FONT_MEDIUM_DIGIT[num1]; n = (uint8_t *)&FONT_MEDIUM_DIGIT[num2]; anime += anime; break; #endif #if OPT_FONT_LARGE_DIGIT case 2: w = 19; h = 24; f = (uint8_t *)&FONT_LARGE_DIGIT[num1]; n = (uint8_t *)&FONT_LARGE_DIGIT[num2]; anime += anime + anime; break; #endif } if ((num1 == num2) || (anime == 0)) drawImage(x, y, w, h, f, OPT_CODE_PTR); else { h -= anime; drawImage(x, y, w, anime, n, OPT_CODE_PTR, h); drawImage(x, y + anime, w, h, f, OPT_CODE_PTR); } } } void drawDigit(int x, int y, uint8_t num, uint8_t size) { uint8_t w, h, *f; if (num < 10) { switch (size) { default: w = 8; h = 8; f = (uint8_t *)&SSD1306_FONT[num + ('0' - FONT_START_CHAR)]; break; #if OPT_FONT_MEDIUM_DIGIT case 1: w = 11; h = 16; f = (uint8_t *)&FONT_MEDIUM_DIGIT[num]; break; #endif #if OPT_FONT_LARGE_DIGIT case 2: w = 19; h = 24; f = (uint8_t *)&FONT_LARGE_DIGIT[num]; break; #endif } drawImage(x, y, w, h, f, OPT_CODE_PTR); } } void drawcColon(int x, int y, uint8_t size) { uint8_t w, h, *f; switch (size) { default: w = 8; h = 8; f = (uint8_t *)&SSD1306_FONT[':' - FONT_START_CHAR]; break; #if OPT_FONT_LARGE_DIGIT case 2: w = 6; h = 24; f = (uint8_t *)FONT_LARGE_COLON; break; #endif } drawImage(x, y, w, h, f, OPT_CODE_PTR); } void drawText(int x, int y, char *str) { RECT rc = {x, y, x + (strlen(str) << 3), y + 8}; if (intersectClipRect(&rc)) { uint8_t b_off = rc.left - _g_cur.left; uint8_t i_off = rc.left - x; uint8_t r_off = y & 7; uint8_t mask = _BV(rc.top & 7) - 1; if (rc.bottom & 7) mask |= ~(_BV(rc.bottom & 7) - 1); do { uint8_t b = str[i_off >> 3]; b = read_byte(glyph(b) + (i_off & 7), OPT_CODE_PTR); if (r_off) { if (y == rc.top) b <<= r_off; else b >>= 8 - r_off; } _g_buf[b_off] |= b & ~mask; ++b_off; ++i_off; } while (++rc.left < rc.right); _g_wrt = true; } } }; #endif // _SSD1306_H |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
#include "SSD1306.h" PROGMEM const uint8_t SSD1306_FONT[][8] = { {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* */ {0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x00}, /* ! */ {0x06,0x03,0x01,0x06,0x03,0x01,0x00,0x00}, /* ″ */ {0x20,0x62,0x3e,0x63,0x3e,0x23,0x02,0x00}, /* # */ {0x00,0x24,0x2a,0x7a,0x2f,0x2a,0x12,0x00}, /* $ */ {0x42,0x25,0x12,0x08,0x24,0x52,0x21,0x00}, /* % */ {0x20,0x56,0x49,0x55,0x22,0x58,0x40,0x00}, /* & */ {0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00}, /* ′ */ {0x00,0x00,0x00,0x00,0x1c,0x22,0x41,0x00}, /* ( */ {0x41,0x22,0x1c,0x00,0x00,0x00,0x00,0x00}, /* ) */ {0x00,0x22,0x14,0x7f,0x14,0x22,0x00,0x00}, /* * */ {0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00}, /* + */ {0x50,0x30,0x00,0x00,0x00,0x00,0x00,0x00}, /* , */ {0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00}, /* - */ {0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00}, /* . */ {0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00}, /* / */ {0x00,0x3e,0x41,0x41,0x41,0x41,0x3e,0x00}, /* 0 */ {0x00,0x00,0x42,0x7f,0x40,0x00,0x00,0x00}, /* 1 */ {0x00,0x62,0x51,0x51,0x49,0x49,0x46,0x00}, /* 2 */ {0x00,0x22,0x41,0x49,0x49,0x49,0x36,0x00}, /* 3 */ {0x00,0x30,0x28,0x24,0x22,0x7f,0x20,0x00}, /* 4 */ {0x00,0x2f,0x45,0x45,0x45,0x45,0x39,0x00}, /* 5 */ {0x00,0x3e,0x49,0x49,0x49,0x49,0x32,0x00}, /* 6 */ {0x00,0x01,0x01,0x61,0x19,0x05,0x03,0x00}, /* 7 */ {0x00,0x36,0x49,0x49,0x49,0x49,0x36,0x00}, /* 8 */ {0x00,0x26,0x49,0x49,0x49,0x49,0x3e,0x00}, /* 9 */ {0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00}, /* : */ {0x00,0x00,0x56,0x36,0x00,0x00,0x00,0x00}, /* ; */ {0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x00}, /* 〈 */ {0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x00}, /* = */ {0x41,0x22,0x14,0x08,0x00,0x00,0x00,0x00}, /* 〉 */ {0x00,0x02,0x01,0x51,0x09,0x09,0x06,0x00}, /* ? */ {0x1c,0x22,0x59,0x55,0x4d,0x12,0x0c,0x00}, /* @ */ {0x60,0x18,0x16,0x11,0x16,0x18,0x60,0x00}, /* A */ {0x00,0x7f,0x49,0x49,0x49,0x49,0x36,0x00}, /* B */ {0x00,0x1c,0x22,0x41,0x41,0x41,0x22,0x00}, /* C */ {0x00,0x7f,0x41,0x41,0x41,0x22,0x1c,0x00}, /* D */ {0x00,0x7f,0x49,0x49,0x49,0x49,0x41,0x00}, /* E */ {0x00,0x7f,0x09,0x09,0x09,0x09,0x01,0x00}, /* F */ {0x00,0x1c,0x22,0x41,0x49,0x49,0x3a,0x00}, /* G */ {0x00,0x7f,0x08,0x08,0x08,0x08,0x7f,0x00}, /* H */ {0x00,0x00,0x41,0x7f,0x41,0x00,0x00,0x00}, /* I */ {0x00,0x20,0x40,0x40,0x40,0x40,0x3f,0x00}, /* J */ {0x00,0x7f,0x10,0x08,0x14,0x22,0x41,0x00}, /* K */ {0x00,0x7f,0x40,0x40,0x40,0x40,0x40,0x00}, /* L */ {0x7f,0x02,0x0c,0x30,0x0c,0x02,0x7f,0x00}, /* M */ {0x00,0x7f,0x02,0x04,0x08,0x10,0x7f,0x00}, /* N */ {0x00,0x1c,0x22,0x41,0x41,0x22,0x1c,0x00}, /* O */ {0x00,0x7f,0x09,0x09,0x09,0x09,0x06,0x00}, /* P */ {0x00,0x1c,0x22,0x41,0x51,0x22,0x5c,0x00}, /* Q */ {0x00,0x7f,0x09,0x09,0x19,0x29,0x46,0x00}, /* R */ {0x00,0x26,0x49,0x49,0x49,0x49,0x32,0x00}, /* S */ {0x01,0x01,0x01,0x7f,0x01,0x01,0x01,0x00}, /* T */ {0x00,0x3f,0x40,0x40,0x40,0x40,0x3f,0x00}, /* U */ {0x03,0x0c,0x30,0x40,0x30,0x0c,0x03,0x00}, /* V */ {0x1f,0x60,0x18,0x06,0x18,0x60,0x1f,0x00}, /* W */ {0x41,0x22,0x14,0x08,0x14,0x22,0x41,0x00}, /* X */ {0x01,0x02,0x04,0x78,0x04,0x02,0x01,0x00}, /* Y */ {0x00,0x41,0x61,0x51,0x49,0x45,0x43,0x00}, /* Z */ {0x00,0x00,0x00,0x00,0x7f,0x41,0x41,0x00}, /* [ */ {0x00,0x2b,0x2c,0x78,0x2c,0x2b,0x00,0x00}, /* ¥ */ {0x41,0x41,0x7f,0x00,0x00,0x00,0x00,0x00}, /* ] */ {0x00,0x00,0x02,0x01,0x02,0x00,0x00,0x00}, /* ^ */ {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00}, /* _ */ {0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00}, /* ` */ #if OPT_FONT_LOWER_CASE {0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00}, /* a */ {0x00,0x7f,0x48,0x44,0x44,0x38,0x00,0x00}, /* b */ {0x00,0x38,0x44,0x44,0x44,0x28,0x00,0x00}, /* c */ {0x00,0x38,0x44,0x44,0x48,0x7f,0x00,0x00}, /* d */ {0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00}, /* e */ {0x00,0x00,0x04,0x7e,0x05,0x01,0x00,0x00}, /* f */ {0x00,0x08,0x54,0x54,0x54,0x3c,0x00,0x00}, /* g */ {0x00,0x7f,0x08,0x04,0x04,0x78,0x00,0x00}, /* h */ {0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x00}, /* i */ {0x00,0x20,0x40,0x40,0x3d,0x00,0x00,0x00}, /* j */ {0x00,0x00,0x7f,0x10,0x28,0x44,0x00,0x00}, /* k */ {0x00,0x00,0x01,0x7f,0x00,0x00,0x00,0x00}, /* l */ {0x00,0x7c,0x04,0x78,0x04,0x78,0x00,0x00}, /* m */ {0x00,0x7c,0x08,0x04,0x04,0x78,0x00,0x00}, /* n */ {0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00}, /* o */ {0x00,0x7c,0x14,0x14,0x14,0x08,0x00,0x00}, /* p */ {0x00,0x08,0x14,0x14,0x14,0x7c,0x00,0x00}, /* q */ {0x00,0x7c,0x08,0x04,0x04,0x08,0x00,0x00}, /* r */ {0x00,0x48,0x54,0x54,0x54,0x24,0x00,0x00}, /* s */ {0x00,0x04,0x3e,0x44,0x44,0x20,0x00,0x00}, /* t */ {0x00,0x3c,0x40,0x40,0x20,0x7c,0x00,0x00}, /* u */ {0x00,0x0c,0x30,0x40,0x30,0x0c,0x00,0x00}, /* v */ {0x00,0x1c,0x60,0x18,0x60,0x1c,0x00,0x00}, /* w */ {0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00}, /* x */ {0x00,0x44,0x58,0x20,0x18,0x04,0x00,0x00}, /* y */ {0x00,0x44,0x64,0x54,0x4c,0x44,0x00,0x00}, /* z */ #endif {0x00,0x00,0x00,0x08,0x36,0x41,0x41,0x00}, /* { */ {0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00}, /* │ */ {0x41,0x41,0x36,0x08,0x00,0x00,0x00,0x00}, /* } */ {0x00,0x00,0x02,0x01,0x02,0x01,0x00,0x00}, /* ~ */ }; #if OPT_FONT_LARGE_DIGIT PROGMEM const uint8_t FONT_LARGE_DIGIT[][19 * 3] = { { // 0 0xFE,0xFE,0xFD,0xFD,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0xF7,0xF7,0xE3,0xE3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE3,0xE3,0xF7,0xF7, 0x7F,0x7F,0xBF,0xBF,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, { // 1 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFE,0xFE, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE3,0xE3,0xF7,0xF7, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x7F,0x7F, }, { // 2 0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0xF0,0xF0,0xE8,0xE8,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x0B,0x0B,0x07,0x07, 0x7F,0x7F,0xBF,0xBF,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00, }, { // 3 0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0x00,0x00,0x08,0x08,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xEB,0xEB,0xF7,0xF7, 0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, { // 4 0xFE,0xFE,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFE,0xFE, 0x07,0x07,0x0B,0x0B,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xEB,0xEB,0xF7,0xF7, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x7F,0x7F, }, { // 5 0xFE,0xFE,0xFD,0xFD,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0x00,0x00, 0x07,0x07,0x0B,0x0B,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xE8,0xE8,0xF0,0xF0, 0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, { // 6 0xFE,0xFE,0xFD,0xFD,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0x01,0x01,0x00,0x00, 0xF7,0xF7,0xEB,0xEB,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xE8,0xE8,0xF0,0xF0, 0x7F,0x7F,0xBF,0xBF,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, { // 7 0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE3,0xE3,0xF7,0xF7, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x7F,0x7F, }, { // 8 0xFE,0xFE,0xFD,0xFD,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0xF7,0xF7,0xEB,0xEB,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xEB,0xEB,0xF7,0xF7, 0x7F,0x7F,0xBF,0xBF,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, { // 9 0xFE,0xFE,0xFD,0xFD,0x03,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x03,0x03,0xFD,0xFD,0xFE,0xFE, 0x07,0x07,0x0B,0x0B,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xEB,0xEB,0xF7,0xF7, 0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xBF,0xBF,0x7F,0x7F, }, }; PROGMEM const uint8_t FONT_LARGE_COLON[6 * 3] = { 0x00,0xE0,0xF0,0xF0,0xE0,0x00, 0x00,0x00,0x81,0x81,0x00,0x00, 0x00,0x07,0x0F,0x0F,0x07,0x00, }; #endif #if OPT_FONT_MEDIUM_DIGIT PROGMEM const uint8_t FONT_MEDIUM_DIGIT[][11 * 2] = { { // 0 0xFE,0x7D,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x7D,0xFE, 0x7F,0xBE,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xBE,0x7F, }, { // 1 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xFE, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x7F, }, { // 2 0x00,0x01,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x7D,0xFE, 0x7F,0xBE,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0x80,0x00, }, { // 3 0x00,0x01,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x7D,0xFE, 0x00,0x80,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xBE,0x7F, }, { // 4 0xFE,0x7C,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7C,0xFE, 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3E,0x7F, }, { // 5 0xFE,0x7D,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x01,0x00, 0x00,0x80,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xBE,0x7F, }, { // 6 0xFE,0x7D,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x01,0x00, 0x7F,0xBE,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xBE,0x7F, }, { // 7 0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x7D,0xFE, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x7F, }, { // 8 0xFE,0x7D,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x7D,0xFE, 0x7F,0xBE,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xBE,0x7F, }, { // 9 0xFE,0x7D,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x7D,0xFE, 0x00,0x80,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xC1,0xBE,0x7F, } }; #endif |