Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SWAPLINK_STRUCTS_H
- #define SWAPLINK_STRUCTS_H
- #include "main.h"
- #include <stdbool.h>
- #define FLAGS_COUNT 64
- #define TABLES_MAX_SIZE 32
- struct swaplink_fan_settings_struct
- {
- uint8_t isEn : 1;
- uint8_t is_fan_inverse_duty : 1;
- u_int8_t isAc : 1;
- uint8_t fan_map_size : 5;
- uint8_t fan_min_duty;
- uint8_t fan_max_duty;
- u16 fan_arr;
- u8 fan_ac_duty;
- u8 reserve8;
- uint8_t fan_map[8][2]; // 8 max, fan_map_size 5 bit, max possible 31
- };
- struct swaplink_realtimeStruct
- {
- int16_t sensors_values[MAX_SENSORS_COUNT];
- u16 di_state;
- u16 do_state;
- u32 flags[2];
- };
- struct swaplink_sensor_configStruct
- {
- u32 isEn : 1;
- u32 isCustom : 1;
- u32 config : 30;
- char customShortName[24];
- u8 analogTableID;
- u8 inputDataSource;
- u8 inputSourceIndex;
- u8 reserve;
- int32_t minPossibleValue;
- int32_t maxPossibleValue;
- int32_t offset;
- int32_t multiplyer;
- int32_t divider;
- u32 reserved[12];
- };
- struct swaplink_tmp_settingsStruct
- {
- u32 marker;
- u32 is_fuel_level_inverse : 1;
- u32 div_mode : 8;
- u32 reserve23 : 23;
- float div_coeff;
- u32 fuelLevelTable[3][2];
- u32 crc;
- };
- struct swaplink_pwm_outputs_struct
- {
- char name[32];
- u16 period_ms;
- u8 minDuty;
- u8 maxDuty;
- u8 isEn : 1;
- u8 isFan : 1;
- u8 isRpm : 1;
- u8 isFunc : 1;
- u8 config : 4;
- u8 func_id;
- u8 analog_table_id;
- u8 reserve8;
- u32 coeff;
- u32 reserve;
- };
- struct swaplink_di_settings_struct
- {
- u8 is_pull_up : 1;
- u8 is_pull_down : 1;
- u8 is_inverse : 1;
- u8 reserve : 5;
- };
- struct swaplink_flag_or_do_settings_struct
- {
- u8 is_invert : 1;
- u8 inChannelType : 7;
- u8 inChannel;
- };
- struct swaplink_settingsStruct
- {
- u32 crc;
- u16 settings_ver : 2;
- u16 is_fuel_level_inverse : 1;
- u16 reserve10 : 13;
- u8 reserve8;
- u8 div_mode;
- u32 fuelLevelTable[3][2];
- float div_coeff;
- u16 ecu;
- u16 dash;
- u16 chassis;
- struct swaplink_fan_settings_struct fan_settings[3];
- struct swaplink_di_settings_struct di_settings[32];
- struct swaplink_flag_or_do_settings_struct do_settings[32];
- struct swaplink_flag_or_do_settings_struct flags_settings[FLAGS_COUNT];
- struct theCustomAnalogSensor analogTables[8];
- struct swaplink_pwm_outputs_struct pwm_outputs[8];
- struct swaplink_sensor_configStruct sensor_config[MAX_SENSORS_COUNT];
- // u8 reserveEnd[50 * 1024];
- };
- struct dio_pins_struct
- {
- GPIO_TypeDef *port;
- uint8_t pinNum;
- uint16_t pinMask;
- };
- struct pwm_pins_struct
- {
- GPIO_TypeDef *port;
- uint8_t pinNum;
- uint16_t pinMask;
- __IO uint32_t *arr;
- __IO uint32_t *ccr;
- };
- struct basic_dashboard_struct
- {
- const u8 ids_list[32];
- const u8 data[32];
- const u32 ids_count : 6;
- const u32 isMpx : 1;
- const u32 isCan : 1;
- const u32 rpm_coeff : 16;
- const u32 reserve : 8;
- const dash_tx tx_func;
- };
- typedef struct basic_dashboard_struct *dash;
- struct swaplink_adc_struct
- {
- uint16_t cruise_adc;
- uint16_t vresistor_adc;
- uint16_t fuel_adc;
- uint16_t sensor5v_adc;
- uint16_t vref;
- };
- #endif // !SWAPLINK_STRUCTS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement