Add MAX7219 reverse units option (#11860)

This commit is contained in:
Roxy-3D
2018-09-19 18:54:51 -05:00
committed by Scott Lahteine
parent beab9733f8
commit d3d6be8210
58 changed files with 65 additions and 5 deletions

View File

@ -53,15 +53,19 @@ Max7219 max7219;
uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
#define LINE_REG(Q) (max7219_reg_digit0 + ((Q) & 0x7))
#if _ROT == 0 || _ROT == 270
#define _LED_BIT(Q) (7 - ((Q) & 0x7))
#define _LED_UNIT(Q) ((Q) & ~0x7)
//#define _LED_UNIT(Q) ((MAX7219_NUMBER_UNITS - 1 - ((Q) >> 3)) << 3) // some Max7219 boards have rotated the matrix
// this line can be substituted to correct orientation
#else
#define _LED_BIT(Q) ((Q) & 0x7)
#define _LED_UNIT(Q) ((MAX7219_NUMBER_UNITS - 1 - ((Q) >> 3)) << 3)
#endif
#if (_ROT == 0 || _ROT == 270) == ENABLED(MAX7219_REVERSE_ORDER)
#define _LED_UNIT(Q) ((MAX7219_NUMBER_UNITS - 1 - ((Q) >> 3)) << 3)
#else
#define _LED_UNIT(Q) ((Q) & ~0x7)
#endif
#if _ROT < 180
#define _LED_IND(P,Q) (_LED_UNIT(P) + (Q))
#else