@@ -312,7 +312,60 @@ void draw_qrcode(void)
312312}
313313
314314extern const uint8_t background [];
315- void draw_background (const uint8_t table )
315+ void draw_background (const uint8_t table [])
316+ #if 1
317+ {
318+ uint32_t ofsbit = table [0xd ] << 24 | table [0xc ] << 16 | table [0xb ] << 8 | table [0xa ];
319+ size_t siz = (table [5 ] << 24 | table [4 ] << 16 | table [3 ] << 8 | table [2 ]) - ofsbit ;
320+ uint8_t const * start = & table [ofsbit ];
321+ int i ;
322+ trans_color .bits .mosi = 32 ;
323+ union _double_color_t {
324+ uint32_t data ;
325+ struct {
326+ uint32_t r0 :5 ;
327+ uint32_t g0 :6 ;
328+ uint32_t b0 :5 ;
329+ uint32_t r1 :5 ;
330+ uint32_t g1 :6 ;
331+ uint32_t b1 :5 ;
332+ };
333+ };
334+ int x , y ;
335+ union _double_color_t * p ; // = (union _double_color_t *)&sendbuf;
336+ for (i = 0 ;i < siz ;i += 90 ) {
337+ if ( i %720 == 0 ) { // 240*3
338+ lcd_set_position (0 ,239 - i /720 ,239 ,239 - i /720 );
339+ // lcd_set_position(200-i/20,40,200,200);
340+ lcd_set_dc (1 );
341+ }
342+ // Waiting for an incomplete transfer
343+ while (SPI1 .cmd .usr );
344+ SPI1 .user .usr_command = 0 ;
345+ SPI1 .user .usr_addr = 0 ;
346+ SPI1 .user .usr_mosi = 1 ;
347+ SPI1 .user1 .usr_mosi_bitlen = 479 ; // 15*32; // 31;
348+ for (x = 0 ;x < 15 ;x ++ ) {
349+ p = (union _double_color_t * )& SPI1 .data_buf [x ];
350+ p -> r0 = start [i + 6 * x + 0 ] >> 3 ;
351+ p -> g0 = start [i + 6 * x + 1 ] >> 2 ;
352+ p -> b0 = start [i + 6 * x + 2 ] >> 3 ;
353+ p -> r1 = start [i + 6 * x + 3 ] >> 3 ;
354+ p -> g1 = start [i + 6 * x + 4 ] >> 2 ;
355+ p -> b1 = start [i + 6 * x + 5 ] >> 3 ;
356+ }
357+ SPI1 .user .usr_miso = 0 ;
358+ SPI1 .cmd .usr = 1 ;
359+ while (SPI1 .cmd .usr );
360+
361+ for (x = 0 ; x < trans_color .bits .miso ; x += 32 ) {
362+ y = x / 32 ;
363+ trans_color .miso [y ] = SPI1 .data_buf [y ];
364+ }
365+ // lcd_write_32bit_none();
366+ }
367+ }
368+ #else
316369{
317370 uint32_t ofsbit = table [0xd ] << 24 | table [0xc ] << 16 | table [0xb ] << 8 | table [0xa ];
318371 size_t siz = (table [5 ] << 24 | table [4 ] << 16 | table [3 ] << 8 | table [2 ]) - ofsbit ;
@@ -346,6 +399,7 @@ void draw_background(const uint8_t table)
346399 lcd_write_32bit_none ();
347400 }
348401}
402+ #endif
349403
350404void lcd_clear32 (uint32_t color )
351405{
0 commit comments