PUBLIC void Rfid_Rawread(void) { // uint16 u16Char[] = {0x8001, 0x0000, 0x5358, 0x0021, 0x0000, // 0x0008, 0x0001, 0x0013, 0x0000, 0x000F, 0x00FB}; uint16 u16Char[]= {0x8001, 0x7685}; uint8 hi_temp, lo_temp; hi_temp = u16Char[1]; lo_temp = u16Char[1]>>8; DBG_vPrintf(TRACE_APP, "%x %x",lo_temp, hi_temp ); vAHI_UartWriteData(Serial_UART, 0x76); vAHI_UartWriteData(Serial_UART, 0x85); string src; // int i; // for (i=0; i < 11; i++) // { // uint8 hi_temp, lo_temp; // hi_temp = u16Char[i] ; // lo_temp = u16Char[i]>>8; // vAHI_UartWriteData(Serial_UART, lo_temp); // vAHI_UartWriteData(Serial_UART, hi_temp); // } src = "Source_0"; vSerial_TxChar(src); /* Start the tx process if it has stalled */ }
PUBLIC void vUtils_DisplayBytes(uint8 *pcOutString, uint8 u8Num) { uint8 chr; while(u8Num--) { chr=(*pcOutString >> 4)+0x30; if(chr > 0x39) { chr+=0x07; } vAHI_UartWriteData(UTILS_UART,chr); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); chr=(*pcOutString & 0x0f)+0x30; if(chr > 0x39) { chr+=0x07; } vAHI_UartWriteData(UTILS_UART,chr); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART,' '); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); pcOutString++; } vAHI_UartWriteData(UTILS_UART, '\r'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART, '\n'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); }
/**************************************************************************** * * NAME: vUtils_Debug * * DESCRIPTION: * Sends a string to UART0 using the hardware API with CR * * PARAMETERS: Name RW Usage * pcMessage R Null-terminated message to send * * RETURNS: * void * ****************************************************************************/ PUBLIC void vUtils_Debug(char *pcMessage) { vUtils_String(pcMessage); vAHI_UartWriteData(UTILS_UART, '\r'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART, '\n'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); }
PUBLIC void vUtils_Debug_uint(uint8 input) { vAHI_UartWriteData(UTILS_UART, input); vAHI_UartWriteData(UTILS_UART, '\r'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART, '\n'); while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); }
void uart0_writeb(unsigned char c) { while(!(u8AHI_UartReadLineStatus(E_AHI_UART_0)&E_AHI_UART_LS_THRE)) ; /* wait for transmit buffer to empty */ vAHI_UartWriteData(E_AHI_UART_0, c); }
/**************************************************************************** * * NAME: vUART_TxCharISR * * DESCRIPTION: * * PARAMETERS: Name RW Usage * None. * * RETURNS: * None. * * NOTES: * None. ****************************************************************************/ PUBLIC void vUART_TxCharISR(void) { if(!bSerialQ_Empty(TX_QUEUE)) { vAHI_UartWriteData(u8Uart, u8SerialQ_RemoveItem(TX_QUEUE)); } }
PUBLIC void Rfid_Getprotocol(void) { uint16 u16Char[] = {0x8001, 0x0000, 0x0000, 0x5358, 0x0012, 0x0000, 0x0008, 0x0001, 0x0079}; uint8 hi_temp, lo_temp; uint8 i; for (i=0 ; i<8; i++) { hi_temp = u16Char[i]; lo_temp = u16Char[i]>>8; vAHI_UartWriteData(Serial_UART, lo_temp); vAHI_UartWriteData(Serial_UART, hi_temp); } DBG_vPrintf(TRACE_APP, "Get protocol command sent\n" ); }
/**************************************************************************** * * NAME: vUtils_String * * DESCRIPTION: * Sends a string to UART0 using the hardware API without CR * * PARAMETERS: Name RW Usage * pcMessage R Null-terminated message to send * * RETURNS: * void * ****************************************************************************/ PUBLIC void vUtils_String(char *pcMessage) { while (*pcMessage) { while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART, *pcMessage); pcMessage++; } }
PUBLIC void vDebug(char *pcMessage) { while (*pcMessage) { while ((u8AHI_UartReadLineStatus(0) & 0x20) == 0); vAHI_UartWriteData(0, *pcMessage); pcMessage++; } }
/**************************************************************************** * * NAME: vUART_StartTx * * DESCRIPTION: * * PARAMETERS: Name RW Usage * None. * * RETURNS: * None. * * NOTES: * None. ****************************************************************************/ PUBLIC void vUART_StartTx(void) { /* Has interrupt driven transmit stalled (tx fifo is empty) */ if (u8AHI_UartReadLineStatus(u8Uart) & E_AHI_UART_LS_THRE) { if(!bSerialQ_Empty(TX_QUEUE)) { vAHI_UartWriteData(u8Uart, u8SerialQ_RemoveItem(TX_QUEUE)); } } }
int32_t uart_write(int32_t dev, char *buf, size_t n) { size_t i; for(i=0; i<n; i++, buf++) { while (!BUFREADY(UART) || (u32AHI_DioReadInput() & CTS)) ; vAHI_UartWriteData(dev, *buf); } return i; }
/**************************************************************************** * * NAME: vUtils_String * * DESCRIPTION: * Sends a string to UART0 using the hardware API without CR * * PARAMETERS: Name RW Usage * pcMessage R Null-terminated message to send * * RETURNS: * void * ****************************************************************************/ PUBLIC void vUtils_Char(uint8 u8char) { while ((u8AHI_UartReadLineStatus(UTILS_UART) & 0x20) == 0); vAHI_UartWriteData(UTILS_UART, u8char); }