PixelKey
NeoPixel USB Key
Loading...
Searching...
No Matches
command_processor.c File Reference
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "hal_device.h"
#include "hal_tasks.h"
#include "ring_buffer.h"
#include "serial.h"
#include "config.h"
#include "version.h"
#include "pixelkey.h"
#include "pixelkey_errors.h"
#include "pixelkey_commands.h"
#include "pixelkey_hal.h"

Data Structures

struct  st_cmd_help
 

Macros

#define CMDPROC_PROMPT_STR   "> "
 
#define CMD_HELP_COUNT   (sizeof(cmd_help)/sizeof(cmd_help[0]))
 

Typedefs

typedef void(* handler_fn_t) (void *p_cmd_args)
 

Functions

static void send_trailer (bool is_nak, pixelkey_error_t error)
 Sends the OK/NAK trailer for each command. More...
 
static void handler_undefined (void *p_cmd_args)
 
static void handler_config_get (void *p_cmd_args)
 
static void handler_config_set (void *p_cmd_args)
 
static void handler_help (void *p_cmd_args)
 
static void handler_resume (void *p_cmd_args)
 
static void handler_stop (void *p_cmd_args)
 
static void handler_status (void *p_cmd_args)
 
static void handler_version (void *p_cmd_args)
 
static void handler_time_get (void *p_cmd_args)
 
static void handler_time_set (void *p_cmd_args)
 
static void handler_reboot (void *p_cmd_args)
 
static void handler_keyframe_wrapper (void *p_cmd_args)
 
static void handler_keyframe_mod_repeat (void *p_cmd_args)
 
static void handler_keyframe_mod_schedule (void *p_cmd_args)
 
static void handler_keyframe_mod_group (void *p_cmd_args)
 
void pixelkey_commandproc_init (void)
 Initialize the command processor.
 
pixelkey_error_t pixelkey_commandproc_push (cmd_t *p_cmd)
 Pushes a command to the processor buffer. More...
 
void pixelkey_commandproc_task (void)
 Executes queued commands. More...
 
void pixelkey_commandproc_terminal_connected (void)
 Writes the initial device info and terminal prompt when a terminal attach is detected.
 
void pixelkey_commandproc_send_prompt (void)
 Writes the terminal prompt. More...
 

Variables

static cmd_tcmd_buffer_data [PIXELKEY_COMMAND_BUFFER_LENGTH] = {0}
 
static ring_buffer_t cmd_buffer = {0}
 
static handler_fn_t cmd_handlers [CMD_TYPE_COUNT]
 
static struct st_cmd_help cmd_help []
 
static bool has_repeat_modifier = false
 
static int32_t repeat_modifier = 0
 
static bool has_schedule_modifier = false
 
static bool is_schedule_repeating = false
 
static keyframe_schedule_t schedule_modifier = {0}