Project 9
Stepper Motor
|
Neff Site |
This module implements a command line interface for the A4988 stepper motor driver. More...
Go to the source code of this file.
Macros | |
#define | CLI_ARG_MOTOR_ON 0 |
#define | CLI_ARG_MOTOR_OFF 1 |
#define | CLI_ARG_TURN_LEFT 0 |
#define | CLI_ARG_TURN_RIGHT 1 |
Functions | |
cli_state_t | cli_parse_command (char token, cli_command_t *command) |
Parse command. More... | |
cli_state_t | cli_parse_direction_argument (char token, uint16_t *argument) |
Parse direction argument. More... | |
cli_state_t | cli_parse_motor_argument (char token, uint16_t *argument) |
Parse motor argument. More... | |
cli_state_t | cli_parse_advance_argument1 (char token, uint16_t *argument) |
Parse first advance argument. More... | |
cli_state_t | cli_parse_advance_argument2 (char token, uint16_t *argument) |
Parse second advance argument. More... | |
cli_state_t | cli_parse_terminal (char token) |
Parse terminal. More... | |
cli_state_t | cli_execute (cli_command_t command, uint16_t argument) |
Execute command. More... | |
cli_state_t | cli_error (void) |
Print error message. More... | |
This module implements a command line interface for the A4988 stepper motor driver.
#define CLI_ARG_MOTOR_OFF 1 |
#define CLI_ARG_MOTOR_ON 0 |
#define CLI_ARG_TURN_LEFT 0 |
#define CLI_ARG_TURN_RIGHT 1 |
enum cli_command_t |
enum cli_state_t |
cli_state_t cli_error | ( | void | ) |
Print error message.
Prints an error message if an error occurred. The subsequent state is CLI_STATE_GET_COMMAND
.
cli_state_t cli_execute | ( | cli_command_t | command, |
uint16_t | argument | ||
) |
Execute command.
Executes the provided command with the given argument. It returns CLI_STATE_GET_COMMAND
if no error occured.
command | The command to be executed. |
argument | The argument for the command. |
cli_state_t cli_parse_advance_argument1 | ( | char | token, |
uint16_t * | argument | ||
) |
Parse first advance argument.
This routine parses the first argument that follows the CLI_CMD_ADVANCE
command. The subsequent state is returned. It will be CLI_STATE_PARSE_ERROR
if the argument is not valid.
token | The input token. |
argument | The value of the parsed argument. |
cli_state_t cli_parse_advance_argument2 | ( | char | token, |
uint16_t * | argument | ||
) |
Parse second advance argument.
This routine parses the second argument that follows the CLI_CMD_ADVANCE
command. The subsequent state is returned. It will be CLI_STATE_PARSE_ERROR
if the argument is not valid. On entry parameter argument
must contain argument1 as the value of both arguments is returned.
token | The input token. |
argument | The value of argument1 and argument2. |
cli_state_t cli_parse_command | ( | char | token, |
cli_command_t * | command | ||
) |
Parse command.
A parser analyzes input tokens and determines their meaning. Their meaning is defined by the protocol. This routine parses the input token and determines the specified command. It also returns the subsequent state. A CLI_STATE_PARSE_ERROR
is returned if no valid command is found.
token | The input token. |
command | The parsed command. |
cli_state_t cli_parse_direction_argument | ( | char | token, |
uint16_t * | argument | ||
) |
Parse direction argument.
This routine parses the argument that follows the CLI_CMD_DIRECTION
command. The subsequent state is returned. It will be CLI_STATE_PARSE_ERROR
if the argument is not valid.
token | The input token. |
argument | The value of the parsed argument. |
cli_state_t cli_parse_motor_argument | ( | char | token, |
uint16_t * | argument | ||
) |
Parse motor argument.
This routine parses the argument that follows the CLI_CMD_MOTOR
command. The subsequent state is returned. It will be CLI_STATE_PARSE_ERROR
if the the argument is not valid.
token | The input token. |
argument | The value of the parsed argument. |
cli_state_t cli_parse_terminal | ( | char | token | ) |
Parse terminal.
Terminal symbols are symbols which terminate a command. This routine checks if the token passed is a terminal. It returns CLI_STATE_EXECUTE
if a terminal symbol was found or CLI_STATE_PARSE_ERROR
otherwise.
token | The input token. |
Contact | Generated by 1.8.13 |