@@ -98,10 +98,11 @@ typedef struct __attribute__((__packed__)) block_pix_crc_header_t
9898
9999// Line oversampling
100100#define LINEOVERSAMPLING_NONE 1
101- #define LINEOVERSAMPLING_WHITESTAR 2
102- #define LINEOVERSAMPLING_SAM 4
101+ #define LINEOVERSAMPLING_2X 2
102+ #define LINEOVERSAMPLING_4X 4
103103
104104// Merging multiple planes
105+ #define MERGEPLANES_NONE 0
105106#define MERGEPLANES_ADD 0
106107#define MERGEPLANES_ADDSHIFT 1
107108
@@ -125,7 +126,7 @@ uint16_t lcd_wordsperframe;
125126uint16_t lcd_bytesperframe ;
126127uint16_t lcd_lineoversampling ;
127128uint16_t lcd_wordsperline ;
128- uint8_t lcd_mergeplanes = MERGEPLANES_ADD ;
129+ uint8_t lcd_mergeplanes ;
129130
130131// raw data read from DMD
131132uint8_t planebuf1 [MAX_WIDTH * MAX_HEIGHT * MAX_BITSPERPIXEL * MAX_PLANESPERFRAME / 8 ];
@@ -486,7 +487,7 @@ void dmd_dma_handler() {
486487 }
487488
488489 // deal with whitestar line oversampling directly within framebuf
489- if (lcd_lineoversampling == LINEOVERSAMPLING_WHITESTAR ) {
490+ if (lcd_lineoversampling == LINEOVERSAMPLING_2X ) {
490491 uint16_t i = 0 ;
491492 uint32_t * dst , * src1 , * src2 ;
492493 dst = src1 = framebuf ;
@@ -495,15 +496,14 @@ void dmd_dma_handler() {
495496
496497 for (int l = 0 ; l < lcd_height ; l ++ ) {
497498 for (int w = 0 ; w < lcd_wordsperline ; w ++ ) {
498- v = src1 [w ]* 1 + src2 [w ]* 2 ;
499+ v = src1 [w ]* 2 + src2 [w ];
499500 dst [w ]= v ;
500501 }
501502 src1 += lcd_wordsperline * 2 ; // source skips 2 lines forward
502503 src2 += lcd_wordsperline * 2 ;
503504 dst += lcd_wordsperline ; // destination skips only one line
504505 }
505-
506- } else if (lcd_lineoversampling == LINEOVERSAMPLING_SAM ) {
506+ } else if (lcd_lineoversampling == LINEOVERSAMPLING_4X ) {
507507 uint16_t i = 0 ;
508508 uint32_t * dst , * src1 , * src2 , * src3 , * src4 ;
509509 dst = src1 = framebuf ;
@@ -578,6 +578,7 @@ bool init()
578578 lcd_pixelsperbyte = 8 / lcd_bitsperpixel ;
579579 lcd_planesperframe = 3 ;
580580 lcd_lineoversampling = LINEOVERSAMPLING_NONE ;
581+ lcd_mergeplanes = MERGEPLANES_ADD ;
581582 } else if (dmd_type == DMD_WHITESTAR ) {
582583 dmd_pio = pio0 ;
583584 offset = pio_add_program (dmd_pio , & dmd_reader_whitestar_program );
@@ -597,9 +598,9 @@ bool init()
597598 lcd_height = 32 ;
598599 lcd_bitsperpixel = 2 ; // Whitestar is 2bpp
599600 lcd_pixelsperbyte = 8 / lcd_bitsperpixel ;
600- lcd_planesperframe = 1 ; // in Whitestar, there's a MSB and a LSB plane
601- lcd_lineoversampling = LINEOVERSAMPLING_WHITESTAR ; // in Whitestar each line is sent twice
602- lcd_mergeplanes = MERGEPLANES_ADD ; // required for correct 2bpp merge
601+ lcd_planesperframe = 1 ; // in Whitestar, there's only one plane, containg one LSB row followed by one MSB row and so on
602+ lcd_lineoversampling = LINEOVERSAMPLING_2X ; // in Whitestar each line is sent twice
603+ lcd_mergeplanes = MERGEPLANES_NONE ;
603604 } else if (dmd_type == DMD_SPIKE1 ) {
604605 dmd_pio = pio0 ;
605606 offset = pio_add_program (dmd_pio , & dmd_reader_spike_program );
@@ -620,7 +621,7 @@ bool init()
620621 lcd_bitsperpixel = 4 ;
621622 lcd_pixelsperbyte = 8 / lcd_bitsperpixel ;
622623 lcd_planesperframe = 4 ; // in Spike there are 4 planes
623- lcd_lineoversampling = LINEOVERSAMPLING_NONE ; // no line oversampling
624+ lcd_lineoversampling = LINEOVERSAMPLING_NONE ; // no line oversampling
624625 lcd_mergeplanes = MERGEPLANES_ADDSHIFT ;
625626
626627 } else if (dmd_type == DMD_SAM ) {
@@ -642,8 +643,8 @@ bool init()
642643 lcd_height = 32 ;
643644 lcd_bitsperpixel = 4 ;
644645 lcd_pixelsperbyte = 8 / lcd_bitsperpixel ;
645- lcd_planesperframe = 1 ; // in SAM there is one planes
646- lcd_lineoversampling = LINEOVERSAMPLING_SAM ; // with 4x line oversampling
646+ lcd_planesperframe = 1 ; // in SAM there is one plane
647+ lcd_lineoversampling = LINEOVERSAMPLING_4X ; // with 4x line oversampling
647648 lcd_mergeplanes = MERGEPLANES_ADD ;
648649 } else if (dmd_type == DMD_DESEGA ) {
649650 dmd_pio = pio0 ;
@@ -665,7 +666,7 @@ bool init()
665666 lcd_bitsperpixel = 2 ; // Data East/ Sega is 2bpp
666667 lcd_pixelsperbyte = 8 / lcd_bitsperpixel ;
667668 lcd_planesperframe = 2 ; // in DE/Sega, there's a MSB and a LSB plane
668- lcd_lineoversampling = LINEOVERSAMPLING_WHITESTAR ; // in DE/Sega each line is sent twice
669+ lcd_lineoversampling = LINEOVERSAMPLING_2X ; // in DE/Sega each line is sent twice
669670 lcd_mergeplanes = MERGEPLANES_ADDSHIFT ; // required for correct 2bpp merge
670671 } else {
671672 printf ("Unknown DMD type, aborting\n" );
@@ -676,9 +677,9 @@ bool init()
676677 lcd_bytes = lcd_width * lcd_height * lcd_bitsperpixel / 8 ;
677678 lcd_pixelsperframe = lcd_width * lcd_height ;
678679 lcd_wordsperplane = lcd_bytes / 4 ;
679- if (lcd_lineoversampling == LINEOVERSAMPLING_WHITESTAR ) {
680+ if (lcd_lineoversampling == LINEOVERSAMPLING_2X ) {
680681 lcd_wordsperplane *= 2 ;
681- } else if (lcd_lineoversampling == LINEOVERSAMPLING_SAM ) {
682+ } else if (lcd_lineoversampling == LINEOVERSAMPLING_4X ) {
682683 lcd_wordsperplane *= 4 ;
683684 }
684685 lcd_bytesperplane = lcd_bytes ;
0 commit comments