source: trunk/firmware/CubeMX/Inc/sysdata.h@ 8

Last change on this file since 8 was 1, checked in by f.jahn, 3 years ago
File size: 4.8 KB
Line 
1#ifndef __SYSDATA_H
2#define __SYSDATA_H
3
4typedef union
5{
6 uint16_t w;
7 int16_t sw;
8 uint8_t b[2];
9 int8_t sb[2];
10} bword_t;
11
12typedef struct __attribute__((packed))
13{
14 //STATISCHE GERÄTE INFORMATIONEN
15 //---- GERÄTE INFORMATIONEN ---
16 uint16_t device_type_id; // 0
17 uint16_t fw_major; // 1
18 uint16_t fw_minor; // 2
19 uint16_t fw_revision; // 3
20 uint32_t device_sn; // 4,5
21 uint16_t reserved0[4]; // 6-9 --- Reserved for 96bit STM32 UID
22 uint16_t reserved1; // 10
23
24 //--- GERÄTE PARAMETER ALLGEMEIN ---
25 uint32_t baudrate; // 11,12
26 uint16_t parity_mode; // 13
27 uint16_t stopBits; // 14 Aktuell nicht ausgewert, automatische Auswahl nach Modbus standard abhängig vom Parity Mode
28 uint16_t slave_address; // 15
29 uint16_t command; // 16
30 uint16_t reserved2[3]; // 17-19
31
32 //--- GERÄTE PARAMETER GERÄTE SPEZIFISCH ---
33 uint16_t temperature_shutdown; // 20
34 uint16_t dip_mode; // 21
35 uint16_t user_button_mode; // 22
36 int32_t ursense_voltage_shutdown_min; // 23,24
37 int32_t ursense_voltage_shutdown_max; // 25,26
38 int16_t ursense_volt_correct; // 27
39 int16_t ba_resistence; // 28
40 int16_t ab_middle_point_offset; // 29
41 uint16_t copper_v_drop; // 30
42 uint16_t copper_v_drop_adc; // 31
43 int16_t copper_v_drop_adc_limit; // 32
44 uint16_t shortcut_current_in_mV; // 33
45 uint16_t inrush_max_current_in_mV; // 34
46 uint16_t inrush_max_current_in_adc; // 35
47 uint16_t inrush_curr_period; // 36
48 uint16_t inrush_curr_integral_steps; // 37
49 uint16_t i_plus_offset; // 38
50 uint16_t i_minus_offset; // 39
51 uint16_t writeLocked; // 40 1= (Einige) Register sind geschützt, 0 = Kein Schutz vorhanden
52 uint16_t keyAccepted; // 41 1= lockKey is correct, gesperrte Register sind freigegeben zum beschreiben
53 uint16_t lockKey; // 42 EINGABE ENTSPERR CODE
54 uint16_t newLockKey; // 43 EINGABE NEUER Sperrcode
55 uint16_t reserved3[56]; // 44-99
56
57 // --- AKTUELLE DATEN ab Adresse 100 ---
58 uint16_t lvp_state; // 100
59 uint16_t ovp_state; // 101
60 uint16_t ubsensea_voltage; // 102
61 uint16_t min_ubsensea_voltage; // 103
62 uint16_t max_ubsensea_voltage; // 104
63 uint16_t ubsenseb_voltage; // 105
64 uint16_t min_ubsenseb_voltage; // 106
65 uint16_t max_ubsenseb_voltage; // 107
66 int16_t ursense_voltage; // 108
67 uint16_t min_charge_ursense_voltage; // 109
68 uint16_t max_charge_ursense_voltage; // 110
69 uint16_t min_discharge_ursense_voltage; // 111
70 uint16_t max_discharge_ursense_voltage; // 112
71 int16_t temperature; // 113
72 int16_t min_temperature; // 114
73 int16_t max_temperature; // 115
74 int16_t ab_raw_adc_value_with_offset; // 116
75 uint16_t relay_status; // 117
76 int16_t current; // 118
77 uint16_t min_charge_current; // 119
78 uint16_t max_charge_current; // 120
79 uint16_t min_discharge_current; // 121
80 uint16_t max_discharge_current; // 122
81 uint16_t device_status; // 123
82 int16_t adc_plus_current_sensor; // 124
83 int16_t adc_minus_current_sensor; // 125
84 int16_t ubbsense_voltage; // 126
85 uint16_t heater_status; // 127
86
87 // Counters
88 uint16_t startup_cnt; // 128
89 uint16_t overtemp_error_cnt; // 129
90 uint16_t overcurrent_error_cnt; // 130
91 uint16_t lowbat_error_cnt; // 131
92 uint16_t lvp_cnt; // 132
93 uint16_t ovp_cnt; // 133
94 uint16_t switch_cnt; // 134
95 uint16_t mosfets_voltagedrop_error_cnt; // 135
96 uint16_t overload_error_cnt; // 136
97 uint16_t last_shortcut_during_charge; // 137
98 uint16_t last_shortcut_during_discharge; // 138
99
100} sys_data_struct_t;
101
102// This union maps
103typedef union sys_data_union
104{
105 sys_data_struct_t s;
106 bword_t mb[sizeof(sys_data_struct_t)/2];
107} sys_data_t;
108
109#endif
Note: See TracBrowser for help on using the repository browser.