/******************************************************************************* * Function Name: UART_1_UartPutString ******************************************************************************** * * Summary: * Places a NULL terminated string in the transmit buffer to be sent at the * next available bus time. * This function is blocking and waits until there is space available to put * all the requested data into the transmit buffer. * * Parameters: * string: pointer to the null terminated string array to be placed in the * transmit buffer. * * Return: * None * *******************************************************************************/ void UART_1_UartPutString(const char8 string[]) { uint32 bufIndex; bufIndex = 0u; /* Blocks the control flow until all data has been sent */ while(string[bufIndex] != ((char8) 0)) { UART_1_UartPutChar((uint32) string[bufIndex]); bufIndex++; } }
int CLI_Write(unsigned char *inBuff) { if(inBuff == NULL) return -1; #ifdef _USE_CLI_ unsigned short ret,usLength = strlen((const char *)inBuff); ret = usLength; while (usLength) { UART_1_UartPutChar(*inBuff); usLength--; inBuff++; } return (int)ret; #else return 0; #endif }
int ReadInt() { uint32 rxData; int result = 0; int digitCount; for(;;) { rxData = UART_1_UartGetChar(); if(rxData){ if(rxData == '\r') break; UART_1_UartPutChar(rxData); result *= 10; result += rxData - '0'; } } return result; }
/******************************************************************************* * Function Name: UART_1_UartPutCRLF ******************************************************************************** * * Summary: * Places a byte of data followed by a carriage return (0x0D) and * line feed (0x0A) into the transmit buffer. * This function is blocking and waits until there is space available to put * all the requested data into the transmit buffer. * * Parameters: * txDataByte : the data to be transmitted. * * Return: * None * *******************************************************************************/ void UART_1_UartPutCRLF(uint32 txDataByte) { UART_1_UartPutChar(txDataByte); /* Blocks control flow until all data has been sent */ UART_1_UartPutChar(0x0Du); /* Blocks control flow until all data has been sent */ UART_1_UartPutChar(0x0Au); /* Blocks control flow until all data has been sent */ }