Novo

Dependencies:   mbed

Fork of LukaIElmir by tim003 tim003

Committer:
tim003
Date:
Mon May 26 15:07:13 2014 +0000
Revision:
3:43648fa57d55
Child:
4:ba24ce878e87
17:06

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tim003 3:43648fa57d55 1 #include "mbed.h"
tim003 3:43648fa57d55 2 #include "MatrixSPI.h"
tim003 3:43648fa57d55 3 #include <string>
tim003 3:43648fa57d55 4 #include <vector>
tim003 3:43648fa57d55 5
tim003 3:43648fa57d55 6 #ifndef DOTMATRIX_H
tim003 3:43648fa57d55 7 #define DOTMATRIX_H
tim003 3:43648fa57d55 8
tim003 3:43648fa57d55 9 enum ModPrikazivanja{scroll, char_by_char, live_input};
tim003 3:43648fa57d55 10
tim003 3:43648fa57d55 11 class DotMatrix{
tim003 3:43648fa57d55 12
tim003 3:43648fa57d55 13 public:
tim003 3:43648fa57d55 14 DotMatrix(PinName data_input = dp2, PinName clock = dp6, PinName loadcs = dp24)
tim003 3:43648fa57d55 15 :spi(data_input, clock, loadcs), turnedON(false), mod(scroll), char_trenutni(0),
tim003 3:43648fa57d55 16 char_offset(0), repeat(true), brzina_ms(1000)
tim003 3:43648fa57d55 17 {
tim003 3:43648fa57d55 18 for(int i = 0; i < 8; i++) buffer[i] = 0;
tim003 3:43648fa57d55 19 }
tim003 3:43648fa57d55 20
tim003 3:43648fa57d55 21 void refresh();
tim003 3:43648fa57d55 22 void setIntensity(float jacina);
tim003 3:43648fa57d55 23 void setSpeed_ms(int ms);
tim003 3:43648fa57d55 24 void turnON();
tim003 3:43648fa57d55 25 void turnOFF();
tim003 3:43648fa57d55 26 void PromijeniRecenicu(string recenica){
tim003 3:43648fa57d55 27 this->recenica = recenica;
tim003 3:43648fa57d55 28 }
tim003 3:43648fa57d55 29 void NadodajNaRecenicu(char c){
tim003 3:43648fa57d55 30 recenica += c;
tim003 3:43648fa57d55 31 }
tim003 3:43648fa57d55 32 void NadodajNaRecenicu(string str){
tim003 3:43648fa57d55 33 recenica += str;
tim003 3:43648fa57d55 34 }
tim003 3:43648fa57d55 35 void PromijeniMod(ModPrikazivanja mod){
tim003 3:43648fa57d55 36 if(this->mod != mod){
tim003 3:43648fa57d55 37 this->mod = mod;
tim003 3:43648fa57d55 38 attach();
tim003 3:43648fa57d55 39 }
tim003 3:43648fa57d55 40 }
tim003 3:43648fa57d55 41 ModPrikazivanja dajMod() const{
tim003 3:43648fa57d55 42 return mod;
tim003 3:43648fa57d55 43 }
tim003 3:43648fa57d55 44
tim003 3:43648fa57d55 45
tim003 3:43648fa57d55 46
tim003 3:43648fa57d55 47 private:
tim003 3:43648fa57d55 48 void attach();
tim003 3:43648fa57d55 49 void prikaziScroll();
tim003 3:43648fa57d55 50 void prikaziCBC();
tim003 3:43648fa57d55 51
tim003 3:43648fa57d55 52 MatrixSPI spi;
tim003 3:43648fa57d55 53 int buffer[8];
tim003 3:43648fa57d55 54 bool turnedON;
tim003 3:43648fa57d55 55 string recenica;
tim003 3:43648fa57d55 56 ModPrikazivanja mod;
tim003 3:43648fa57d55 57 int char_trenutni, char_offset;
tim003 3:43648fa57d55 58 Ticker ticker;
tim003 3:43648fa57d55 59 //bool isAttached potrebno ako se ticker ne može 2. detachirati...
tim003 3:43648fa57d55 60 bool repeat;
tim003 3:43648fa57d55 61 int brzina_ms;
tim003 3:43648fa57d55 62 };
tim003 3:43648fa57d55 63
tim003 3:43648fa57d55 64 #endif //DotMatrix_h