vasko ozo
/
TxRxService
20190816
main.cpp@19:09c21f5f0625, 2019-08-07 (annotated)
- Committer:
- VASKO
- Date:
- Wed Aug 07 17:53:12 2019 +0000
- Revision:
- 19:09c21f5f0625
- Parent:
- 18:bef650cab156
- Child:
- 20:b60d2a5cd128
Tx by Ticker, main cycle for Rx.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
VASKO | 7:7aaa14391264 | 1 | #include "PrjDefs.h" |
VASKO | 0:5152e3f9df72 | 2 | |
VASKO | 0:5152e3f9df72 | 3 | DigitalOut myled(LED1); |
VASKO | 0:5152e3f9df72 | 4 | |
VASKO | 19:09c21f5f0625 | 5 | Serial dpc(USBTX,USBRX); |
VASKO | 19:09c21f5f0625 | 6 | |
VASKO | 19:09c21f5f0625 | 7 | Ticker tickTx; |
VASKO | 19:09c21f5f0625 | 8 | |
VASKO | 19:09c21f5f0625 | 9 | void tickIntrFunc(void){ |
VASKO | 19:09c21f5f0625 | 10 | MsgType _msg; |
VASKO | 19:09c21f5f0625 | 11 | _msg.cmd=0x41; |
VASKO | 19:09c21f5f0625 | 12 | _msg.pars.i32=0; |
VASKO | 19:09c21f5f0625 | 13 | if(StartTx(&_msg.cmd)==StartOK) dpc.printf("Packet sending OK\n\r"); |
VASKO | 19:09c21f5f0625 | 14 | else dpc.printf("Sending service not ready\n\r"); |
VASKO | 19:09c21f5f0625 | 15 | }//tickIntrFunc |
VASKO | 19:09c21f5f0625 | 16 | |
VASKO | 0:5152e3f9df72 | 17 | int main() { |
VASKO | 11:6519744c77f9 | 18 | TxRxServiceInit(); |
VASKO | 19:09c21f5f0625 | 19 | tickTx.attach(&tickIntrFunc, 1); |
VASKO | 12:6f63e376c0aa | 20 | |
VASKO | 2:56a194afd255 | 21 | //Exige Monumentum |
VASKO | 9:dcddb19ad551 | 22 | //Я дебил,потому что хотел выполнить действия,которые |
VASKO | 2:56a194afd255 | 23 | //требуются постоянно,один раз и именно здесь. |
VASKO | 0:5152e3f9df72 | 24 | |
VASKO | 12:6f63e376c0aa | 25 | //Для дебилов: в mbed типы "int" и "unsigned int" имеют размер 4 байта !!! |
VASKO | 12:6f63e376c0aa | 26 | |
VASKO | 16:459ad1bd82fd | 27 | //https://os.mbed.com/forum/bugs-suggestions/topic/4264/ проблема выравнивания данных |
VASKO | 16:459ad1bd82fd | 28 | |
VASKO | 0:5152e3f9df72 | 29 | while(1) { |
VASKO | 15:30e45bd5902e | 30 | if ( RxBuffFull == 1 ) { |
VASKO | 15:30e45bd5902e | 31 | RxBuffFull = 0; |
VASKO | 19:09c21f5f0625 | 32 | if(GetCheckSum(&RxBuff.cmd) == RxBuff.cs) myled = 0; else myled = 1; |
VASKO | 10:f7a320faef76 | 33 | } |
VASKO | 8:cad966c09853 | 34 | }//while(1) |
VASKO | 9:dcddb19ad551 | 35 | }//main |
VASKO | 9:dcddb19ad551 | 36 |