FreeRTOS+CLI task implementation example.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_CLI.h"
#include <udi_cdc.h>
#include <udc.h>
#include "demo-tasks.h"
Macros | |
#define | EVENT_QUEUE_LENGTH (5) |
#define | MAX_INPUT_SIZE 50 |
#define | RX_BUFFER_SIZE_BYTES (50) |
Functions | |
void | cdc_cli_output (const uint8_t const *message_string) |
void | cli_cdc_disable (uint8_t port) |
bool | cli_cdc_enable (uint8_t port) |
void | cli_cdc_rx_notify (uint8_t port) |
void | cli_vbus_event (bool b_vbus_high) |
void | create_usb_cdc_cli_task (uint16_t stack_depth_words, unsigned portBASE_TYPE task_priority) |
static void | usb_cdc_command_console_task (void *pvParameters) |
Variables | |
static xSemaphoreHandle | access_mutex = NULL |
static volatile bool | cdc_connected = false |
static xSemaphoreHandle | cdc_new_data_semaphore = NULL |
static const uint8_t *const | line_separator = (uint8_t *) "\r\n[Press ENTER to execute the previous command again]\r\n>" |
static const uint8_t *const | new_line = (uint8_t *) "\r\n" |
#define EVENT_QUEUE_LENGTH (5) |
#define MAX_INPUT_SIZE 50 |
Referenced by usb_cdc_command_console_task().
#define RX_BUFFER_SIZE_BYTES (50) |
void cdc_cli_output | ( | const uint8_t const * | message_string | ) |
References access_mutex, cdc_connected, udi_cdc_write_buf(), xSemaphoreGive, and xSemaphoreTake.
Referenced by created_task().
void cli_cdc_disable | ( | uint8_t | port | ) |
References cdc_connected.
bool cli_cdc_enable | ( | uint8_t | port | ) |
References cdc_connected.
void cli_cdc_rx_notify | ( | uint8_t | port | ) |
References cdc_new_data_semaphore, configASSERT, pdFALSE, and xSemaphoreGiveFromISR.
void cli_vbus_event | ( | bool | b_vbus_high | ) |
References udc_attach(), and udc_detach().
Referenced by usb_cdc_command_console_task().
void create_usb_cdc_cli_task | ( | uint16_t | stack_depth_words, |
unsigned portBASE_TYPE | task_priority | ||
) |
References access_mutex, cdc_new_data_semaphore, configASSERT, usb_cdc_command_console_task(), and vRegisterCLICommands().
Referenced by main().
|
static |
References access_mutex, cdc_new_data_semaphore, cli_vbus_event(), configCOMMAND_INT_MAX_OUTPUT_SIZE, FreeRTOS_CLIGetOutputBuffer(), FreeRTOS_CLIProcessCommand(), line_separator, MAX_INPUT_SIZE, new_line, pdFALSE, udc_include_vbus_monitoring(), udc_start(), udi_cdc_getc(), udi_cdc_is_rx_ready(), udi_cdc_putc(), udi_cdc_write_buf(), xSemaphoreGive, and xSemaphoreTake.
Referenced by create_usb_cdc_cli_task().
|
static |
Referenced by cdc_cli_output(), create_usb_cdc_cli_task(), and usb_cdc_command_console_task().
Referenced by cdc_cli_output(), cli_cdc_disable(), and cli_cdc_enable().
|
static |
Referenced by cli_cdc_rx_notify(), create_usb_cdc_cli_task(), and usb_cdc_command_console_task().
|
static |
Referenced by usb_cdc_command_console_task().
|
static |
Referenced by usb_cdc_command_console_task().