-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapi.json
285 lines (285 loc) · 11.8 KB
/
api.json
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
[
{
"name": "IOIO":
"comment": "This interface provides control over all the IOIO board functions.",
"methods": [
{
"name": "beginBatch"
"rtn": "void",
"arg": "void",
"comment" : "Start a batch of operations. This is strictly an optimization and will not change functionality."
},{
"name": "disconnect"
"rtn": "void",
"arg": "void",
"comment" : "Closes the connection to the board, or aborts a connection process started with waitForConnect()."
},{
"name": "endBatch"
"rtn": "void",
"arg": "void",
"comment" : "End a batch of operations."
},{
"name": "hardReset"
"rtn": "void",
"arg": "void",
"comment" : "Equivalent to disconnecting and reconnecting the board power supply."
},{
"name": "softReset"
"rtn": "void",
"arg": "void",
"comment" : "Resets the entire state (returning to initial state), without dropping the connection."
},{
"name": "sync"
"rtn": "void",
"arg": "void",
"comment" : "Sends a message to the IOIO and waits for an echo."
},{
"name": "waitForConnect"
"rtn": "void",
"arg": "void",
"comment": "Establishes connection with the IOIO board."
},{
"name": "waitForDisconnect"
"rtn": "void",
"arg": "void",
"comment" : "Blocks until IOIO has been disconnected and all connection-related resources have been freed, so that a new connection can be attempted."
}
]
},
{
"name": "AnalogInput",
"comment": "This interface represents AnalogInput functionality, providing methods to obtain analog input readings and buffered samples.",
"methods": [
{
"name": "getVoltage",
"rtn": "float",
"arg": "void",
"comment": "Gets the analog input reading, as an absolute voltage in Volt units."
},
{
"name": "getVoltageSync",
"rtn": "float",
"arg": "void",
"comment": "This is very similar to getVoltage(), but will wait for a new sample to arrive before returning."
},
{
"name": "getReference",
"rtn": "float",
"arg": "void",
"comment": "Gets the maximum value against which read() values are scaled."
},
{
"name": "read",
"rtn": "float",
"arg": "void",
"comment": "Gets the analog input reading, as a scaled real value between 0 and 1."
},
{
"name": "readSync",
"rtn": "float",
"arg": "void",
"comment": "This is very similar to read(), but will wait for a new sample to arrive before returning."
},
{
"name": "getOverflowCount",
"rtn": "int",
"arg": "void",
"comment": "Gets the number of samples that have been dropped as a result of overflow."
},
{
"name": "available",
"rtn": "int",
"arg": "void",
"comment": "Gets the number of samples currently in the buffer. Reading that many samples is guaranteed not to block."
},
{
"name": "readBuffered",
"rtn": "float",
"arg": "void",
"comment": "Read a sample from the internal buffer. This method will block until at least one sample is available."
},
{
"name": "getVoltageBuffered",
"rtn": "float",
"arg": "void",
"comment": "Read a sample from the internal buffer. This method will block until at least one sample is available."
},
{
"name": "getSampleRate",
"rtn": "float",
"arg": "void",
"comment": "Gets the sample rate used for obtaining buffered samples."
}
]
},
{
"name": "PulseInput",
"comment": "This interface represents PulseInput functionality, providing methods for pulse and frequency measurements.",
"methods": [
{
"name": "getDuration",
"rtn": "float",
"arg": "void",
"comment": "Gets the pulse duration in case of pulse measurement mode, or the period in case of frequency mode."
},
{
"name": "getDurationSync",
"rtn": "float",
"arg": "void",
"comment": "This is very similar to getDuration(), but will wait for a new sample to arrive before returning."
},
{
"name": "getDurationBuffered",
"rtn": "float",
"arg": "void",
"comment": "Reads a single measurement from the queue. If the queue is empty, will block until more data arrives."
},
{
"name": "getFrequency",
"rtn": "float",
"arg": "void",
"comment": "Gets the momentary frequency of the measured signal. When scaling is used, this is compensated for here."
},
{
"name": "getFrequencySync",
"rtn": "float",
"arg": "void",
"comment": "This is very similar to getFrequency(), but will wait for a new sample to arrive before returning."
}
]
},
{
"name": "DigitalInput",
"comment": "This interface represents DigitalInput functionality, providing methods to read digital input pin values and wait for specific logical levels.",
"methods": [
{
"name": "read",
"rtn": "boolean",
"arg": "void",
"comment": "Read the value sensed on the pin. May block for a few milliseconds if called right after creation of the instance."
},
{
"name": "waitForValue",
"rtn": "void",
"arg": "boolean",
"comment": "Block until a desired logical level is sensed. The calling thread can be interrupted for aborting this operation."
}
]
},
{
"name": "CapSense",
"comment": "This interface represents the CapSense functionality, allowing capacitance readings and threshold-based operations.",
"methods": [
{
"name": "read",
"rtn": "float",
"arg": "void",
"comment": "Gets the capacitance reading. It typically takes a few milliseconds."
},
{
"name": "readSync",
"rtn": "float",
"arg": "void",
"comment": "This is very similar to read(), but will wait for a new sample to arrive before returning."
},
{
"name": "setFilterCoef",
"rtn": "void",
"arg": "float",
"comment": "Sets the low-pass filter coefficient. This coefficient is the typical time constant of the system."
},
{
"name": "waitOver",
"rtn": "void",
"arg": "float",
"comment": "Block until sensed capacitance becomes greater than a given threshold."
},
{
"name": "waitOverSync",
"rtn": "void",
"arg": "float",
"comment": "This is very similar to waitOver(float), but will wait for a new sample to arrive before returning."
},
{
"name": "waitUnder",
"rtn": "void",
"arg": "float",
"comment": "Block until sensed capacitance becomes less than a given threshold."
},
{
"name": "waitUnderSync",
"rtn": "void",
"arg": "float",
"comment": "This is very similar to waitUnder(float), but will wait for a new sample to arrive before returning."
}
]
},
{
"name": "DigitalOutput",
"comment": "A pin used for digital output. A digital output pin can be used to generate logic-level signals. DigitalOutput instances are obtained by calling IOIO#openDigitalOutput. The value of the pin is set by calling write. The instance is alive since its creation. If the connection with the IOIO drops at any point, the instance transitions to a disconnected state, in which every attempt to use the pin (except close()) will throw a ConnectionLostException. Whenever close() is invoked the instance may no longer be used. Any resources associated with it are freed and can be reused. Typical usage:",
"methods": [
{
"name": "write",
"rtn": "void",
"arg": "boolean",
"comment": "The output. true is logical \"HIGH\", false is logical \"LOW\"."
}
]
},
{
"name": "PwmOutput",
"comment": "A pin used for PWM (Pulse-Width Modulation) output. A PWM pin produces a logic-level PWM signal. These signals are typically used for simulating analog outputs for controlling the intensity of LEDs, the rotation speed of motors, etc. They are also frequently used for controlling hobby servo motors. PwmOutput instances are obtained by calling IOIO#openPwmOutput. When used for motors and LEDs, a frequency of several KHz is typically used, where there is a trade-off between switching power-loses and smoothness of operation. The pulse width is typically set by specifying the duty cycle, with the setDutyCycle method. A duty cycle of 0 is \"off\", a duty cycle of 1 is \"on\", and every intermediate value produces an intermediate intensity. Please note that any devices consuming more than 20mA of current (e.g. motors) should not by directly connected the the IOIO pins, but rather through an amplification circuit suited for the specific load. When used for hobby servos, the PWM signal is rather used for encoding of the desired angle the motor should go to. By standard, a 100Hz signal is used and the pulse width is varied between 1ms and 2ms (corresponding to both extremes of the shaft angle), using setPulseWidth. The instance is alive since its creation. If the connection with the IOIO drops at any point, the instance transitions to a disconnected state, in which every attempt to use the pin (except close()) will throw a ConnectionLostException. Whenever close() is invoked the instance may no longer be used. Any resources associated with it are freed and can be reused. Typical usage (fading LED):",
"signature": "pin, frequency",
"pins": 2,
"methods": [
{
"name": "setDutyCycle",
"rtn": "void",
"arg": "float",
"comment": "Sets the duty cycle of the PWM output. The duty cycle is defined to be the pulse width divided by the total cycle period. For absolute control of the pulse with, consider using setPulseWidth."
},
{
"name": "setPulseWidth",
"rtn": "void",
"arg": "float",
"comment": "Sets the pulse width of the PWM output. The pulse width is duration of the high-time within a single period of the signal. For relative control of the pulse with, consider using setDutyCycle."
}
]
},
{
"name": "TwiMaster":
"comment": "An interface for controlling a TWI (Two Wire Interface) module, in TWI bus-master mode, enabling communication with multiple TWI-enabled slave modules.",
"signature": "TWINumber, mode",
"nogen" : true,
"pins": 2,
"methods": [{
"name": "write",
"rtn": "void",
"signature": "Address, Register, DataBytes",
"comment": "Writes one or more bytes of data to the given register of an I2C device with given address."
},{
"name": "readWrite",
"rtn": "int",
"signature": "address, NumReceiveBytes, Register, DataBytes",
"comment": "Writes one or more bytes of data to the given register of an I2C device with given address and reads NumReceiveBytes. NumReceiveBytes can be max 8 bytes long."
}]
},
{
"name": "SpiMaster":
"comment": "An interface for controlling an SPI (Serial Peripheral Interface) module, in SPI bus-master mode, enabling communication with multiple SPI-enabled slave modules",
"nogen" : true,
"signature": "misoPin, mosiPin, clkPin, csPin",
"pins": 4,
"methods": [{
"name": "write",
"rtn": "void",
"signature": "DataBytes",
"comment": "Writes one or more bytes of data."
},{
"name": "readWrite",
"rtn": "int",
"signature": "NumReceiveBytes, DataBytes",
"comment": "Writes one or more bytes of data and reads NumReceiveBytes. NumReceiveBytes can be max 8 bytes long."
}]
}
]