![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Novo
Fork of LukaIElmir by
Diff: DotMatrix.cpp
- Revision:
- 6:dd675b967b60
- Parent:
- 5:654e3398c1ef
--- a/DotMatrix.cpp Mon May 26 18:28:21 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -#include "DotMatrix.h" -#include "MatrixSPI.h" - -void DotMatrix::refresh(){ - for(int i = 0; i < 8; i++) - { - spi.sendCol(i, buffer[i]); - buffer[i] = 0; - } -} - -void DotMatrix::setIntensity(float jacina){ - if(jacina <= 0){ - spi.turnOFF(); - turnedON = false; - - - } else if(jacina >= 0.98){ - if(!turnedON){ - spi.turnON(); - turnedON = true; - } - - spi.sendSingle(MatrixSPI::intensity, 0x0f); - } else { - if(!turnedON){ - spi.turnON(); - turnedON = true; - } - - int temp = jacina*0x0f; - spi.sendSingle(MatrixSPI::intensity, temp); - } -} - -void DotMatrix::attach() -{ - ticker.detach(); - if(mod == scroll) - { - ticker.attach(this, &DotMatrix::prikaziScroll, brzina_ms/8); - } else if(mod == char_by_char){ - ticker.attach(this, &DotMatrix::prikaziCBC, brzina_ms); - } -} - -void DotMatrix::setSpeed_ms(int ms) -{ - ticker.detach(); - - attach(); - -} - -void DotMatrix::turnON(){ - if(!turnedON){ - spi.turnON(); - turnedON = true; - - attach(); - } -} - -void DotMatrix::turnOFF(){ - if(turnedON){ - spi.turnOFF(); - turnedON = false; - - ticker.detach(); - } -} \ No newline at end of file