tim003 tim003
/
LukaIElmir26
Novo
Fork of LukaIElmir by
DotMatrix.cpp
- Committer:
- tim003
- Date:
- 2014-05-26
- Revision:
- 3:43648fa57d55
File content as of revision 3:43648fa57d55:
#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(); } }