vasko ozo
/
TxRxService
20190816
main.cpp@20:b60d2a5cd128, 2019-08-07 (annotated)
- Committer:
- VASKO
- Date:
- Wed Aug 07 21:03:37 2019 +0000
- Revision:
- 20:b60d2a5cd128
- Parent:
- 19:09c21f5f0625
- Child:
- 22:1010cb11fb14
Duplex L432KC<->F072RB is working, but Rx header detection not realized yet ))))
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 | 20:b60d2a5cd128 | 12 | _msg.pars.ui32=0x41424344; |
VASKO | 20:b60d2a5cd128 | 13 | StartTx(&_msg.cmd); |
VASKO | 19:09c21f5f0625 | 14 | if(StartTx(&_msg.cmd)==StartOK) dpc.printf("Packet sending OK\n\r"); |
VASKO | 20:b60d2a5cd128 | 15 | else dpc.printf("Last StartTx signalled TxBusy\n\r"); |
VASKO | 19:09c21f5f0625 | 16 | }//tickIntrFunc |
VASKO | 19:09c21f5f0625 | 17 | |
VASKO | 0:5152e3f9df72 | 18 | int main() { |
VASKO | 11:6519744c77f9 | 19 | TxRxServiceInit(); |
VASKO | 20:b60d2a5cd128 | 20 | tickTx.attach(&tickIntrFunc, 0.5); |
VASKO | 12:6f63e376c0aa | 21 | |
VASKO | 2:56a194afd255 | 22 | //Exige Monumentum |
VASKO | 9:dcddb19ad551 | 23 | //Я дебил,потому что хотел выполнить действия,которые |
VASKO | 2:56a194afd255 | 24 | //требуются постоянно,один раз и именно здесь. |
VASKO | 0:5152e3f9df72 | 25 | |
VASKO | 12:6f63e376c0aa | 26 | //Для дебилов: в mbed типы "int" и "unsigned int" имеют размер 4 байта !!! |
VASKO | 12:6f63e376c0aa | 27 | |
VASKO | 16:459ad1bd82fd | 28 | //https://os.mbed.com/forum/bugs-suggestions/topic/4264/ проблема выравнивания данных |
VASKO | 16:459ad1bd82fd | 29 | |
VASKO | 0:5152e3f9df72 | 30 | while(1) { |
VASKO | 15:30e45bd5902e | 31 | if ( RxBuffFull == 1 ) { |
VASKO | 15:30e45bd5902e | 32 | RxBuffFull = 0; |
VASKO | 20:b60d2a5cd128 | 33 | if(GetCheckSum(&RxBuff.cmd) == RxBuff.cs) myled = !myled; |
VASKO | 10:f7a320faef76 | 34 | } |
VASKO | 8:cad966c09853 | 35 | }//while(1) |
VASKO | 9:dcddb19ad551 | 36 | }//main |
VASKO | 9:dcddb19ad551 | 37 |