![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Versao com problema no socket rx
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Diff: UART3Interrupt.cpp
- Revision:
- 0:4d17cd9c8f9d
diff -r 000000000000 -r 4d17cd9c8f9d UART3Interrupt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UART3Interrupt.cpp Tue Sep 09 20:01:24 2014 +0000 @@ -0,0 +1,107 @@ +#include "mbed.h" +#include <stdint.h> +#include "UART3Interrupt.h" +#include "configs.h" + +char RXBuffer[DATA_SIZE]; // UART3 RX Buffer +//volatile uint8_t IntBuff[900]; // Interrupt Buffer +//static volatile uint8_t *RXHeadPtr; // Buffer Head Pointer +//static volatile uint8_t *RXTailPtr; // Buffer Tail Pointer +//static volatile uint16_t move = 0; +//uint8_t status = 0; +volatile uint16_t RX_c = 0; + +void SerialRecvInterrupt (void) { // UART3 Serial Interrupt Handler + + while ( LPC_UART3->LSR & (0<<1) ) {} + *(RXBuffer+RX_c) = LPC_UART3->RBR; // Receive data from UART3 RX + + if (RXBuffer[RX_c] != RXBuffer[RX_c-1]) { + // led3 =!led3; + } + + RX_c++; + + if ( RX_c == 300 ) + { + status = 1; + } + +} + +void RXFrameSync (void) { + +// led1 = !led1; +// led4 = !led4; + + RX_c = 0; + status = 0; +} + + + + + + + + + + + + + + +/* +void initRX (void) { + +RXHeadPtr = IntBuff; // Initial state +RXHeadPtr = RXTailPtr; + +} + +void SerialRecvInterrupt (void) // UART3 Serial Interrupt Handler +{ + static uint8_t data = 0; + while ( LPC_UART3->LSR &= (0<<1) ) {} + // *(RXBuffer+idx) = LPC_UART3->RBR; Receive data from UART3 RX + + data = LPC_UART3->RBR; // Receive data from UART3 RX + + RXHeadPtr = &data; + + RXHeadPtr++; + move++; + + if ( RXHeadPtr == (IntBuff+899) ) + { + RXHeadPtr = IntBuff; + } + +} + +void RcvRX( void ) { + + static uint16_t p = 0; + static uint8_t data = 0; + + if ( move ) { + + data = *RXTailPtr; + + RXBuffer[p] = data; + RXTailPtr++; + move--; + p++; + } + + if ( RXTailPtr == (IntBuff+899) ) { + RXTailPtr = IntBuff; + } + + if ( p == 300 ) { + processRX = 1; + p = 0; + } + +} +*/ \ No newline at end of file