This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
bl_mcu_sdk/examples/bflog/freertos_async/thread_producer.c
jzlv 356f258e83 [sync] sync from internal repo
* use nuttx libc, disable system libc
* use tlsf as default
* update lhal flash driver
* add example readme
* add flash ini for new flash tool
* add fw header for new flash tool
2023-01-17 21:04:07 +08:00

45 lines
940 B
C

#include <FreeRTOS.h>
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "timers.h"
#include "event_groups.h"
#include "example_log.h"
#include "static_inline.h"
BFLOG_DEFINE_TAG(TX, "tx", false);
#undef BFLOG_TAG
#define BFLOG_TAG BFLOG_GET_TAG(TX)
TaskHandle_t producer_handle;
extern QueueHandle_t queue;
void producer_task(void *pvParameters)
{
uint8_t time = 100;
LOG_I("Producer task enter \r\n");
vTaskDelay(1000);
LOG_I("Producer task start \r\n");
uint32_t count = 0;
while (1) {
time = rand() % 255;
count++;
LOG_I("Producer send >> %d\r\n", count);
LOG_D("Producer send >> %d\r\n", count);
LOG_T("Producer send >> %d\r\n", count);
test_log_static_inline();
if (pdTRUE != xQueueSend(queue, (void *)&count, 1000)) {
LOG_E("queue send faild\r\n");
}
vTaskDelay(time);
}
vTaskDelete(NULL);
}