vasko ozo
/
F031K6_TxRxService
Test1
Diff: main.cpp
- Revision:
- 5:ad4e5a078834
- Parent:
- 4:d461cadeb702
- Child:
- 6:1364a236ee22
--- a/main.cpp Sat Aug 03 12:56:38 2019 +0000 +++ b/main.cpp Sat Aug 03 13:17:12 2019 +0000 @@ -7,15 +7,14 @@ DigitalOut myled(LED1); -int nCharTx = 0; - uint8_t ArrTx[ArrTxSize] = {0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4b,0x4c,0x4d,0x4e,0x4f}; uint8_t ArrRx[ArrRxSize] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - + +uint8_t *pArrTx = &ArrTx[0]; + void IntrTx() { - nCharTx++; - if (nCharTx < ArrTxSize ){ - pc.putc(ArrTx[nCharTx]); + if ( ++pArrTx <= &ArrTx[ArrTxSize-1] ){ + pc.putc(*pArrTx); } else{ pc.attach(NULL, Serial::TxIrq); @@ -31,11 +30,11 @@ void IntrRx() { *pArrRx = pc.getc(); - if (pArrRx++ >= &ArrRx[ArrRxSize-1] ) { + if ( pArrRx++ >= &ArrRx[ArrRxSize-1] ) { pArrRx = &ArrRx[0]; CopyMemUint8(); - nCharTx = 0; - pc.putc(ArrTx[nCharTx]); + pArrTx = &ArrTx[0]; + pc.putc(*pArrTx); pc.attach(&IntrTx, Serial::TxIrq); myled=1; }