|
Mobil_surveillance_system 1
|
UART1 functions source file. More...
#include "UART1.h"Go to the source code of this file.
Functions | |
| void | UART1_rxHandler (void) |
| void | UART1_txHandler (void) |
| void | UART1_initUART1 (void) |
| void | UART1_primeTransmit (void) |
| void | UART1_setAppendResponseCallbackFunction (tpfUART1AppendResponseCallbackFunction pfCallbackAppendResponse) |
| int | UART1_read (void) |
| int | UART1_write (char *pcBuffer, unsigned int uiLength) |
| void | UART1_sendChar (void) |
| tBoolean | UART1_isWritingDone (void) |
| void | UART1_flushRx (void) |
| void | UART1_flushTx (void) |
Variables | |
| tBoolean | ge_tbUART1RXITFLAG = 0 |
| This flag are use to indicate if a character has just sent from the uart1 buffer. | |
| tBoolean | ge_tbUART1TXITFLAG = 0 |
| This flag are use to indicate if a chareacter has just arrived into the uart1 buffer. | |
| tpfUART1AppendResponseCallbackFunction | g_pfOnCallbackGPSAppendResponse |
| Function pointer pointed to the GPS_appendResponse function. | |
| unsigned char | g_pcUart1RxBuffer [UART1_RX_BUFFER_SIZE] = {'\0'} |
| FIFO buffer for the uart1 rx. All of the character coming form the uart1 will be taken into this buffer temporary. | |
| unsigned int | g_uiUart1RxWriteIndex = 0 |
| Write index variable of the g_pcUart1RxBuffer buffer. | |
| unsigned int | g_uiUart1RxReadIndex = 0 |
| Read index varibale of the g_pcUart1RxBuffer buffer. | |
| unsigned char | g_pcUart1TxBuffer [UART1_RX_BUFFER_SIZE] = {'\0'} |
| unsigned int | g_uiUart1TxWriteIndex = 0 |
| Write index variable for the g_pcUart1TxBuffer buffer. | |
| unsigned int | g_uiUart1TxReadIndex = 0 |
| Read index variable for the g_pcUart1TxBuffer buffer. | |
UART1 functions source file.
Definition in file UART1.c.
| void UART1_initUART1 | ( | void | ) |
proba
Definition at line 118 of file UART1.c.
{
P3OUT &= ~(BIT6+BIT7);
// P3.6,7 = USCI_A1 TXD/RXD
P3SEL = 0xC0;
// CLK = ACLK
UCA1CTL1 |= UCSSEL_1;
// 9600
UCA1BR0 = 0x03; // 32kHz/9600 = 3.41
// 9600
UCA1BR1 = 0x00;
// Modulation UCBRSx = 5
UCA1MCTL = UCBRS1 + UCBRS0; //
// **Initialize USCI state machine**
UCA1CTL1 &= ~UCSWRST;
// Enable USCI_A1 RX interrupt
UC1IE |= UCA1RXIE;
// Enable USCI_A1 TX interrupt
UC1IE |= UCA1TXIE;
// Enable global interrupt
_bis_SR_register(LPM3_bits + GIE);
// set RX ISR callback function
Interrupts_setUSCI1RX_ISRCallbackFunction(&UART1_rxHandler);
// set TX ISR callback function;
Interrupts_setUSCI1TX_ISRCallbackFunction(&UART1_txHandler);
}
| void UART1_setAppendResponseCallbackFunction | ( | tpfUART1AppendResponseCallbackFunction | pfCallbackAppendResponse | ) |
| pfCallbackAppendResponse |
Definition at line 169 of file UART1.c.
{
g_pfOnCallbackGPSAppendResponse = pfCallbackAppendResponse;
}
| int UART1_write | ( | char * | pcBuffer, |
| unsigned int | uiLength | ||
| ) |
| pcBuffer | |
| uiLength |
Definition at line 206 of file UART1.c.
{
unsigned int uiIdx;
for( uiIdx = 0; uiIdx < uiLength; uiIdx++ ){
if(!UART1_TX_BUFFER_FULL){
g_pcUart1TxBuffer[g_uiUart1TxWriteIndex] = pcBuffer[uiIdx];
UART1_ADVANCE_TX_BUFFER_INDEX(g_uiUart1TxWriteIndex);
}
else{
// TODO if the tx buffer is full
}
}
if(!UART1_TX_BUFFER_EMPTY){
// send as many characters to the uart buffer as many can
UART1_primeTransmit();
}
// return the number of the character written into the buffer
return uiIdx;
}
| unsigned char g_pcUart1TxBuffer[UART1_RX_BUFFER_SIZE] = {'\0'} |
1.7.4