-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.h
233 lines (182 loc) · 4.64 KB
/
User.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/* Microchip Technology Inc. and its subsidiaries. You may use this software
* and any derivatives exclusively with Microchip products.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
* WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
* BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
* IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
* ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
* TERMS.
*/
/*
* File:
* Author:
* Comments:
* Revision history:
*/
// This is a guard condition so that contents of this file are not included
// more than once.
#ifndef XC_USER_H
#define XC_USER_H
#include "SES.h"
#define ADD_START_SETUP 1000
#define ADD_BEGIN_ID_TEMPERATURE (ADD_START_SETUP + 100)
#define VAL_STATUS_EEPROM_YET 111
#define MAX_DEVICE 10
#define MAX_CONTROL_IO 1
#define MAX_INVERTER 5
#define MAX_STRCOMBINER 5
#define MAX_PANEL 5
#define MAX_WEATHER 1
#define MAX_MODULE 12
#define MAX_FRAME 5
enum MODBUS_TYPE
{
MODBUS_RTU = 1,
MODBUS_TCP
};
union data{
int8_t val[2];
int16_t val16;
};
typedef struct
{
STATUS Connected;
STATUS Coils;
// STATUS Input_Decrete;
// uint16_t HOLDING_REGS[300];
// uint16_t INPUT_REGS[10];
uint16_t SETUP_REGS[400];
} DATA_42;
extern DATA_42 SES_42;
typedef struct
{
UINT16 HW_Version[4];
UINT16 SW_Version[4];
} Device_Git;
extern Device_Git Device_Version;
//typedef struct
//{
// uint8_t IP[4];
// uint8_t ID;
// UINT8 IID;
//} METER;
//typedef struct
//{
// UINT8 IP[4];
// UINT8 Num_Meter;
// UINT8 Status;
//
//} _INTERFACE;
typedef struct
{
uint8_t UID;
uint16_t SID;
uint8_t Dev_type;
uint8_t Series;
uint8_t Func;
uint8_t NumFr;
FRAME Fr[MAX_FRAME];
uint8_t EN;
} DEVICE_INFOR;
typedef struct
{
uint8_t UID;
uint16_t SID;
uint32_t IP;
uint8_t Dev_type;
uint8_t Series;
uint8_t Func;
uint8_t NumFr;
FRAME Fr[50];
uint8_t EN;
} DEVICE_CTRL_INFOR;
typedef struct
{
DEVICE_INFOR Dev_Setup;
UINT8 Status;
} _DEVICE_RTU;
typedef struct
{
UINT8 IP[4];
DEVICE_INFOR Dev_Setup;
UINT8 Status;
}_DEVICE_TCP;
typedef struct
{
UINT8 IP[4];
union data PORT;
UINT8 Status;
}SERVER_LOCAL;
typedef struct
{
UINT8 IP_Cloud[4];
union data PORT;
UINT8 Status;
}SERVER_CLOUD;
typedef struct
{
UINT8 IP[4];
UINT8 MAC[6];
UINT8 SubnetMask[4];
UINT8 Gateway[4];
UINT8 DNS[4];
SERVER_LOCAL LOCAL_SERVER;
SERVER_CLOUD CLOUD_SERVER;
UINT8 Num_inverter;
UINT8 Num_panel;
UINT8 Num_str_combiner;
UINT8 Num_control_io;
UINT8 Num_weather;
UINT8 Num_Dev_rtu;
UINT8 Num_Dev_tcp;
_DEVICE_TCP Dev_tcp[MAX_DEVICE];
_DEVICE_RTU Dev_rtu[MAX_DEVICE];
}Gateway_setup;
extern Gateway_setup G42, WEEROM42;
extern UINT64 *Status_Meter;
void Read_G42_Setup(void);
void G42_Add_Setup(void);
void Check_Save_DataSetup(void);
void Write_WEEROM42(void);
void Information_Device(void);
uint32_t convert16to32(uint16_t h, uint16_t l);
//void READ_MY_IP(void);
//void WRITE_MY_IP(uint32_t address,void* data, uint16_t count);
// TODO Insert appropriate #include <>
// TODO Insert C++ class definitions if appropriate
// TODO Insert declarations
// Comment a function and leverage automatic documentation with slash star star
/**
<p><b>Function prototype:</b></p>
<p><b>Summary:</b></p>
<p><b>Description:</b></p>
<p><b>Precondition:</b></p>
<p><b>Parameters:</b></p>
<p><b>Returns:</b></p>
<p><b>Example:</b></p>
<code>
</code>
<p><b>Remarks:</b></p>
*/
// TODO Insert declarations or function prototypes (right here) to leverage
// live documentation
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
// TODO If C++ is being used, regular C code needs function names to have C
// linkage so the functions can be used by the c code.
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* XC_HEADER_TEMPLATE_H */