OpenShoe  1.0
control_tables.h
Go to the documentation of this file.
00001 
00002 
00026 #ifndef CONTROL_TABLES_H_
00027 #define CONTROL_TABLES_H_
00028 
00029 
00030 #include "compiler.h"
00031 #include "nav_types.h"
00032 
00034 typedef const struct {
00035         uint8_t header;
00036         void (*cmd_response)(uint8_t**);
00037         uint8_t nrb_payload;
00038         uint8_t nr_fields;
00039         uint8_t field_widths[];
00040 } command_structure;
00041 
00043 typedef const struct {
00044         uint8_t id;
00045         void (*func_p)(void);
00046         int max_proc_time; 
00047 } proc_func_info;
00048 
00050 typedef const struct {
00051         uint8_t id;
00052         void* state_p;
00053         int state_size;
00054 } state_t_info;
00055 
00056 
00059 
00060 #define UPDATE_BUFFER 0x04
00061 #define INITIAL_ALIGNMENT 0x05
00062 #define MECHANIZATION 0x06
00063 #define TIME_UPDATE 0x07
00064 #define ZUPT_DETECTOR 0x08
00065 #define ZUPT_UPDATE 0x09
00066 #define GYRO_CALIBRATION 0x10
00067 #define ACCELEROMETER_CALIBRATION 0x11
00068 
00069 
00072 
00073 // Maximum value of state ID (255)
00074 #define SID_LIMIT 0xFF
00075 // State IDs
00076 // IMU measurements
00077 #define SPECIFIC_FORCE_SID 0x01
00078 #define ANGULAR_RATE_SID 0x02
00079 #define IMU_TEMPERATURS_SID 0x03
00080 #define IMU_SUPPLY_VOLTAGE_SID 0x04
00081 // Filtering states
00082 #define POSITION_SID 0x11
00083 #define VELOCITY_SID 0x12
00084 #define QUATERNION_SID 0x13
00085 #define ZUPT_SID 0x14
00086 // System states
00087 #define INTERRUPT_COUNTER_SID 0x21
00088 // "Other" states
00089 #define ACCELEROMETER_BIASES_SID 0x35
00090 
00091 
00094 
00095 #define ONLY_ACK 0x01
00096 #define MCU_ID 0x02
00097 #define OUTPUT_STATE 0x20
00098 #define OUTPUT_ALL_OFF 0x21
00099 #define OUTPUT_ONOFF_INERT 0x22
00100 #define OUTPUT_POSITION_PLUS_ZUPT 0x23
00101 #define OUTPUT_NAVIGATIONAL_STATES 0x24
00102 #define PROCESSING_FUNCTION_ONOFF 0x30
00103 #define RESET_ZUPT_AIDED_INS 0x10
00104 #define GYRO_CALIBRATION_INIT 0x11
00105 #define ACC_CALIBRATION_INIT 0x12
00106 #define SET_LOWPASS_FILTER_IMU 0x13
00107 #define ADD_SYNC_OUTPUT 0x25
00108 #define SYNC_OUTPUT 0x26
00109 
00110 
00111 // Global variables used to access command information
00112 extern uint8_t command_header_table[32];
00113 extern command_structure* command_info_array[256];
00114 void commands_init(void);
00115 
00116 inline bool is_valid_header(uint8_t header){
00117         return command_header_table[header>>3] & (1<<(header & 7));}
00118         
00119 inline command_structure* get_command_info(uint8_t header){
00120         return command_info_array[header];}
00121 
00122 
00123 // Array containing the processing functions to run
00124 extern proc_func_info* processing_functions_by_id[256];
00125 void processing_functions_init(void);
00126 
00127 
00128 // Global variables used to access information about states
00129 extern state_t_info* state_info_access_by_id[SID_LIMIT];
00130 void system_states_init(void);
00131 
00132 
00133 #endif /* CONTROL_TABLES_H_ */
00134 
 All Data Structures Files Functions Variables Typedefs Defines