Cleaning up, extending test code, assigning numbers to enum members
This commit is contained in:
parent
5d7f35b7c4
commit
5522202189
2 changed files with 16 additions and 3 deletions
|
@ -11,7 +11,8 @@
|
|||
#include "tasks.h"
|
||||
|
||||
QueueHandle_t blink_rate_q;
|
||||
void blink_cmd_print(const BlinkCmd_t *cmd) {
|
||||
|
||||
void blink_cmd_print(const BlinkCmd_t *cmd) {
|
||||
printf("BlinkCmd { ");
|
||||
|
||||
switch (cmd->variant) {
|
||||
|
@ -63,6 +64,8 @@ void task_blink(void *pvParams) {
|
|||
gpio_set_level(LED_PIN, command.state);
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,11 +111,21 @@ void task_blink_cycle(void *pvParams) {
|
|||
printf("Error sending blink command...");
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
|
||||
cmd.variant = BLINK_RATE;
|
||||
cmd.rate = 200;
|
||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||
printf("Error sending blink command...");
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
|
||||
cmd.variant = BLINK_STATE;
|
||||
cmd.state = 0;
|
||||
if (xQueueSend(blink_rate_q, &cmd, pdMS_TO_TICKS(200)) != pdPASS) {
|
||||
printf("Error sending blink command...");
|
||||
}
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ typedef double f64;
|
|||
#define BLINK_DELAY (1000 / 2 / RATE_PER_S)
|
||||
|
||||
typedef enum {
|
||||
BLINK_RATE,
|
||||
BLINK_STATE,
|
||||
BLINK_RATE = 0,
|
||||
BLINK_STATE = 1,
|
||||
} BlinkCmdVariant;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Add table
Reference in a new issue