change for GEII project NICE (invert cs)
Diff: max7219.cpp
- Revision:
- 5:f9925fc43cbc
- Parent:
- 2:9150a0dc77a3
diff -r b5e4379a3d90 -r f9925fc43cbc max7219.cpp --- a/max7219.cpp Thu May 12 20:06:28 2016 +0000 +++ b/max7219.cpp Fri Apr 01 17:27:23 2022 +0000 @@ -40,7 +40,7 @@ { _num_devices = 1; - _p_cs = new DigitalOut(cs, 1); + _p_cs = new DigitalOut(cs, 0); //change for salvat board _spi_owner = false; } @@ -51,7 +51,7 @@ _num_devices = 1; _p_spi = new SPI(mosi, miso, sclk); - _p_cs = new DigitalOut(cs, 1); + _p_cs = new DigitalOut(cs, 0);//change for salvat board _spi_owner = true; } @@ -89,13 +89,13 @@ { uint8_t idx = 0; - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_DISPLAY_TEST); _p_spi->write(1); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board } @@ -104,13 +104,13 @@ { uint8_t idx = 0; - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_DISPLAY_TEST); _p_spi->write(0); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board } @@ -132,7 +132,7 @@ else { //write DECODE_MODE register of device - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(config.device_number == idx) @@ -146,12 +146,12 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); //write INTENSITY register of device - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(config.device_number == idx) @@ -165,12 +165,12 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); //write SCAN_LIMT register of device - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(config.device_number == idx) @@ -184,7 +184,7 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); @@ -201,35 +201,35 @@ uint8_t idx = 0; //write DECODE_MODE register of all devices - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_DECODE_MODE); _p_spi->write(config.decode_mode); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); //write INTENSITY register of all devices - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_INTENSITY); _p_spi->write(config.intensity); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); //write SCAN_LIMT register of all devices - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_SCAN_LIMIT); _p_spi->write(config.scan_limit); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board wait_us(1); } @@ -252,7 +252,7 @@ } else { - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(device_number == idx) @@ -266,7 +266,7 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board rtn_val = 0; } @@ -280,13 +280,13 @@ { uint8_t idx = 0; - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_SHUTDOWN); _p_spi->write(1); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board } @@ -307,7 +307,7 @@ } else { - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(device_number == idx) @@ -321,7 +321,7 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board rtn_val = 0; } @@ -335,13 +335,13 @@ { uint8_t idx = 0; - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = 0; idx < _num_devices; idx++) { _p_spi->write(MAX7219_SHUTDOWN); _p_spi->write(0); } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board } @@ -372,7 +372,7 @@ } else { - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(idx == device_number) @@ -386,7 +386,7 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board rtn_val = 0; } @@ -422,7 +422,7 @@ } else { - _p_cs->write(0); + _p_cs->write(1); //change for salvat board for(idx = _num_devices; idx > 0; idx--) { if(idx == device_number) @@ -436,7 +436,7 @@ _p_spi->write(0); } } - _p_cs->write(1); + _p_cs->write(0); //change for salvat board rtn_val = 0; }