void SendDataBuf(USART_TypeDef* USARTx,u8 *Data,u8 len) { u8 parity = 0,length = len + 4,count = 0; USARTx_Send(USARTx,0XAA); USARTx_Send(USARTx,length); parity ^= length; for(count = 0;count < len; count++) { USARTx_Send(USARTx,*(Data+count)); parity ^= *(Data+count); } USARTx_Send(USARTx,parity); USARTx_Send(USARTx,0X55); }
void vNFCTxTask(void* pvParameters ) { TQ tq; vDebugString("NFC TX task started"); /* while(1) { USARTx_Send(DMA1_Stream3,"A",1*sizeof(uint8_t)); vTaskDelay(10); } */ for(;;) { if(xQueueReceive( xQueueNFCTx, &tq, (portTickType)portMAX_DELAY) == pdPASS){ USARTx_Send(DMA1_Stream3,tq.data,tq.length*sizeof(uint8_t)); if(xSemaphoreTake(xSemaphoreTx,(portTickType)100) != pdTRUE){ vDebugString("NFC TX task timeout"); } } else { vTaskDelay(50); } } }