Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Structures.h
- Committer:
- ee12b079
- Date:
- 2016-03-01
- Revision:
- 133:56d37aa8a011
- Parent:
- 103:b55559925dc1
- Child:
- 180:ccc21cc163f8
File content as of revision 133:56d37aa8a011:
// TC TM
#define TC_SHORT_SIZE 11
#define TC_LONG_SIZE 135
#define TM_LONG_SIZE 134
#define TM_SHORT_SIZE 13
#define SHORT_TC_CODE 0
#define LONG_TC_CODE 1
#define SHORT_TM_CODE 1
#define LONG_TM_CODE 0
// COM_RX
#define RX_BUFFER_LENGTH 60
// 60+4 = 64
struct data_node{
uint8_t values[RX_BUFFER_LENGTH];
struct data_node* next_node;
};
typedef struct data_node COM_RX_DATA_NODE;
//TELECOMMAND:
/*
exec_status:
0: unexecuted
1: successfully executed
2: Execution Failed
3: Disabled
4: Marked For retry
*/
#define TC_STATE_UNEXECUTED 0x00
#define TC_STATE_SUCCESSFULLY_EXECUTED 0x01
#define TC_STATE_EXECUTION_FAILED 0x02
#define TC_STATE_DISABLED 0x04
#define TC_STATE_MARKED_RETRY 0x05
//MASKS
#define SHORT_LONG_TC_MASK 0x10
#define CRC_MASK 0x08
#define EXEC_STATUS_MASK 0x07
//USE ONLY THE BELOW MACROS TO MODIFY 'flags' VARIABLE
//x should be a Base_tc pointer
#define GETshort_or_long_tc(x) ( ( (x->flags) & SHORT_LONG_TC_MASK ) >> 4 )
#define GETcrc_pass(x) ( ( (x->flags) & CRC_MASK ) >> 3 )
#define GETabort_on_nack(x) ( ( (x->TC_string[1]) & 0x08 ) >> 3 )
#define GETapid(x) ( ( (x->TC_string[1]) & 0xC0 ) >> 6 )
#define GETexec_status(x) ( (x->flags) & EXEC_STATUS_MASK )
#define GETpacket_seq_count(x) (x->TC_string[0])
#define GETservice_type(x) ( (x->TC_string[2]) & 0xF0 )
#define GETservice_subtype(x) ( (x->TC_string[2]) & 0x0F )
#define GETpid(x) (x->TC_string[3])
//x should be a Base_tc pointer
//y should be a 8-bit number with relevant data in LSB
//use in a seperate line with ; at the end: similar to a function
#define PUTshort_or_long(x,y) x->flags = ( (x->flags) & ~(SHORT_LONG_TC_MASK)) | ( (y << 4) & SHORT_LONG_TC_MASK )
#define PUTcrc_pass(x,y) x->flags = ( (x->flags) & ~(CRC_MASK)) | ( (y << 3) & CRC_MASK)
#define PUTexec_status(x,y) x->flags = ( (x->flags) & ~(EXEC_STATUS_MASK)) | ( y & EXEC_STATUS_MASK)
//PARENT TELECOMMAND CLASS
class Base_tc{
public:
uint8_t flags;
uint8_t *TC_string;
Base_tc *next_TC;
virtual ~Base_tc(){}
};
//DERIVED CLASS - SHORT TC
class Short_tc : public Base_tc{
private:
uint8_t fix_str[TC_SHORT_SIZE];
public:
Short_tc(){
TC_string = fix_str;
flags = 0;
}
~Short_tc(){}
};
//DERIVED CLASS - LONG TC
class Long_tc : public Base_tc{
private:
uint8_t fix_str[TC_LONG_SIZE];
public:
Long_tc(){
TC_string = fix_str;
flags = 0;
}
~Long_tc(){}
};
// TELEMETRY:
// MASK
#define SHORT_LONG_TM_MASK 0x80
//x should be 'Base tm' pointer
#define GETshort_or_long_tm(x) ((x->TM_string[0] & SHORT_LONG_TM_MASK) >> 7)
// PARENT TELEMETRY CLASS
class Base_tm{
public:
uint8_t *TM_string;
Base_tm *next_TM;
virtual ~Base_tm(){}
};
// DERIVED CLASS : Long tm [type 0]
// type 0
class Long_tm : public Base_tm{
private:
uint8_t fix_str[TM_LONG_SIZE];
public:
Long_tm(){
TM_string = fix_str;
// type 0
}
~Long_tm(){}
};
// DERIVED CLASS : Short tm [type 1]
// type 1
class Short_tm : public Base_tm{
private:
uint8_t fix_str[TM_SHORT_SIZE];
public:
Short_tm(){
TM_string = fix_str;
// type 1
}
~Short_tm(){}
};
// CDMS HK
#define tstart -40
#define tstep 8 //to be finalized by thermal team
#define tstart_thermistor -40
#define tstep_thermistor 8
typedef struct CDMS_HK_actual
{
float temp_actual[16];
float CDMS_temp_actual;
}CDMS_HK_actual;
typedef struct CDMS_HK_quant
{
char temp_quant[16];
char CDMS_temp_quant;
}CDMS_HK_quant;
typedef struct CDMS_HK_min_max
{
char temp_max[16];
char temp_min[16];
char CDMS_temp_min;
char CDMS_temp_max;
}CDMS_HK_min_max;
