@@ -308,6 +308,7 @@ void common_hal_aurora_epaper_framebuffer_power_finish(aurora_epaper_framebuffer
308
308
common_hal_aurora_epaper_framebuffer_draw_line (self , (uint8_t * )self -> bufinfo .buf , i , AURORA_EPAPER_NONE_PIXEL , AURORA_EPAPER_NONE_PIXEL , border );
309
309
}
310
310
311
+ // Send special no-scan line
311
312
border = 0xAA ;
312
313
common_hal_aurora_epaper_framebuffer_draw_line (self , (uint8_t * )self -> bufinfo .buf , -4 , AURORA_EPAPER_NONE_PIXEL , AURORA_EPAPER_NONE_PIXEL , border );
313
314
@@ -346,6 +347,7 @@ void common_hal_aurora_epaper_framebuffer_swapbuffers(aurora_epaper_framebuffer_
346
347
return ;
347
348
}
348
349
350
+ // Spec states baud rate can be 20kHz, but my testing showed this is optimistic
349
351
common_hal_busio_spi_configure (self -> bus , 15000000 , 0 , 0 , 8 );
350
352
351
353
if (!common_hal_aurora_epaper_framebuffer_power_on (self )) {
@@ -361,6 +363,7 @@ void common_hal_aurora_epaper_framebuffer_swapbuffers(aurora_epaper_framebuffer_
361
363
border = 0xFF ;
362
364
}
363
365
366
+ // Find out how many frames need to be sent to match frametime
364
367
do {
365
368
// Stage 1: Compensate
366
369
common_hal_aurora_epaper_framebuffer_draw_frame (self , (uint8_t * )self -> pframe .buf , AURORA_EPAPER_BLACK_PIXEL , AURORA_EPAPER_WHITE_PIXEL , border , 1 );
@@ -411,14 +414,15 @@ void common_hal_aurora_epaper_framebuffer_draw_line(aurora_epaper_framebuffer_ob
411
414
412
415
if (self -> type == SMALL_1_44 || self -> type == MEDIUM_2 || self -> type == LARGE_2_7 ) {
413
416
417
+ // 3 bit to 4 bit lookup table
414
418
#define DO_MAP (mapping , input ) \
415
419
(((mapping) >> (((input) & 5) << 2)) & 0xF)
416
420
417
421
uint32_t evenMap =
418
422
(whiteMap << 2 | whiteMap ) << 0 |
419
- (whiteMap << 2 | blackMap ) << 4 |
420
- (blackMap << 2 | whiteMap ) << 16 |
421
- (blackMap << 2 | blackMap ) << 20 ;
423
+ (whiteMap << 2 | blackMap ) << 4 |
424
+ (blackMap << 2 | whiteMap ) << 16 |
425
+ (blackMap << 2 | blackMap ) << 20 ;
422
426
423
427
int stride = common_hal_aurora_epaper_framebuffer_get_row_stride (self );
424
428
@@ -444,9 +448,9 @@ void common_hal_aurora_epaper_framebuffer_draw_line(aurora_epaper_framebuffer_ob
444
448
445
449
uint32_t oddMap =
446
450
(whiteMap << 2 | whiteMap ) << 0 |
447
- (whiteMap << 2 | blackMap ) << 16 |
448
- (blackMap << 2 | whiteMap ) << 4 |
449
- (blackMap << 2 | blackMap ) << 20 ;
451
+ (whiteMap << 2 | blackMap ) << 16 |
452
+ (blackMap << 2 | whiteMap ) << 4 |
453
+ (blackMap << 2 | blackMap ) << 20 ;
450
454
451
455
// Odd bytes
452
456
for (int x = 0 ; x < stride ; x ++ ) {
@@ -467,14 +471,15 @@ void common_hal_aurora_epaper_framebuffer_draw_line(aurora_epaper_framebuffer_ob
467
471
// This code is untested
468
472
else if (self -> type == SMALL_1_9 || self -> type == LARGE_2_6 ) {
469
473
474
+ // 2 bit to 4 bit lookup table
470
475
#define DO_MAP (mapping , input ) \
471
476
(((mapping) >> (((input) & 0x3) << 2)) & 0xF)
472
477
473
478
uint32_t pixelMap =
474
479
(whiteMap << 2 | whiteMap ) << 0 |
475
- (whiteMap << 2 | blackMap ) << 4 |
476
- (blackMap << 2 | whiteMap ) << 8 |
477
- (blackMap << 2 | blackMap ) << 12 ;
480
+ (whiteMap << 2 | blackMap ) << 4 |
481
+ (blackMap << 2 | whiteMap ) << 8 |
482
+ (blackMap << 2 | blackMap ) << 12 ;
478
483
479
484
int stride = common_hal_aurora_epaper_framebuffer_get_row_stride (self );
480
485
0 commit comments