![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Novo
Fork of LukaIElmir by
Diff: DotMatrix.h
- Revision:
- 3:43648fa57d55
- Child:
- 4:ba24ce878e87
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DotMatrix.h Mon May 26 15:07:13 2014 +0000 @@ -0,0 +1,64 @@ +#include "mbed.h" +#include "MatrixSPI.h" +#include <string> +#include <vector> + +#ifndef DOTMATRIX_H +#define DOTMATRIX_H + +enum ModPrikazivanja{scroll, char_by_char, live_input}; + +class DotMatrix{ + +public: + DotMatrix(PinName data_input = dp2, PinName clock = dp6, PinName loadcs = dp24) + :spi(data_input, clock, loadcs), turnedON(false), mod(scroll), char_trenutni(0), + char_offset(0), repeat(true), brzina_ms(1000) + { + for(int i = 0; i < 8; i++) buffer[i] = 0; + } + + void refresh(); + void setIntensity(float jacina); + void setSpeed_ms(int ms); + void turnON(); + void turnOFF(); + void PromijeniRecenicu(string recenica){ + this->recenica = recenica; + } + void NadodajNaRecenicu(char c){ + recenica += c; + } + void NadodajNaRecenicu(string str){ + recenica += str; + } + void PromijeniMod(ModPrikazivanja mod){ + if(this->mod != mod){ + this->mod = mod; + attach(); + } + } + ModPrikazivanja dajMod() const{ + return mod; + } + + + +private: + void attach(); + void prikaziScroll(); + void prikaziCBC(); + + MatrixSPI spi; + int buffer[8]; + bool turnedON; + string recenica; + ModPrikazivanja mod; + int char_trenutni, char_offset; + Ticker ticker; + //bool isAttached potrebno ako se ticker ne može 2. detachirati... + bool repeat; + int brzina_ms; +}; + +#endif //DotMatrix_h \ No newline at end of file