|
@@ -425,26 +425,38 @@ void Max7219_init() {
|
425
|
425
|
// Apply changes to update a marker
|
426
|
426
|
inline void Max7219_Mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) {
|
427
|
427
|
#if MAX7219_X_LEDS == 8
|
428
|
|
- Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8));
|
429
|
|
- Max7219_LED_On(v2 & 0x7, y + (v2 >= 8));
|
|
428
|
+ #if MAX7219_Y_LEDS == 8
|
|
429
|
+ Max7219_LED_Off(v1 & 0x7, y + (v1 >= 8));
|
|
430
|
+ Max7219_LED_On(v2 & 0x7, y + (v2 >= 8));
|
|
431
|
+ #else
|
|
432
|
+ Max7219_LED_Off(y, v1 & 0xF); // The Max7219 Y-Axis has at least 16 LED's. So use a single column
|
|
433
|
+ Max7219_LED_On(y, v2 & 0xF);
|
|
434
|
+ #endif
|
430
|
435
|
#else // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's
|
431
|
|
- Max7219_LED_Off(v1 & 0xF, y);
|
432
|
|
- Max7219_LED_On(v2 & 0xF, y);
|
|
436
|
+ Max7219_LED_Off(v1 & 0xf, y);
|
|
437
|
+ Max7219_LED_On(v2 & 0xf, y);
|
433
|
438
|
#endif
|
434
|
439
|
}
|
435
|
440
|
|
436
|
441
|
// Apply changes to update a tail-to-head range
|
437
|
442
|
inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh) {
|
438
|
443
|
#if MAX7219_X_LEDS == 8
|
439
|
|
- if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
|
440
|
|
- Max7219_LED_Off(n & 0x7, y + (n >= 8));
|
441
|
|
- if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
|
442
|
|
- Max7219_LED_On(n & 0x7, y + (n >= 8));
|
|
444
|
+ #if MAX7219_Y_LEDS == 8
|
|
445
|
+ if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
|
|
446
|
+ Max7219_LED_Off(n & 0x7, y + (n >= 8));
|
|
447
|
+ if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
|
|
448
|
+ Max7219_LED_On(n & 0x7, y + (n >= 8));
|
|
449
|
+ #else // The Max7219 Y-Axis has at least 16 LED's. So use a single column
|
|
450
|
+ if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
|
|
451
|
+ Max7219_LED_Off(y, n & 0xF);
|
|
452
|
+ if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
|
|
453
|
+ Max7219_LED_On(y, n & 0xF);
|
|
454
|
+ #endif
|
443
|
455
|
#else // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's
|
444
|
456
|
if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF)
|
445
|
|
- Max7219_LED_Off(n & 0xF, y);
|
|
457
|
+ Max7219_LED_Off(n & 0xf, y);
|
446
|
458
|
if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF)
|
447
|
|
- Max7219_LED_On(n & 0xF, y);
|
|
459
|
+ Max7219_LED_On(n & 0xf, y);
|
448
|
460
|
#endif
|
449
|
461
|
}
|
450
|
462
|
|
|
@@ -452,7 +464,11 @@ inline void Max7219_Range16(const uint8_t y, const uint8_t ot, const uint8_t nt,
|
452
|
464
|
inline void Max7219_Quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) {
|
453
|
465
|
for (uint8_t i = MIN(nv, ov); i < MAX(nv, ov); i++)
|
454
|
466
|
#if MAX7219_X_LEDS == 8
|
455
|
|
- Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's
|
|
467
|
+ #if MAX7219_Y_LEDS == 8
|
|
468
|
+ Max7219_LED_Set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's
|
|
469
|
+ #else
|
|
470
|
+ Max7219_LED_Set(y, i, nv >= ov); // The Max7219 Y-Axis has at least 16 LED's. So use a single column
|
|
471
|
+ #endif
|
456
|
472
|
#else
|
457
|
473
|
Max7219_LED_Set(i, y, nv >= ov); // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's
|
458
|
474
|
#endif
|