Atmel Software Framework

actuator.c File Reference
#include <string.h>
#include "compiler.h"
#include "FreeRTOS.h"
#include "shell.h"
#include "datalog.h"
#include "cpled.h"
#include "lcd.h"
#include "tracedump.h"
#include "cptime.h"
#include "actuator.h"

Data Structures

struct  ActuatorReg
 
struct  st_scheduled_param
 

Macros

#define ACTUATOR_LIST   "{ledb1,ledb2,ledm1,ledm2,lcd}"
 
#define ACTUATOR_MAXNB_ACTUATORS   (DATALOG_ID_LCD - DATALOG_ID_LEDB1 +1)
 

Typedefs

typedef struct st_scheduled_param Scheduled_Cmd_Params
 
typedef struct ActuatorReg xActuatorReg
 

Functions

eExecStatus e_actuator_cmd_get_value (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_actuator_cmd_set_value (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_actuator_help (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_actuator_ScheduleCmdSet (eSchedCmdId CmdId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 Schedule an actuator set for later. More...
 
void vExecScheduledSet (int CmdId, void *pxCmdParams)
 Execute a scheduled command. More...
 

Variables

const signed portCHAR *const ACTUATOR_ERRMSG_GETVAL_FAIL = (signed portCHAR *)"Error"CRLF"Actuator failed to deliver a value."CRLF
 
const signed portCHAR *const ACTUATOR_ERRMSG_GETVAL_SYNTAXERROR = (signed portCHAR *)"Error"CRLF"Usage: get_actuator_value actuator=actuatorname"CRLF
 
const signed portCHAR *const ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR = (signed portCHAR *)"Error"CRLF"Usage: set_actuator_value actuator=actuatorname fields..."CRLF
 
const signed portCHAR *const ACTUATOR_ERRMSG_UNREFACTUATOR = (signed portCHAR *)"Error"CRLF"Unreferenced actuator name"CRLF
 
const signed portCHAR *const ACTUATOR_MSG_HELP
 
xActuatorReg axActuatorsRegistry [ACTUATOR_MAXNB_ACTUATORS]
 

#define ACTUATOR_LIST   "{ledb1,ledb2,ledm1,ledm2,lcd}"
#define ACTUATOR_MAXNB_ACTUATORS   (DATALOG_ID_LCD - DATALOG_ID_LEDB1 +1)

Max number of actuators.

Referenced by e_actuator_cmd_get_value(), and e_actuator_cmd_set_value().

The params given to an actuator scheduled command.

typedef struct ActuatorReg xActuatorReg

An actuator register cell structure.

eExecStatus e_actuator_cmd_set_value ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_actuator_help ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_actuator_ScheduleCmdSet ( eSchedCmdId  CmdId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

Schedule an actuator set for later.

Parameters
CmdIdInput. The set actuator cmd identifier.
acInput. The argument counter.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. If the action is successful, no response string is output. If the action failed, a response string is output.
Returns
the status of the command execution.

References st_scheduled_param::ac, ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR, st_scheduled_param::av, e_cptime_RecordScheduledCmd(), i, j, NULL, pvPortMalloc(), SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, vExecScheduledSet(), and vPortFree().

Referenced by e_lcd_set_value(), e_ledb1_set_value(), e_ledb2_set_value(), e_ledm1_set_value(), and e_ledm2_set_value().

void vExecScheduledSet ( int  CmdId,
void *  pxCmdParams 
)

const signed portCHAR* const ACTUATOR_ERRMSG_GETVAL_FAIL = (signed portCHAR *)"Error"CRLF"Actuator failed to deliver a value."CRLF

Error msg upon get_actuator_value actuator error.

Referenced by e_actuator_cmd_get_value().

const signed portCHAR* const ACTUATOR_ERRMSG_GETVAL_SYNTAXERROR = (signed portCHAR *)"Error"CRLF"Usage: get_actuator_value actuator=actuatorname"CRLF

Error msg upon get_actuator_value syntax error.

Referenced by e_actuator_cmd_get_value().

const signed portCHAR* const ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR = (signed portCHAR *)"Error"CRLF"Usage: set_actuator_value actuator=actuatorname fields..."CRLF
const signed portCHAR* const ACTUATOR_ERRMSG_UNREFACTUATOR = (signed portCHAR *)"Error"CRLF"Unreferenced actuator name"CRLF

Error msg upon unreferenced actuator error.

Referenced by e_actuator_cmd_get_value(), and e_actuator_cmd_set_value().

const signed portCHAR* const ACTUATOR_MSG_HELP
Initial value:
= (signed portCHAR *)"\
"CRLF"set_actuator_value actuator={ledb1,ledb2} green=value red=value [time=date]"CRLF"\
set_actuator_value actuator={ledm1,ledm2} state={on,off} [time=date]"CRLF"\
set_actuator_value actuator=lcd usrmsg=\"string\" [time=date]"CRLF"\
get_actuator_value actuator="ACTUATOR_LIST" : display the current value of an actuator"CRLF
#define ACTUATOR_LIST
Definition: actuator.c:78
#define CRLF
Carriage Return + Line Feed.
Definition: print_funcs.h:252

Referenced by e_actuator_help().

xActuatorReg axActuatorsRegistry[ACTUATOR_MAXNB_ACTUATORS]
Initial value:
= {
}
eExecStatus e_ledb2_set_value(eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
The set bicolor ledb2 value command: set the value of the bicolor ledb2. Takes up to six parameters t...
Definition: cpled.c:366
bool b_ledb1_get_value(xLogDef *pxLog)
Get the ledb1 current value.
Definition: cpled.c:124
eExecStatus e_ledm1_set_value(eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
Definition: cpled.c:186
bool b_ledm1_get_value(xLogDef *pxLog)
Get the ledm1 current value.
Definition: cpled.c:84
bool b_ledb2_get_value(xLogDef *pxLog)
Get the ledb2 current value.
Definition: cpled.c:149
eExecStatus e_ledm2_set_value(eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
The set monocolor led2 value command: set the value of the monocolor led2. Takes up to four parameter...
Definition: cpled.c:248
bool b_ledm2_get_value(xLogDef *pxLog)
Get the ledm2 current value.
Definition: cpled.c:104
bool b_lcd_get_value(xLogDef *pxLog)
Get the lcd current value.
Definition: lcd.c:86
eExecStatus e_lcd_set_value(eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
Set the user msg area of the lcd. Takes up to four parameters the first parameter is the usrmsg param...
Definition: lcd.c:115
eExecStatus e_ledb1_set_value(eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
The set bicolor ledb1 value command: set the value of the bicolor ledb1. Takes up to six parameters t...
Definition: cpled.c:312