Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
UART3Interrupt.cpp
00001 #include "mbed.h" 00002 #include <stdint.h> 00003 #include "UART3Interrupt.h" 00004 #include "configs.h" 00005 00006 char RXBuffer[DATA_SIZE]; // UART3 RX Buffer 00007 //volatile uint8_t IntBuff[900]; // Interrupt Buffer 00008 //static volatile uint8_t *RXHeadPtr; // Buffer Head Pointer 00009 //static volatile uint8_t *RXTailPtr; // Buffer Tail Pointer 00010 //static volatile uint16_t move = 0; 00011 //uint8_t status = 0; 00012 volatile uint16_t RX_c = 0; 00013 00014 void SerialRecvInterrupt (void) { // UART3 Serial Interrupt Handler 00015 00016 while ( LPC_UART3->LSR & (0<<1) ) {} 00017 *(RXBuffer+RX_c) = LPC_UART3->RBR; // Receive data from UART3 RX 00018 00019 if (RXBuffer[RX_c] != RXBuffer[RX_c-1]) { 00020 // led3 =!led3; 00021 } 00022 00023 RX_c++; 00024 00025 if ( RX_c == 300 ) 00026 { 00027 status = 1; 00028 } 00029 00030 } 00031 00032 void RXFrameSync (void) { 00033 00034 // led1 = !led1; 00035 // led4 = !led4; 00036 00037 RX_c = 0; 00038 status = 0; 00039 } 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 /* 00055 void initRX (void) { 00056 00057 RXHeadPtr = IntBuff; // Initial state 00058 RXHeadPtr = RXTailPtr; 00059 00060 } 00061 00062 void SerialRecvInterrupt (void) // UART3 Serial Interrupt Handler 00063 { 00064 static uint8_t data = 0; 00065 while ( LPC_UART3->LSR &= (0<<1) ) {} 00066 // *(RXBuffer+idx) = LPC_UART3->RBR; Receive data from UART3 RX 00067 00068 data = LPC_UART3->RBR; // Receive data from UART3 RX 00069 00070 RXHeadPtr = &data; 00071 00072 RXHeadPtr++; 00073 move++; 00074 00075 if ( RXHeadPtr == (IntBuff+899) ) 00076 { 00077 RXHeadPtr = IntBuff; 00078 } 00079 00080 } 00081 00082 void RcvRX( void ) { 00083 00084 static uint16_t p = 0; 00085 static uint8_t data = 0; 00086 00087 if ( move ) { 00088 00089 data = *RXTailPtr; 00090 00091 RXBuffer[p] = data; 00092 RXTailPtr++; 00093 move--; 00094 p++; 00095 } 00096 00097 if ( RXTailPtr == (IntBuff+899) ) { 00098 RXTailPtr = IntBuff; 00099 } 00100 00101 if ( p == 300 ) { 00102 processRX = 1; 00103 p = 0; 00104 } 00105 00106 } 00107 */
Generated on Fri Jul 22 2022 09:19:18 by
1.7.2