NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Command line interface
Collaboration diagram for Command line interface:

Files

file  cli.c
 

Data Structures

struct  clicmd_t
 
struct  lookupTableEntry_s
 
struct  cliMinMaxConfig_s
 
struct  cliLookupTableConfig_s
 
union  cliValueConfig_t
 
union  __attribute__
 
union  int_float_value_t
 

Macros

#define SENSOR_NAMES_MASK   (SENSOR_GYRO | SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
 
#define CLI_COMMAND_DEF(name, description, args, method)
 
#define CMD_COUNT   (sizeof(cmdTable) / sizeof(clicmd_t))
 
#define VALUE_TYPE_OFFSET   0
 
#define VALUE_SECTION_OFFSET   4
 
#define VALUE_MODE_OFFSET   6
 
#define VALUE_TYPE_MASK   (0x0F)
 
#define VALUE_SECTION_MASK   (0x30)
 
#define VALUE_MODE_MASK   (0xC0)
 
#define CPATH(path)   offsetof(struct config, path)
 
#define PPATH(path)   offsetof(struct config_profile, path)
 
#define RPATH(path)   offsetof(struct rate_profile, path)
 
#define DUMP_ALL   (DUMP_MASTER | DUMP_PROFILE | DUMP_CONTROL_RATE_PROFILE)
 
#define printSectionBreak()   cliPrintf(self, (char *)sectionBreak)
 

Typedefs

typedef struct lookupTableEntry_s lookupTableEntry_t
 
typedef struct cliMinMaxConfig_s cliMinMaxConfig_t
 
typedef struct
cliLookupTableConfig_s 
cliLookupTableConfig_t
 

Enumerations

enum  lookupTableIndex_e {
  TABLE_OFF_ON = 0, TABLE_UNIT, TABLE_ALIGNMENT, TABLE_GPS_PROVIDER,
  TABLE_GPS_SBAS_MODE, TABLE_BLACKBOX_DEVICE, TABLE_CURRENT_SENSOR, TABLE_GIMBAL_MODE,
  TABLE_PID_CONTROLLER, TABLE_SERIAL_RX, TABLE_GYRO_FILTER, TABLE_GYRO_LPF
}
 
enum  cliValueFlag_e {
  VAR_UINT8 = (0 << VALUE_TYPE_OFFSET), VAR_INT8 = (1 << VALUE_TYPE_OFFSET), VAR_UINT16 = (2 << VALUE_TYPE_OFFSET), VAR_INT16 = (3 << VALUE_TYPE_OFFSET),
  VAR_UINT32 = (4 << VALUE_TYPE_OFFSET), VAR_FLOAT = (5 << VALUE_TYPE_OFFSET), MASTER_VALUE = (0 << VALUE_SECTION_OFFSET), PROFILE_VALUE = (1 << VALUE_SECTION_OFFSET),
  CONTROL_RATE_VALUE = (2 << VALUE_SECTION_OFFSET), MODE_DIRECT = (0 << VALUE_MODE_OFFSET), MODE_LOOKUP = (1 << VALUE_MODE_OFFSET)
}
 
enum  dumpFlags_e { DUMP_MASTER = (1 << 0), DUMP_PROFILE = (1 << 1), DUMP_CONTROL_RATE_PROFILE = (1 << 2) }
 

Functions

void cli_start (struct cli *self, serialPort_t *serialPort)
 
void cli_update (struct cli *self)
 
bool cli_is_active (struct cli *self)
 
void cli_init (struct cli *self, struct ninja *ninja, struct config *config, const struct system_calls *system)
 

Variables

const clicmd_t cmdTable []
 
const clivalue_t valueTable []
 

Detailed Description

The cli module implements a command line interface for setting various ninjaflight config variables. It operates on a struct ninja object and on corresponding struct config object. It also provides various commands for diagnostics and control. It is similar to other configuration interfaces such as msp but in contrast to msp does not use a binary protocol, instead using a human readable stream of data.

Macro Definition Documentation

#define CLI_COMMAND_DEF (   name,
  description,
  args,
  method 
)
Value:
{ \
name , \
description , \
args , \
method \
}
#define CMD_COUNT   (sizeof(cmdTable) / sizeof(clicmd_t))
#define CPATH (   path)    offsetof(struct config, path)
#define DUMP_ALL   (DUMP_MASTER | DUMP_PROFILE | DUMP_CONTROL_RATE_PROFILE)
#define PPATH (   path)    offsetof(struct config_profile, path)
#define printSectionBreak ( )    cliPrintf(self, (char *)sectionBreak)
#define RPATH (   path)    offsetof(struct rate_profile, path)
#define SENSOR_NAMES_MASK   (SENSOR_GYRO | SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
#define VALUE_MODE_MASK   (0xC0)
#define VALUE_MODE_OFFSET   6
#define VALUE_SECTION_MASK   (0x30)
#define VALUE_SECTION_OFFSET   4
#define VALUE_TYPE_MASK   (0x0F)
#define VALUE_TYPE_OFFSET   0

Typedef Documentation

Enumeration Type Documentation

Enumerator
VAR_UINT8 
VAR_INT8 
VAR_UINT16 
VAR_INT16 
VAR_UINT32 
VAR_FLOAT 
MASTER_VALUE 
PROFILE_VALUE 
CONTROL_RATE_VALUE 
MODE_DIRECT 
MODE_LOOKUP 
Enumerator
DUMP_MASTER 
DUMP_PROFILE 
DUMP_CONTROL_RATE_PROFILE 
Enumerator
TABLE_OFF_ON 
TABLE_UNIT 
TABLE_ALIGNMENT 
TABLE_GPS_PROVIDER 
TABLE_GPS_SBAS_MODE 
TABLE_BLACKBOX_DEVICE 
TABLE_CURRENT_SENSOR 
TABLE_GIMBAL_MODE 
TABLE_PID_CONTROLLER 
TABLE_SERIAL_RX 
TABLE_GYRO_FILTER 
TABLE_GYRO_LPF 

Function Documentation

void cli_init ( struct cli self,
struct ninja ninja,
struct config config,
const struct system_calls system 
)
bool cli_is_active ( struct cli self)
void cli_start ( struct cli self,
serialPort_t serialPort 
)

Here is the call graph for this function:

void cli_update ( struct cli self)

Here is the call graph for this function:

Variable Documentation

const clicmd_t cmdTable[]
const clivalue_t valueTable[]