gyo
Diff: SBDBT.cpp
- Revision:
- 0:afe58893bfe7
- Child:
- 1:8810976be033
diff -r 000000000000 -r afe58893bfe7 SBDBT.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SBDBT.cpp Sat May 06 02:12:51 2017 +0000 @@ -0,0 +1,37 @@ +#include "SBDBT.h" + +namespace raven +{ + + + + SBDBT::SBDBT(PinName p1, PinName p2) + { + i = 0; + flag = 0; + char data[8]={}; + char olddata[8]={}; + sr = new Serial(p1,p2); + sr -> baud(2400); + sr -> attach(this,&SBDBT::getd,Serial::RxIrq); + } + + void SBDBT::getd() + { + olddata[i] = data[i]; + data[i] = sr -> getc(); + i++; + if(i>=8) + { + i=0; + flag = 1; + } + } + + SBDBT::~SBDBT() + { + delete sr; + } + + +}//namespace \ No newline at end of file