forked from thestealth131205/vfdmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structures.h
118 lines (101 loc) · 2.61 KB
/
structures.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
#ifndef STRUCTURES_H
#define STRUCTURES_H
/* Required by hal.h */
#define ULAPI
#include <hal.h>
#include <QVector>
/*** INI STRUCTURES ***/
/* Common settings */
typedef struct {
QString componentName;
int maxSpeedRpm;
int minSpeedRpm;
double atSpeedThreshold;
} common_config_t;
/* Communication settings */
typedef struct {
int slaveAddress;
QString serialDevice;
int baudRate;
int dataBits;
QString parity;
int stopBits;
// Delay in milliseconds after all user parameters have been transferred, 100...200 ms should be fine.
int loopDelay;
// Delay in characters at beginning of every Modbus request. Modbus RTU specification recommends
// at least 3.5 characters, so minimum value must be 4.
int protocolDelay;
// How many successfull Modbus requests should be completed to set HAL isConnected pin.
int isConnectedDelay;
// Delay in millisecods before reconnection attempt.
int connectionDelay;
// Error codes what call reconnection attempt.
QVector<int> criticalErrors;
} rs485_config_t;
/* Spindle control settings */
typedef struct {
int functionCode;
int address;
int runFwdValue;
int runRevValue;
int stopValue;
int faultResetValue;
int runCoil;
int directionCoil;
int faultResetCoil;
} control_config_t;
/* Spindle IN settings */
typedef struct {
int functionCode;
int address;
int multiplier;
int divider;
} spindle_in_config_t;
/* Spindle OUT settings */
typedef struct {
int address;
int multiplier;
int divider;
} spindle_out_config_t;
/* Main INI-file settings */
typedef struct {
common_config_t common;
rs485_config_t rs485;
control_config_t control;
spindle_in_config_t rpmIn;
spindle_out_config_t rpmOut;
} main_config_t;
/* User parameter structure */
typedef struct {
QString groupName;
int functionCode;
int address;
int multiplier;
int divider;
int bitMask;
hal_type_t pinType;
QString pinName;
} user_config_t;
/*** HAL STRUCTURES ***/
typedef struct {
/* Communication pins */
hal_bit_t *isConnected;
hal_s32_t *errorCount;
hal_s32_t *lastError;
/* Spindle control pins */
hal_bit_t *runForward;
hal_bit_t *runReverse;
hal_bit_t *faultReset;
hal_bit_t *atSpeed;
hal_float_t *spindleRpmIn;
hal_float_t *spindleRpmOut;
} hal_main_data_t;
/* Three type of data for an each user parameter */
typedef struct {
hal_u32_t *u32Pin;
hal_s32_t *s32Pin;
hal_float_t *floatPin;
hal_bit_t *bitPin;
hal_bit_t *bitNotPin;
} hal_user_data_t;
#endif // STRUCTURES_H