@@ -463,19 +463,20 @@ ili9341_read_memory_continue(int len, uint16_t* out)
463
463
ili9341_read_memory_raw (0x3E , len , out );
464
464
}
465
465
466
+ #if !defined(ST7796S )
466
467
void
467
468
ili9341_drawchar_5x7 (uint8_t ch , int x , int y , uint16_t fg , uint16_t bg )
468
469
{
469
470
#if defined(ILI9488 )
470
471
ili9341_drawchar_size (ch , x , y , fg , bg , 1 );
471
472
#else
472
473
uint16_t * buf = spi_buffer ;
473
- uint8_t bits ;
474
+ uint16_t bits ;
474
475
int c , r ;
475
476
for (c = 0 ; c < 7 ; c ++ ) {
476
477
bits = x5x7_bits [(ch * 7 ) + c ];
477
478
for (r = 0 ; r < 5 ; r ++ ) {
478
- * buf ++ = (0x80 & bits ) ? fg : bg ;
479
+ * buf ++ = (0x8000 & bits ) ? fg : bg ;
479
480
bits <<= 1 ;
480
481
}
481
482
}
@@ -506,12 +507,12 @@ void
506
507
ili9341_drawchar_size (uint8_t ch , int x , int y , uint16_t fg , uint16_t bg , uint8_t size )
507
508
{
508
509
uint16_t * buf = spi_buffer ;
509
- uint8_t bits ;
510
+ uint16_t bits ;
510
511
int c , r ;
511
512
for (c = 0 ; c < 7 * size ; c ++ ) {
512
513
bits = x5x7_bits [(ch * 7 ) + (c / size )];
513
514
for (r = 0 ; r < 5 * size ; r ++ ) {
514
- * buf ++ = (0x80 & bits ) ? fg : bg ;
515
+ * buf ++ = (0x8000 & bits ) ? fg : bg ;
515
516
if (r % size == (size - 1 )) {
516
517
bits <<= 1 ;
517
518
}
@@ -530,6 +531,73 @@ ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg,
530
531
}
531
532
}
532
533
534
+ #else
535
+ void
536
+ ili9341_drawchar_7x13 (uint8_t ch , int x , int y , uint16_t fg , uint16_t bg )
537
+ {
538
+ uint16_t * buf = spi_buffer ;
539
+ uint16_t bits ;
540
+ int c , r ;
541
+ for (c = 0 ; c < 13 ; c ++ ) {
542
+ bits = x7x13b_bits [(ch * 13 ) + c ];
543
+ for (r = 0 ; r < 7 ; r ++ ) {
544
+ * buf ++ = (0x8000 & bits ) ? fg : bg ;
545
+ bits <<= 1 ;
546
+ }
547
+ }
548
+ ili9341_bulk (x , y , 7 , 13 );
549
+ }
550
+
551
+ void
552
+ ili9341_drawstring_7x13 (const char * str , int x , int y , uint16_t fg , uint16_t bg )
553
+ {
554
+ while (* str ) {
555
+ ili9341_drawchar_7x13 (* str , x , y , fg , bg );
556
+ x += 7 ;
557
+ str ++ ;
558
+ }
559
+ }
560
+
561
+ void
562
+ ili9341_drawstring_7x13_inv (const char * str , int x , int y , uint16_t fg , uint16_t bg , bool invert )
563
+ {
564
+ if (invert )
565
+ ili9341_drawstring_7x13 (str , x , y , bg , fg );
566
+ else
567
+ ili9341_drawstring_7x13 (str , x , y , fg , bg );
568
+ }
569
+
570
+
571
+ void
572
+ ili9341_drawchar_size (uint8_t ch , int x , int y , uint16_t fg , uint16_t bg , uint8_t size )
573
+ {
574
+ uint16_t * buf = spi_buffer ;
575
+ uint16_t bits ;
576
+ int c , r ;
577
+ for (c = 0 ; c < 13 * size ; c ++ ) {
578
+ bits = x7x13b_bits [(ch * 13 ) + (c / size )];
579
+ for (r = 0 ; r < 7 * size ; r ++ ) {
580
+ * buf ++ = (0x8000 & bits ) ? fg : bg ;
581
+ if (r % size == (size - 1 )) {
582
+ bits <<= 1 ;
583
+ }
584
+ }
585
+ }
586
+ ili9341_bulk (x , y , 7 * size , 13 * size );
587
+ }
588
+
589
+ void
590
+ ili9341_drawstring_size (const char * str , int x , int y , uint16_t fg , uint16_t bg , uint8_t size )
591
+ {
592
+ while (* str ) {
593
+ ili9341_drawchar_size (* str , x , y , fg , bg , size );
594
+ x += 7 * size ;
595
+ str ++ ;
596
+ }
597
+ }
598
+ #endif
599
+
600
+
533
601
#define SWAP (x ,y ) do { int z=x; x = y; y = z; } while(0)
534
602
535
603
void
0 commit comments