#include "rfid_reader.h"
#include "printf-stdarg.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "kom_modul.h"
#include "uart2.h"
#include "webcam.h"

void vStartRfidTask(unsigned char priority) {

	xTaskCreate(vTaskRfid,"RFid",150,NULL,priority,NULL);

}

void vTaskRfid(void *pvParameters) {
char buffer[14],karta[13];
uint16 pocet;
int i;

	for (;;) {
		//	xSemaphoreTake(uart2_Mutex.getCharMutex,portMAX_DELAY);
			(void) uart2_RecvBlock(buffer,12,&pocet,portMAX_DELAY);
			sprintf(karta,"%c%x%x%x%x%x",commandCardId,buffer[3],buffer[4],buffer[5],buffer[6],buffer[7]);

			//(void)xSemaphoreTake(CamPictureMutex,1000);
			xprintf("\n\r%s ",karta);
			(void) xQueueSend(komOutSocketQueue,karta,portMAX_DELAY);
			taskYIELD();



	}


}


