Skip to content
Snippets Groups Projects
Commit 754ed22e authored by dawehr's avatar dawehr
Browse files

Added the IDs for the valuetypes and PID constants to commands.c/h

also added some more comments in both files
parent 80230d2f
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,8 @@
*
*/
/* List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
/*
* List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
* Simply implement a function with the same name
* in a different file (callbacks.c) and these will
* be overridden.
......@@ -60,7 +61,14 @@ command_cb cb_setval __attribute__((weak, alias("cb_default")));
command_cb cb_getval __attribute__((weak, alias("cb_default")));
command_cb cb_respval __attribute__((weak, alias("cb_default")));
/* Command structure */
/*
* Command structure.
* This array is used to keep track of the callback functions
* for commands between the quad and the ground station.
*
* There is one callback function pointer associated with each
* element in this struct array.
*/
struct MessageType MessageTypes[MAX_TYPE] =
{
// DEBUG
......
......@@ -7,15 +7,17 @@
#include "callbacks.h"
// ----------------------
// Helper stuff
#define MAX_CMD_TEXT_LENGTH 100
enum Message{
BEGIN_CHAR = 0xBE,
END_CHAR = 0xED
};
// This should also have double to avoid confusion with float values.
/*
* Enumeration of the data types that a callback function may use
* doubleType should get added here at some point
*/
enum DataType
{
floatType,
......@@ -23,27 +25,59 @@ enum DataType
stringType
};
// message type IDs used to know what kind of message we are dealing with
// DO NOT change this enum or you will break backwards compatibility.
/*
* Message type IDs used to know what kind of message we are dealing with
* Enumeration used to index the MessageTypes array in commands.c
* DO NOT change this enum or you will break backwards compatibility.
*/
enum MessageTypeID{
DEBUG_TYPE_ID,
PACKETLOG_TYPE_ID,
GETPACKETLOGS_TYPE_ID,
UPDATE_TYPE_ID,
BEGINUPDATE_TYPE_ID,
LOG_TYPE_ID,
RESPONSE_TYPE_ID,
SETVAL_TYPE_ID,
GETVAL_TYPE_ID,
RESPVAL_TYPE_ID,
DEBUG_TYPE_ID, //
PACKETLOG_TYPE_ID, //
GETPACKETLOGS_TYPE_ID, //
UPDATE_TYPE_ID, //
BEGINUPDATE_TYPE_ID, //
LOG_TYPE_ID, //
RESPONSE_TYPE_ID, //
SETVAL_TYPE_ID, // setting values. Example: PID constants
GETVAL_TYPE_ID, // getting values. Example: PID constants
RESPVAL_TYPE_ID, // responding with values. Example: PID constants
// This last type is just used to keep track of the size
MAX_TYPE
};
// MESSAGE SUBTYPES
/*
* Value types used to know which value the command is referencing
*/
enum ValueType{
// PID controllers. Each one has a P, I, D, setpoint value option
ROLL,
PITCH,
YAW,
ROLL_RATE,
PITCH_RATE,
YAW_RATE,
LOCAL_X,
LOCAL_Y,
ALT,
};
/*
* Enumeration of PID constants
*/
enum PIDType{
KP, // P constant
KI, // I constant
KD, // D constant
SP, // Setpoint value
};
/*
* Message type struct used to keep track of the callback function
* pointers located in commands.c
*/
struct MessageType{
char ID;
char cmdText[100];
char cmdText[MAX_CMD_TEXT_LENGTH];
char cmdDataType;
command_cb * functionPtr;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment