Advertisement
AneoX

swaplink_structures.h

Feb 12th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. #ifndef SWAPLINK_STRUCTS_H
  2. #define SWAPLINK_STRUCTS_H
  3. #include "main.h"
  4. #include <stdbool.h>
  5. #define FLAGS_COUNT 64
  6. #define TABLES_MAX_SIZE 32
  7.  
  8. struct swaplink_fan_settings_struct
  9. {
  10. uint8_t isEn : 1;
  11. uint8_t is_fan_inverse_duty : 1;
  12. u_int8_t isAc : 1;
  13. uint8_t fan_map_size : 5;
  14. uint8_t fan_min_duty;
  15. uint8_t fan_max_duty;
  16.  
  17. u16 fan_arr;
  18. u8 fan_ac_duty;
  19. u8 reserve8;
  20.  
  21. uint8_t fan_map[8][2]; // 8 max, fan_map_size 5 bit, max possible 31
  22. };
  23. struct swaplink_realtimeStruct
  24. {
  25. int16_t sensors_values[MAX_SENSORS_COUNT];
  26. u16 di_state;
  27. u16 do_state;
  28. u32 flags[2];
  29. };
  30.  
  31. struct swaplink_sensor_configStruct
  32. {
  33. u32 isEn : 1;
  34. u32 isCustom : 1;
  35. u32 config : 30;
  36.  
  37. char customShortName[24];
  38.  
  39. u8 analogTableID;
  40. u8 inputDataSource;
  41. u8 inputSourceIndex;
  42. u8 reserve;
  43.  
  44. int32_t minPossibleValue;
  45. int32_t maxPossibleValue;
  46.  
  47. int32_t offset;
  48. int32_t multiplyer;
  49. int32_t divider;
  50.  
  51. u32 reserved[12];
  52. };
  53.  
  54. struct swaplink_tmp_settingsStruct
  55. {
  56. u32 marker;
  57. u32 is_fuel_level_inverse : 1;
  58. u32 div_mode : 8;
  59. u32 reserve23 : 23;
  60.  
  61. float div_coeff;
  62. u32 fuelLevelTable[3][2];
  63. u32 crc;
  64. };
  65.  
  66. struct swaplink_pwm_outputs_struct
  67. {
  68. char name[32];
  69. u16 period_ms;
  70. u8 minDuty;
  71. u8 maxDuty;
  72.  
  73. u8 isEn : 1;
  74. u8 isFan : 1;
  75. u8 isRpm : 1;
  76. u8 isFunc : 1;
  77. u8 config : 4;
  78. u8 func_id;
  79. u8 analog_table_id;
  80. u8 reserve8;
  81.  
  82. u32 coeff;
  83. u32 reserve;
  84. };
  85.  
  86. struct swaplink_di_settings_struct
  87. {
  88. u8 is_pull_up : 1;
  89. u8 is_pull_down : 1;
  90. u8 is_inverse : 1;
  91. u8 reserve : 5;
  92. };
  93.  
  94. struct swaplink_flag_or_do_settings_struct
  95. {
  96. u8 is_invert : 1;
  97. u8 inChannelType : 7;
  98. u8 inChannel;
  99. };
  100.  
  101. struct swaplink_settingsStruct
  102. {
  103. u32 crc;
  104.  
  105. u16 settings_ver : 2;
  106. u16 is_fuel_level_inverse : 1;
  107. u16 reserve10 : 13;
  108. u8 reserve8;
  109. u8 div_mode;
  110.  
  111. u32 fuelLevelTable[3][2];
  112. float div_coeff;
  113.  
  114. u16 ecu;
  115. u16 dash;
  116. u16 chassis;
  117.  
  118. struct swaplink_fan_settings_struct fan_settings[3];
  119. struct swaplink_di_settings_struct di_settings[32];
  120. struct swaplink_flag_or_do_settings_struct do_settings[32];
  121. struct swaplink_flag_or_do_settings_struct flags_settings[FLAGS_COUNT];
  122. struct theCustomAnalogSensor analogTables[8];
  123. struct swaplink_pwm_outputs_struct pwm_outputs[8];
  124. struct swaplink_sensor_configStruct sensor_config[MAX_SENSORS_COUNT];
  125.  
  126. // u8 reserveEnd[50 * 1024];
  127. };
  128.  
  129. struct dio_pins_struct
  130. {
  131. GPIO_TypeDef *port;
  132. uint8_t pinNum;
  133. uint16_t pinMask;
  134. };
  135.  
  136. struct pwm_pins_struct
  137. {
  138. GPIO_TypeDef *port;
  139. uint8_t pinNum;
  140. uint16_t pinMask;
  141. __IO uint32_t *arr;
  142. __IO uint32_t *ccr;
  143. };
  144.  
  145. struct basic_dashboard_struct
  146. {
  147. const u8 ids_list[32];
  148. const u8 data[32];
  149. const u32 ids_count : 6;
  150. const u32 isMpx : 1;
  151. const u32 isCan : 1;
  152. const u32 rpm_coeff : 16;
  153. const u32 reserve : 8;
  154. const dash_tx tx_func;
  155. };
  156. typedef struct basic_dashboard_struct *dash;
  157.  
  158. struct swaplink_adc_struct
  159. {
  160. uint16_t cruise_adc;
  161. uint16_t vresistor_adc;
  162. uint16_t fuel_adc;
  163. uint16_t sensor5v_adc;
  164. uint16_t vref;
  165. };
  166.  
  167. #endif // !SWAPLINK_STRUCTS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement