summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/lcd-h100-remote.c32
-rw-r--r--firmware/drivers/lcd-h100.c32
-rw-r--r--firmware/drivers/lcd-recorder.c32
3 files changed, 72 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index bdc5799726..8112aecdb1 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -500,41 +500,57 @@ lcd_pixelfunc_type* lcd_remote_pixelfuncs[8] = {
500}; 500};
501 501
502static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 502static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
503 __attribute__ ((section(".icode")));
504static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
503{ 505{
504 *address ^= (bits & mask); 506 *address ^= (bits & mask);
505} 507}
506 508
507static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 509static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
510 __attribute__ ((section(".icode")));
511static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
508{ 512{
509 *address &= (bits | ~mask); 513 *address &= (bits | ~mask);
510} 514}
511 515
512static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 516static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
517 __attribute__ ((section(".icode")));
518static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
513{ 519{
514 *address |= (bits & mask); 520 *address |= (bits & mask);
515} 521}
516 522
517static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 523static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
524 __attribute__ ((section(".icode")));
525static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
518{ 526{
519 *address = (*address & ~mask) | (bits & mask); 527 *address = (*address & ~mask) | (bits & mask);
520} 528}
521 529
522static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 530static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
531 __attribute__ ((section(".icode")));
532static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
523{ 533{
524 *address ^= (~bits & mask); 534 *address ^= (~bits & mask);
525} 535}
526 536
527static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 537static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
538 __attribute__ ((section(".icode")));
539static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
528{ 540{
529 *address &= ~(bits & mask); 541 *address &= ~(bits & mask);
530} 542}
531 543
532static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 544static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
545 __attribute__ ((section(".icode")));
546static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
533{ 547{
534 *address |= (~bits & mask); 548 *address |= (~bits & mask);
535} 549}
536 550
537static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 551static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
552 __attribute__ ((section(".icode")));
553static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
538{ 554{
539 *address = (*address & ~mask) | (~bits & mask); 555 *address = (*address & ~mask) | (~bits & mask);
540} 556}
@@ -707,8 +723,8 @@ void lcd_remote_vline(int x, int y1, int y2)
707 dst += LCD_REMOTE_WIDTH; 723 dst += LCD_REMOTE_WIDTH;
708 mask = 0xFFu; 724 mask = 0xFFu;
709 } 725 }
710 mask_bottom &= mask; 726 mask &= mask_bottom;
711 bfunc(dst, mask_bottom, 0xFFu); 727 bfunc(dst, mask, 0xFFu);
712} 728}
713 729
714/* Draw a rectangular box */ 730/* Draw a rectangular box */
@@ -782,14 +798,14 @@ void lcd_remote_fillrect(int x, int y, int width, int height)
782 dst += LCD_REMOTE_WIDTH; 798 dst += LCD_REMOTE_WIDTH;
783 mask = 0xFFu; 799 mask = 0xFFu;
784 } 800 }
785 mask_bottom &= mask; 801 mask &= mask_bottom;
786 802
787 if (fillopt && (mask_bottom == 0xFFu)) 803 if (fillopt && (mask == 0xFFu))
788 memset(dst, bits, width); 804 memset(dst, bits, width);
789 else 805 else
790 { 806 {
791 for (i = width; i > 0; i--) 807 for (i = width; i > 0; i--)
792 bfunc(dst++, mask_bottom, 0xFFu); 808 bfunc(dst++, mask, 0xFFu);
793 } 809 }
794} 810}
795 811
@@ -871,14 +887,14 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
871 dst += LCD_REMOTE_WIDTH; 887 dst += LCD_REMOTE_WIDTH;
872 mask = 0xFFu; 888 mask = 0xFFu;
873 } 889 }
874 mask_bottom &= mask; 890 mask &= mask_bottom;
875 891
876 if (copyopt && (mask_bottom == 0xFFu)) 892 if (copyopt && (mask == 0xFFu))
877 memcpy(dst, src, width); 893 memcpy(dst, src, width);
878 else 894 else
879 { 895 {
880 for (i = width; i > 0; i--) 896 for (i = width; i > 0; i--)
881 bfunc(dst++, mask_bottom, *src++); 897 bfunc(dst++, mask, *src++);
882 } 898 }
883 } 899 }
884 else 900 else
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index 929a4fa301..3d858e2271 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -339,41 +339,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = {
339}; 339};
340 340
341static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 341static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
342 __attribute__ ((section(".icode")));
343static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
342{ 344{
343 *address ^= (bits & mask); 345 *address ^= (bits & mask);
344} 346}
345 347
346static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 348static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
349 __attribute__ ((section(".icode")));
350static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
347{ 351{
348 *address &= (bits | ~mask); 352 *address &= (bits | ~mask);
349} 353}
350 354
351static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 355static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
356 __attribute__ ((section(".icode")));
357static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
352{ 358{
353 *address |= (bits & mask); 359 *address |= (bits & mask);
354} 360}
355 361
356static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 362static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
363 __attribute__ ((section(".icode")));
364static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
357{ 365{
358 *address = (*address & ~mask) | (bits & mask); 366 *address = (*address & ~mask) | (bits & mask);
359} 367}
360 368
361static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 369static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
370 __attribute__ ((section(".icode")));
371static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
362{ 372{
363 *address ^= (~bits & mask); 373 *address ^= (~bits & mask);
364} 374}
365 375
366static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 376static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
377 __attribute__ ((section(".icode")));
378static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
367{ 379{
368 *address &= ~(bits & mask); 380 *address &= ~(bits & mask);
369} 381}
370 382
371static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 383static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
384 __attribute__ ((section(".icode")));
385static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
372{ 386{
373 *address |= (~bits & mask); 387 *address |= (~bits & mask);
374} 388}
375 389
376static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 390static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
391 __attribute__ ((section(".icode")));
392static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
377{ 393{
378 *address = (*address & ~mask) | (~bits & mask); 394 *address = (*address & ~mask) | (~bits & mask);
379} 395}
@@ -544,8 +560,8 @@ void lcd_vline(int x, int y1, int y2)
544 dst += LCD_WIDTH; 560 dst += LCD_WIDTH;
545 mask = 0xFFu; 561 mask = 0xFFu;
546 } 562 }
547 mask_bottom &= mask; 563 mask &= mask_bottom;
548 bfunc(dst, mask_bottom, 0xFFu); 564 bfunc(dst, mask, 0xFFu);
549} 565}
550 566
551/* Draw a rectangular box */ 567/* Draw a rectangular box */
@@ -619,14 +635,14 @@ void lcd_fillrect(int x, int y, int width, int height)
619 dst += LCD_WIDTH; 635 dst += LCD_WIDTH;
620 mask = 0xFFu; 636 mask = 0xFFu;
621 } 637 }
622 mask_bottom &= mask; 638 mask &= mask_bottom;
623 639
624 if (fillopt && (mask_bottom == 0xFFu)) 640 if (fillopt && (mask == 0xFFu))
625 memset(dst, bits, width); 641 memset(dst, bits, width);
626 else 642 else
627 { 643 {
628 for (i = width; i > 0; i--) 644 for (i = width; i > 0; i--)
629 bfunc(dst++, mask_bottom, 0xFFu); 645 bfunc(dst++, mask, 0xFFu);
630 } 646 }
631} 647}
632 648
@@ -708,14 +724,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
708 dst += LCD_WIDTH; 724 dst += LCD_WIDTH;
709 mask = 0xFFu; 725 mask = 0xFFu;
710 } 726 }
711 mask_bottom &= mask; 727 mask &= mask_bottom;
712 728
713 if (copyopt && (mask_bottom == 0xFFu)) 729 if (copyopt && (mask == 0xFFu))
714 memcpy(dst, src, width); 730 memcpy(dst, src, width);
715 else 731 else
716 { 732 {
717 for (i = width; i > 0; i--) 733 for (i = width; i > 0; i--)
718 bfunc(dst++, mask_bottom, *src++); 734 bfunc(dst++, mask, *src++);
719 } 735 }
720 } 736 }
721 else 737 else
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index 6747f7fcd3..f933e6ca5c 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -396,41 +396,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = {
396}; 396};
397 397
398static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 398static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
399 __attribute__ ((section(".icode")));
400static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
399{ 401{
400 *address ^= (bits & mask); 402 *address ^= (bits & mask);
401} 403}
402 404
403static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 405static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
406 __attribute__ ((section(".icode")));
407static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
404{ 408{
405 *address &= (bits | ~mask); 409 *address &= (bits | ~mask);
406} 410}
407 411
408static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 412static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
413 __attribute__ ((section(".icode")));
414static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
409{ 415{
410 *address |= (bits & mask); 416 *address |= (bits & mask);
411} 417}
412 418
413static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 419static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
420 __attribute__ ((section(".icode")));
421static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
414{ 422{
415 *address = (*address & ~mask) | (bits & mask); 423 *address = (*address & ~mask) | (bits & mask);
416} 424}
417 425
418static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 426static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
427 __attribute__ ((section(".icode")));
428static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
419{ 429{
420 *address ^= (~bits & mask); 430 *address ^= (~bits & mask);
421} 431}
422 432
423static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 433static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
434 __attribute__ ((section(".icode")));
435static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
424{ 436{
425 *address &= ~(bits & mask); 437 *address &= ~(bits & mask);
426} 438}
427 439
428static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 440static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
441 __attribute__ ((section(".icode")));
442static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
429{ 443{
430 *address |= (~bits & mask); 444 *address |= (~bits & mask);
431} 445}
432 446
433static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 447static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
448 __attribute__ ((section(".icode")));
449static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
434{ 450{
435 *address = (*address & ~mask) | (~bits & mask); 451 *address = (*address & ~mask) | (~bits & mask);
436} 452}
@@ -601,8 +617,8 @@ void lcd_vline(int x, int y1, int y2)
601 dst += LCD_WIDTH; 617 dst += LCD_WIDTH;
602 mask = 0xFFu; 618 mask = 0xFFu;
603 } 619 }
604 mask_bottom &= mask; 620 mask &= mask_bottom;
605 bfunc(dst, mask_bottom, 0xFFu); 621 bfunc(dst, mask, 0xFFu);
606} 622}
607 623
608/* Draw a rectangular box */ 624/* Draw a rectangular box */
@@ -676,14 +692,14 @@ void lcd_fillrect(int x, int y, int width, int height)
676 dst += LCD_WIDTH; 692 dst += LCD_WIDTH;
677 mask = 0xFFu; 693 mask = 0xFFu;
678 } 694 }
679 mask_bottom &= mask; 695 mask &= mask_bottom;
680 696
681 if (fillopt && (mask_bottom == 0xFFu)) 697 if (fillopt && (mask == 0xFFu))
682 memset(dst, bits, width); 698 memset(dst, bits, width);
683 else 699 else
684 { 700 {
685 for (i = width; i > 0; i--) 701 for (i = width; i > 0; i--)
686 bfunc(dst++, mask_bottom, 0xFFu); 702 bfunc(dst++, mask, 0xFFu);
687 } 703 }
688} 704}
689 705
@@ -765,14 +781,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
765 dst += LCD_WIDTH; 781 dst += LCD_WIDTH;
766 mask = 0xFFu; 782 mask = 0xFFu;
767 } 783 }
768 mask_bottom &= mask; 784 mask &= mask_bottom;
769 785
770 if (copyopt && (mask_bottom == 0xFFu)) 786 if (copyopt && (mask == 0xFFu))
771 memcpy(dst, src, width); 787 memcpy(dst, src, width);
772 else 788 else
773 { 789 {
774 for (i = width; i > 0; i--) 790 for (i = width; i > 0; i--)
775 bfunc(dst++, mask_bottom, *src++); 791 bfunc(dst++, mask, *src++);
776 } 792 }
777 } 793 }
778 else 794 else