Rename
This commit is contained in:
parent
e6a05046e8
commit
e11be74632
2 changed files with 11 additions and 11 deletions
|
@ -3,13 +3,13 @@
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern QueueHandle_t blink_rate_q;
|
extern QueueHandle_t blink_cmd_q;
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
TaskHandle_t task_handle_blink;
|
TaskHandle_t task_handle_blink;
|
||||||
TaskHandle_t task_handle_blink_cycle;
|
TaskHandle_t task_handle_blink_cycle;
|
||||||
|
|
||||||
blink_rate_q = xQueueCreate(10, sizeof(BlinkCmd_t));
|
blink_cmd_q = xQueueCreate(10, sizeof(BlinkCmd_t));
|
||||||
|
|
||||||
// Static here, since main exits, this becomes a dead pointer almost instantly
|
// Static here, since main exits, this becomes a dead pointer almost instantly
|
||||||
static BlinkCmd_t initial_command = {.variant = BLINK_STATE, .state = 1};
|
static BlinkCmd_t initial_command = {.variant = BLINK_STATE, .state = 1};
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
|
|
||||||
QueueHandle_t blink_rate_q;
|
QueueHandle_t blink_cmd_q;
|
||||||
|
|
||||||
void blink_cmd_print(const BlinkCmd_t *cmd) {
|
void blink_cmd_print(const BlinkCmd_t *cmd) {
|
||||||
printf("BlinkCmd { ");
|
printf("BlinkCmd { ");
|
||||||
|
@ -52,7 +52,7 @@ void task_blink(void *pvParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pdPASS == xQueueReceive(blink_rate_q, &command, 0))
|
if (pdPASS == xQueueReceive(blink_cmd_q, &command, 0))
|
||||||
blink_cmd_print(&command);
|
blink_cmd_print(&command);
|
||||||
|
|
||||||
switch (command.variant) {
|
switch (command.variant) {
|
||||||
|
@ -79,28 +79,28 @@ void task_blink_cycle(void *pvParams) {
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||||
|
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||||
|
|
||||||
cmd.rate = 50;
|
cmd.rate = 50;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||||
|
|
||||||
cmd.rate = 25;
|
cmd.rate = 25;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||||
|
|
||||||
cmd.rate = 500;
|
cmd.rate = 500;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void task_blink_cycle(void *pvParams) {
|
||||||
|
|
||||||
cmd.variant = BLINK_STATE;
|
cmd.variant = BLINK_STATE;
|
||||||
cmd.state = 1;
|
cmd.state = 1;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void task_blink_cycle(void *pvParams) {
|
||||||
|
|
||||||
cmd.variant = BLINK_RATE;
|
cmd.variant = BLINK_RATE;
|
||||||
cmd.rate = 200;
|
cmd.rate = 200;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void task_blink_cycle(void *pvParams) {
|
||||||
|
|
||||||
cmd.variant = BLINK_STATE;
|
cmd.variant = BLINK_STATE;
|
||||||
cmd.state = 0;
|
cmd.state = 0;
|
||||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
if (xQueueSend(blink_cmd_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||||
printf("Error sending blink command...");
|
printf("Error sending blink command...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue