This commit is contained in:
Thomas Basler 2018-08-04 11:09:44 +02:00
commit e3398b2203
45 changed files with 62 additions and 62 deletions

View File

@ -10921,7 +10921,7 @@ inline void gcode_M502() {
if (parser.seenval('R')) { if (parser.seenval('R')) {
const uint32_t r = parser.value_int(); const uint32_t r = parser.value_int();
Max7219_Set_Row(r, parser.ulongval('V')); Max7219_Set_Row(r, parser.byteval('V'));
return; return;
} }
else if (parser.seenval('C')) { else if (parser.seenval('C')) {

View File

@ -322,22 +322,22 @@ void Max7219_Set_Columns_32bits(const uint8_t x, uint32_t val) {
void Max7219_register_setup() { void Max7219_register_setup() {
// Initialize the Max7219 // Initialize the Max7219
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_scanLimit, 0x07); Max7219(max7219_reg_scanLimit, 0x07);
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits) Max7219(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits)
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_shutdown, 0x01); // not in shutdown mode Max7219(max7219_reg_shutdown, 0x01); // not in shutdown mode
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_displayTest, 0x00); // no display test Max7219(max7219_reg_displayTest, 0x00); // no display test
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set
// range: 0x00 to 0x0F // range: 0x00 to 0x0F
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data

View File

@ -110,7 +110,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] |= _BV(7 - (x & 0x07)) #define SET_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] |= _BV(7 - (x & 0x07))
#define CLEAR_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] &= (_BV(7 - (x & 0x07)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] &= (_BV(7 - (x & 0x07)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[y + (x >> 3) * 8], 7 - (x & 0x07)) #define BIT_7219(x, y) TEST(LEDs[y + (x >> 3) * 8], 7 - (x & 0x07))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 90 #elif _ROT == 90
#define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS 8 #define MAX7219_X_LEDS 8
@ -119,7 +119,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] |= _BV((y & 0x7)) #define SET_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] |= _BV((y & 0x7))
#define CLEAR_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] &= (_BV((y & 0x7)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] &= (_BV((y & 0x7)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)], (y & 0x7)) #define BIT_7219(x, y) TEST(LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)], (y & 0x7))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 180 #elif _ROT == 180
#define MAX7219_UPDATE_AXIS y // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS y // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS (8 * MAX7219_NUMBER_UNITS) #define MAX7219_X_LEDS (8 * MAX7219_NUMBER_UNITS)
@ -128,7 +128,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] |= _BV((x & 0x07)) #define SET_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] |= _BV((x & 0x07))
#define CLEAR_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] &= (_BV((x & 0x07)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] &= (_BV((x & 0x07)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8], ((x & 0x07))) #define BIT_7219(x, y) TEST(LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8], ((x & 0x07)))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 270 #elif _ROT == 270
#define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS 8 #define MAX7219_X_LEDS 8
@ -137,7 +137,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] |= _BV(7 - (y & 0x7)) #define SET_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] |= _BV(7 - (y & 0x7))
#define CLEAR_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] &= (_BV(7 - (y & 0x7)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] &= (_BV(7 - (y & 0x7)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[x + ( y >> 3) * 8], 7 - (y & 0x7)) #define BIT_7219(x, y) TEST(LEDs[x + ( y >> 3) * 8], 7 - (y & 0x7))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#else #else
#error "MAX7219_ROTATE must be a multiple of +/- 90°." #error "MAX7219_ROTATE must be a multiple of +/- 90°."
#endif #endif