Busreader: wait for message
This commit is contained in:
@@ -1,41 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// #include "FreeRTOS.h"
|
||||
// #include "task.h"
|
||||
// #include <stdio.h>
|
||||
// #include "hardware/timer.h"
|
||||
// #include <string.h>
|
||||
|
||||
// /* Define a variable to hold the initial timer count. */
|
||||
// static uint32_t start_time;
|
||||
|
||||
// /* Configure Timer 1 to generate the runtime statistics counter. */
|
||||
// extern "C" void configureTimerForRunTimeStats(void)
|
||||
// {
|
||||
// /* Store the initial count of the microsecond timer. */
|
||||
// start_time = time_us_32();
|
||||
// }
|
||||
|
||||
// /* Get the current value of the runtime counter. */
|
||||
// extern "C" unsigned long getRunTimeCounterValue(void)
|
||||
// {
|
||||
// /* Return the elapsed time in microseconds since start_time. */
|
||||
// return time_us_32() - start_time;
|
||||
// }
|
||||
|
||||
// extern "C" unsigned long ulMainGetRunTimeCounterValue() {
|
||||
// return rp2040.getCycleCount64();
|
||||
// }
|
||||
|
||||
// void configureTimerForRunTimeStats();
|
||||
// uint32_t getRunTimeCounterValue();
|
||||
|
||||
class Debug
|
||||
{
|
||||
public:
|
||||
// static void configureTimerForRunTimeStats();
|
||||
// static uint32_t getRunTimeCounterValue();
|
||||
|
||||
static void showRunTimeStats();
|
||||
static void showTaskList();
|
||||
static void showHeapStats();
|
||||
|
||||
@@ -23,18 +23,8 @@ void BusReader::busReaderTask(__unused void *pvParameters)
|
||||
|
||||
while (1)
|
||||
{
|
||||
uint32_t ulNotifiedValue;
|
||||
if (xTaskNotifyWait(pdFALSE, ULONG_MAX, &ulNotifiedValue, 0) == pdPASS)
|
||||
{
|
||||
if ((ulNotifiedValue & CARD_READY_BIT_0) != 0)
|
||||
{
|
||||
printf("Card Ready notify\n");
|
||||
Global::credentialRequest.cardReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> *data;
|
||||
if (xQueueReceive(RS485::message_queue, &data, 0))
|
||||
if (xQueueReceive(RS485::message_queue, &data, portMAX_DELAY))
|
||||
{
|
||||
// printf("RX: ");
|
||||
// for (size_t i = 0; i < data->size(); i++)
|
||||
@@ -47,6 +37,35 @@ void BusReader::busReaderTask(__unused void *pvParameters)
|
||||
|
||||
delete data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// uint32_t ulNotifiedValue;
|
||||
// if (xTaskNotifyWait(pdFALSE, ULONG_MAX, &ulNotifiedValue, 0) == pdPASS)
|
||||
// {
|
||||
// if ((ulNotifiedValue & CARD_READY_BIT_0) != 0)
|
||||
// {
|
||||
// printf("Card Ready notify\n");
|
||||
// Global::credentialRequest.cardReady = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// std::vector<uint8_t> *data;
|
||||
// if (xQueueReceive(RS485::message_queue, &data, 0))
|
||||
// {
|
||||
// // printf("RX: ");
|
||||
// // for (size_t i = 0; i < data->size(); i++)
|
||||
// // {
|
||||
// // printf("0x%02X-", data->data()[i]);
|
||||
// // }
|
||||
// // printf("\r\n");
|
||||
|
||||
// parseMessage(&Global::credentialRequest, data);
|
||||
|
||||
// delete data;
|
||||
// }
|
||||
taskYIELD();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ void CardReader::cardReaderTask(__unused void *pvParameters)
|
||||
if (checkCard(&Global::credentialRequest) == true)
|
||||
{
|
||||
printf("----- Card read oke -----\n");
|
||||
xTaskNotify(BusReader::busReaderTaskHandle, CARD_READY_BIT_0, eSetValueWithOverwrite);
|
||||
//xTaskNotify(BusReader::busReaderTaskHandle, CARD_READY_BIT_0, eSetValueWithOverwrite);
|
||||
Global::credentialRequest.cardReady = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ void Debug::showRunTimeStats()
|
||||
configRUN_TIME_COUNTER_TYPE ulTotalRunTime, ulStatsAsPercentage;
|
||||
|
||||
volatile UBaseType_t arraySize = uxTaskGetNumberOfTasks();
|
||||
TaskStatus_t *tasks = (TaskStatus_t *)pvPortMalloc(arraySize * sizeof(TaskStatus_t));
|
||||
TaskStatus_t *tasks = (TaskStatus_t *)pvPortMalloc(arraySize * sizeof(TaskStatus_t));
|
||||
arraySize = uxTaskGetSystemState(tasks, arraySize, &ulTotalRunTime);
|
||||
|
||||
printf("Task Name\t\tRun Time\tCPU %%\n");
|
||||
|
||||
Reference in New Issue
Block a user