Mod Library
Sun Devil Rocketry's hardware agnostic utility library
Toggle main menu visibility
Loading...
Searching...
No Matches
commands.h
Go to the documentation of this file.
1
20
21
/* Define to prevent recursive inclusion -------------------------------------*/
22
#ifndef COMMANDS_H
23
#define COMMANDS_H
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
/* platform specific includes */
30
#if defined( A0002_REV2 ) || defined( A0005_REV1 )
31
#include "imu.h"
32
#include "usb.h"
33
#endif
34
35
#include "
math_sdr.h
"
36
37
/*------------------------------------------------------------------------------
38
Macros
39
------------------------------------------------------------------------------*/
40
41
/* sdec command codes */
42
#define PING_OP 0x01
/* ping command opcode */
43
#define CONNECT_OP 0x02
/* connect command opcode */
44
#define IGNITE_OP 0x20
/* ignition command opcode */
45
#define POWER_OP 0x21
/* Power command opcode */
46
#define FLASH_OP 0x22
/* flash command opcode */
47
#define SENSOR_OP 0x03
/* sensor command opcode */
48
#define SOL_OP 0x51
/* solenoid command opcode */
49
#define VALVE_OP 0x52
/* Valve command opcode */
50
#define DUAL_DEPLOY_OP 0xA0
/* dual-deploy command opcode */
51
#define SERVO_OP 0x08
/* servo command opcode */
52
#define PRESET_OP 0x24
/* preset command opcode */
53
#define DASHBOARD_OP 0x30
/* dashboard command opcode */
54
#define LORA_OP 0x31
/* LORA command opcode */
55
56
#define FIN_OP 0x21
/* fin calibrate opcode (NOTE: DUPLICATE OF POWER_OP) */
57
58
/* Board identifier code */
59
#if defined( A0002_REV1 )
/* Flight Computer Rev 1.0 */
60
/* Rev 1 */
61
#define PING_RESPONSE_CODE ( 0x04 )
62
#elif defined( L0002_REV4 )
/* Engine Controller Rev 4.0 */
63
/* Rev 4 */
64
#define PING_RESPONSE_CODE ( 0x03 )
65
#elif defined( L0005_REV2 )
/* Valve controller Rev 2.0 */
66
/* Rev 2 */
67
#define PING_RESPONSE_CODE ( 0x02 )
68
#elif defined( A0002_REV2 )
/* Flight Computer Rev 2.0 */
69
/* Rev 2 */
70
#define PING_RESPONSE_CODE ( 0x05 )
71
#elif defined( A0007_REV1 )
/* Flight Computer Lite Rev 1.0 */
72
/* Rev 1 */
73
#define PING_RESPONSE_CODE ( 0x06 )
74
#elif defined ( L0005_REV3 )
/* Valve Controller Rev 3.0 */
75
/* Rev 3 */
76
#define PING_RESPONSE_CODE ( 0x07 )
77
#elif defined ( L0002_REV5 )
/* Engine Controller Rev 5.0 */
78
/* Rev 5 */
79
#define PING_RESPONSE_CODE ( 0x08 )
80
#elif defined ( A0005_REV2 )
/* Ground Station Rev 2.0 */
81
/* Rev 2 */
82
#define PING_RESPONSE_CODE ( 0x09 )
83
#elif defined ( A0005_REV1 )
/* Ground Station Rev 1.0 */
84
/* Rev 1 */
85
#define PING_RESPONSE_CODE ( 0x10 )
86
#endif
87
88
/* Firmware Identifier Code - FC */
89
#define FIRMWARE_TERMINAL ( 0x01 )
/* Terminal Firmware */
90
#define FIRMWARE_DATA_LOGGER ( 0x02 )
/* Data Logger Firmware */
91
#define FIRMWARE_DUAL_DEPLOY ( 0x03 )
/* Dual Deploy Firmware */
92
#define FIRMWARE_HOTFIRE ( 0x04 )
/* Hotfire Firmware */
93
#define FIRMWARE_CANARD ( 0x05 )
/* Canard Firmware */
94
#define FIRMWARE_APPA ( 0x06 )
/* APPA Firmware */
95
96
/* Firmware Identifier Code - GS */
97
#define FIRMWARE_RECEIVER ( 0x11 )
/* Reciever Firmware */
98
99
/* Other macros */
100
#define DASHBOARD_DUMP_SIZE ( 36 )
101
102
typedef
struct
__attribute__((packed)) _DASHBOARD_DUMP_TYPE
103
{
104
QUAT attitude;
105
float
alt;
106
float
latitude;
107
float
longitude;
108
float
acc_x;
109
float
roll_rate;
110
} DASHBOARD_DUMP_TYPE;
111
_Static_assert
(
sizeof
(DASHBOARD_DUMP_TYPE) == DASHBOARD_DUMP_SIZE,
"DASHBOARD_DUMP_TYPE size invalid."
);
112
113
/*------------------------------------------------------------------------------
114
Function Prototypes
115
------------------------------------------------------------------------------*/
116
123
void
ping
124
(
125
#ifndef VALVE_CONTROLLER
126
void
127
#
else
128
CMD_SOURCE cmd_source
129
#endif
130
);
131
132
#ifdef A0002_REV2
138
USB_STATUS dashboard_dump
139
(
140
void
141
);
142
149
void
dashboard_construct_dump
150
(
151
DASHBOARD_DUMP_TYPE* buffer
/* must be DASHBOARD_DUMP_SIZE */
152
);
153
#endif
154
155
#ifdef __cplusplus
156
}
157
#endif
158
159
#endif
/* COMMANDS_H */
160
161
/*******************************************************************************
162
* END OF FILE *
163
*******************************************************************************/
ping
void ping(void)
Sends a 1 byte response back to host PC to signal a functioning serial connection.
Definition
commands.c:51
math_sdr.h
: Contains math and utility functions for SDR code.
commands
commands.h
Generated by
1.18.0