-
Notifications
You must be signed in to change notification settings - Fork 14
/
libwidgetlords.vapi
154 lines (118 loc) · 4.68 KB
/
libwidgetlords.vapi
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
[CCode (cheader_filename = "widgetlords.h")]
namespace WidgetLords
{
public const uint8 DIR_RS485;
namespace PiSpi
{
[CCode (cname = "pi_spi_init")]
void init();
[CCode (cname = "pi_spi_2ao_write_single")]
void write_single_2ao(uint8 channel, uint16 counts, bool optional = false);
[CCode (cname = "pi_spi_8ai_read_single")]
void read_single_8ai(uint8 channel, bool optional = false);
[CCode (cname = "pi_spi_8di_read")]
uint8 read_8di(uint8 address, bool optional = false);
[CCode (cname = "pi_spi_8di_read_single")]
uint8 read_single_8di(uint8 address, uint8 channel, bool optional = false);
[CCode (cname = "pi_spi_8di_init")]
void init_8di(uint8 address, bool optional = false);
[CCode (cname = "pi_spi_8ko_write")]
void write_8ko(uint8 data, bool optional = false);
[CCode (cname = "pi_spi_8ko_write_single")]
void write_single_8ko(uint8 channel, uint8 data, bool optional = false);
}
namespace PiSpiDin
{
[CCode (cname = "enum chip_enable", cprefix = "", has_type_id = false)]
public enum ChipEnable
{
CE0,
CE1,
CE2,
CE3,
CE4
}
[CCode (cname = "pi_spi_din_init")]
void init();
[CCode (cname = "pi_spi_din_4ao_init")]
void init_4ao();
[CCode (cname = "pi_spi_din_4ao_write_single")]
void write_single_4ao(uint8 channel, uint16 counts);
[CCode (cname = "pi_spi_din_8ai_read_single")]
uint16 read_single_8ai(ChipEnable ce, uint8 channel);
[CCode (cname = "pi_spi_din_8di_read")]
uint8 read_8di(ChipEnable ce, uint8 address);
[CCode (cname = "pi_spi_din_8di_read_single")]
uint8 read_single_8di(ChipEnable ce, uint8 address, uint8 channel);
[CCode (cname = "pi_spi_din_8di_init")]
void init_8di(ChipEnable ce, uint8 address);
[CCode (cname = "pi_spi_din_4ko_write")]
void write_4ko(ChipEnable ce, uint8 address, uint8 state);
[CCode (cname = "pi_spi_din_4ko_write_single")]
void write_single_4ko(ChipEnable ce, uint8 address, uint8 channel, uint8 state);
[CCode (cname = "pi_spi_din_4ko_init")]
void init_4ko(ChipEnable ce, uint8 address);
[CCode (cname = "vpe_2901a_init")]
void vpe_2901a_init();
[CCode (cname = "vpe_2901a_2ao_write_single")]
void vpe_2901a_2ao_write_single(uint8 channel, uint16 counts);
[CCode (cname = "vpe_2901a_2ko_write_single")]
void vpe_2901a_2ko_write_single(uint8 channel, uint8 value);
[CCode (cname = "vpe_2901a_2di_read_single")]
uint8 vpe_2901a_2di_read_single(uint8 channel);
[CCode (cname = "VPE_2901A_SDAFE_1")]
public const uint8 VPE_2901A_SDAFE_1;
[CCode (cname = "VPE_2901A_SDAFE_2")]
public const uint8 VPE_2901A_SDAFE_2;
[CCode (cname = "vpe_3011b_init")]
void vpe_3011b_init();
[CCode (cname = "vpe_3011b_4ko_write_single")]
void vpe_3011b_4ko_write_single(uint8 channel, uint8 value);
[CCode (cname = "vpe_3011b_8di_read")]
uint8 vpe_3011b_8di_read();
[CCode (cname = "vpe_3011b_8di_read_single")]
uint8 vpe_3011b_8di_read_single(uint8 channel);
[CCode (cname = "VPE_3011B_SDAFE_1")]
public const uint8 VPE_3011B_SDAFE_1;
[CCode (cname = "VPE_3011B_SDAFE_2")]
public const uint8 VPE_3011B_SDAFE_2;
[CCode (cname = "VPE_3011B_SDAFE_3")]
public const uint8 VPE_3011B_SDAFE_3;
[CCode (cname = "VPE_3011B_SDAFE_4")]
public const uint8 VPE_3011B_SDAFE_4;
//--------------------------------SDAFE---------------------------------
[CCode (cname = "enum sdafe_type", cprefix = "", has_type_id = false)]
public enum SdafeType
{
TYPE_1_MA, // Input 0 to 20 mA, Returns 0 to 20000, Scaler 1000
TYPE_2_MA, // Input 0 to 20 mA, Returns 0 to 10000, Scaler 100
TYPE_3_MA, // Input 4 to 20 mA, Returns 0 to 10000, Scaler 100 Note: Readings below 4 mA return as 0
TYPE_4_5VDC, // Input 0 to 5 VDC, Returns 0 to 5000, Scaler 1000
TYPE_5_5VDC, // Input 0 to 5 VDC, Returns 0 to 10000, Scaler 100
TYPE_6_5VDC, // Input 1 to 5 VDC, Returns 0 to 10000, Scaler 100 Note: Readngs beluw 1 VDC return as 0
TYPE_7_10VDC, // Input 0 to 10 VDC, Returns 0 to 10000, Scaler 1000
TYPE_8_10VDC, // Input 0 to 10 VDC, Returns 0 to 10000, Scaler 100
TYPE_9_10VDC // Input 2 to 10 VDC, Returns 0 to 10000, Scaler 100 Note: Readings below 2 VDC return as 0
}
[CCode (cname = "enum sdafe_status", cprefix = "SDAFE_", has_type_id = false)]
public enum SdafeStatus
{
OK,
POLARITY,
OVER_RANGE,
COMM_ERROR
}
[CCode (cname = "struct sdafe_reading", destroy_function = "", has_type_id = false)]
public struct SdafeReading
{
uint16 value;
SdafeStatus status;
uint16 counts;
SdafeType type;
}
[CCode (cname = "sdafe_set_type")]
void sdafe_set_type(uint8 channel, SdafeType type);
[CCode (cname = "sdafe_read")]
SdafeReading sdafe_read(uint8 channel);
}
}