![]() |
SimpleFOClibrary
2.1
|
#include <Commander.h>
Public Member Functions | |
| Commander (Stream &serial) | |
| Commander () | |
| void | run () |
| void | run (Stream &reader) |
| void | run (char *user_input) |
| void | add (char id, CommandCallback onCommand, char *label=nullptr) |
| void | motor (FOCMotor *motor, char *user_cmd) |
| void | lpf (LowPassFilter *lpf, char *user_cmd) |
| void | pid (PIDController *pid, char *user_cmd) |
| void | scalar (float *value, char *user_cmd) |
Public Attributes | |
| VerboseMode | verbose = VerboseMode::user_friendly |
| flag signaling that the commands should output user understanable text More... | |
| uint8_t | decimal_places = 3 |
| number of decimal places to be used when displaying numbers More... | |
| Stream * | com_port = nullptr |
| Serial terminal variable if provided. More... | |
Commander class implementing string communication protocol based on IDvalue (ex AB5.321 - command id A, sub-command id B,value 5.321)
Definition at line 33 of file Commander.h.
| Commander::Commander | ( | Stream & | serial | ) |
Default constructor receiving a serial interface that it uses to output the values to Also if the function run() is used it uses this serial instance to read the serial for user commands
| serial | - Serial com port instance |
Definition at line 4 of file Commander.cpp.
| Commander::Commander | ( | ) |
Definition at line 7 of file Commander.cpp.
| void Commander::add | ( | char | id, |
| CommandCallback | onCommand, | ||
| char * | label = nullptr |
||
| ) |
Function adding a callback to the coomander withe the command id
| id | - char command letter |
| onCommand | - function pointer void function(char*) |
| label | - string label to be displayed when scan command sent |
Definition at line 12 of file Commander.cpp.
| void Commander::lpf | ( | LowPassFilter * | lpf, |
| char * | user_cmd | ||
| ) |
Low pass fileter command interface
Definition at line 364 of file Commander.cpp.
| void Commander::motor | ( | FOCMotor * | motor, |
| char * | user_cmd | ||
| ) |
FOC motor (StepperMotor and BLDCMotor) command interface
Definition at line 102 of file Commander.cpp.
| void Commander::pid | ( | PIDController * | pid, |
| char * | user_cmd | ||
| ) |
PID controller command interface
Definition at line 327 of file Commander.cpp.
| void Commander::run | ( | ) |
Function reading the serial port and firing callbacks that have been added to the commander once the user has requested them - when he sends the command
Definition at line 20 of file Commander.cpp.
| void Commander::run | ( | char * | user_input | ) |
Function reading the string of user input and firing callbacks that have been added to the commander once the user has requested them - when he sends the command
| user_input | - string of user inputs |
Definition at line 61 of file Commander.cpp.
| void Commander::run | ( | Stream & | reader | ) |
Function reading the string of user input and firing callbacks that have been added to the commander once the user has requested them - when he sends the command
| reader | - Stream to read user input |
Definition at line 38 of file Commander.cpp.
| void Commander::scalar | ( | float * | value, |
| char * | user_cmd | ||
| ) |
Float variable scalar command interface
Definition at line 381 of file Commander.cpp.
| Stream* Commander::com_port = nullptr |
Serial terminal variable if provided.
Definition at line 93 of file Commander.h.
| uint8_t Commander::decimal_places = 3 |
number of decimal places to be used when displaying numbers
Definition at line 90 of file Commander.h.
| VerboseMode Commander::verbose = VerboseMode::user_friendly |
flag signaling that the commands should output user understanable text
Definition at line 89 of file Commander.h.