1
This directory contains files for building a Ruby extension library
4
Instructions for building by hand (you shouldn't need to do this):
6
1. Type 'ruby setup.rb config'. This configures for the local
9
2. Type 'ruby setup.rb setup'. This builds the extension library.
11
3. Type 'ruby setup.rb install'. This installs the extension
12
library and the file lib/comedi.rb, which provides more
13
Ruby-like method syntax.
15
The file 'lib/comedi.rb' provides syntactic sugar in four forms:
17
1. Method names without the 'comedi_' prefix. The Comedi module
18
disambiguates the namespace. For example, you can say
19
'dev = Comedi::open()' instead of 'dev = Comedi::comedi_open()'.
21
2. Instance methods that take an explicit receiver instead of
22
expecting the target object as an initial argument. For example:
23
'comedi_close(dev)' can be written as 'dev.close'.
25
3. A pre-defined IO object and an accessor method to simplify
26
reading from the file descriptor associated with the comedi device.
27
Data from comedi device 'dev' can be read by 'dev.ios.read'.
29
4. A ComediError exception class. If the underlying comedi
30
function returns an error indication, the ruby method will raise
31
ComediError. If the comedi function returns both a status and a
32
value (e.g., comedi_data_read), the status is not returned by the
33
ruby method unless it carries information in addition to indication
34
of failure (e.g., comedi_command_test).
36
5. Ruby booleans. Comedi functions that return C integer boolean values
37
(comedi_range_is_chan_specific, comedi_maxdata_is_chan_specific)
38
have corresponding boolean ruby methods with '?' appended to the
41
Files in 'demo' are straight ports of their C counterparts from the
42
Comedilib 'demo' directory. They illustrate the basics of programming
43
Comedi commands using Ruby.
45
For completeness, the set of method definitions invoked by 'comedi.rb'
51
value = comedi_open(*args)
52
raise ComediError.new if value.nil?
58
def parse_calibration_file(*args)
59
value = comedi_parse_calibration_file(*args)
60
raise ComediError.new if value.nil?
67
value = comedi_loglevel(*args)
74
value = comedi_perror(*args)
81
value = comedi_strerrno(*args)
88
value = comedi_errno(*args)
95
value = comedi_to_phys(*args)
102
value = comedi_from_phys(*args)
108
def set_global_oor_behavior(*args)
109
value = comedi_set_global_oor_behavior(*args)
113
# Module: SWIG::TYPE_p_comedi_t
116
value = comedi_close(self, *args)
117
raise ComediError.new if value == -1
121
# Module: SWIG::TYPE_p_comedi_t
124
value = comedi_fileno(self, *args)
125
raise ComediError.new if value == -1
129
# Module: SWIG::TYPE_p_comedi_t
131
def get_subdevice_type(*args)
132
value = comedi_get_subdevice_type(self, *args)
133
raise ComediError.new if value == -1
137
# Module: SWIG::TYPE_p_comedi_t
139
def find_subdevice_by_type(*args)
140
value = comedi_find_subdevice_by_type(self, *args)
141
raise ComediError.new if value == -1
145
# Module: SWIG::TYPE_p_comedi_t
147
def get_read_subdevice(*args)
148
value = comedi_get_read_subdevice(self, *args)
149
raise ComediError.new if value == -1
153
# Module: SWIG::TYPE_p_comedi_t
155
def get_write_device(*args)
156
value = comedi_get_write_device(self, *args)
157
raise ComediError.new if value == -1
161
# Module: SWIG::TYPE_p_comedi_t
163
def get_subdevice_flags(*args)
164
value = comedi_get_subdevice_flags(self, *args)
165
raise ComediError.new if value == -1
169
# Module: SWIG::TYPE_p_comedi_t
171
def get_n_channels(*args)
172
value = comedi_get_n_channels(self, *args)
173
raise ComediError.new if value == -1
177
# Module: SWIG::TYPE_p_comedi_t
179
def range_is_chan_specific?(*args)
180
value = comedi_range_is_chan_specific(self, *args)
181
raise ComediError.new if value == -1
185
# Module: SWIG::TYPE_p_comedi_t
187
def maxdata_is_chan_specific?(*args)
188
value = comedi_maxdata_is_chan_specific(self, *args)
189
raise ComediError.new if value == -1
193
# Module: SWIG::TYPE_p_comedi_t
195
def get_n_ranges(*args)
196
value = comedi_get_n_ranges(self, *args)
197
raise ComediError.new if value == -1
201
# Module: SWIG::TYPE_p_comedi_t
203
def find_range(*args)
204
value = comedi_find_range(self, *args)
205
raise ComediError.new if value == -1
209
# Module: SWIG::TYPE_p_comedi_t
211
def get_buffer_size(*args)
212
value = comedi_get_buffer_size(self, *args)
213
raise ComediError.new if value == -1
217
# Module: SWIG::TYPE_p_comedi_t
219
def get_max_buffer_size(*args)
220
value = comedi_get_max_buffer_size(self, *args)
221
raise ComediError.new if value == -1
225
# Module: SWIG::TYPE_p_comedi_t
227
def set_buffer_size(*args)
228
value = comedi_set_buffer_size(self, *args)
229
raise ComediError.new if value == -1
233
# Module: SWIG::TYPE_p_comedi_t
236
value = comedi_trigger(self, *args)
237
raise ComediError.new if value == -1
241
# Module: SWIG::TYPE_p_comedi_t
243
def do_insnlist(*args)
244
value = comedi_do_insnlist(self, *args)
245
raise ComediError.new if value == -1
249
# Module: SWIG::TYPE_p_comedi_t
252
value = comedi_do_insn(self, *args)
253
raise ComediError.new if value == -1
257
# Module: SWIG::TYPE_p_comedi_t
260
value = comedi_lock(self, *args)
261
raise ComediError.new if value == -1
265
# Module: SWIG::TYPE_p_comedi_t
268
value = comedi_unlock(self, *args)
269
raise ComediError.new if value == -1
273
# Module: SWIG::TYPE_p_comedi_t
275
def data_read_hint(*args)
276
value = comedi_data_read_hint(self, *args)
277
raise ComediError.new if value == -1
281
# Module: SWIG::TYPE_p_comedi_t
283
def data_write(*args)
284
value = comedi_data_write(self, *args)
285
raise ComediError.new if value == -1
289
# Module: SWIG::TYPE_p_comedi_t
291
def dio_config(*args)
292
value = comedi_dio_config(self, *args)
293
raise ComediError.new if value == -1
297
# Module: SWIG::TYPE_p_comedi_t
300
value = comedi_dio_write(self, *args)
301
raise ComediError.new if value == -1
305
# Module: SWIG::TYPE_p_comedi_t
308
value = comedi_cancel(self, *args)
309
raise ComediError.new if value == -1
313
# Module: SWIG::TYPE_p_comedi_t
316
value = comedi_command(self, *args)
317
raise ComediError.new if value == -1
321
# Module: SWIG::TYPE_p_comedi_t
324
value = comedi_poll(self, *args)
325
raise ComediError.new if value == -1
329
# Module: SWIG::TYPE_p_comedi_t
331
def set_max_buffer_size(*args)
332
value = comedi_set_max_buffer_size(self, *args)
333
raise ComediError.new if value == -1
337
# Module: SWIG::TYPE_p_comedi_t
339
def get_buffer_contents(*args)
340
value = comedi_get_buffer_contents(self, *args)
341
raise ComediError.new if value == -1
345
# Module: SWIG::TYPE_p_comedi_t
347
def mark_buffer_read(*args)
348
value = comedi_mark_buffer_read(self, *args)
349
raise ComediError.new if value == -1
353
# Module: SWIG::TYPE_p_comedi_t
355
def get_buffer_offset(*args)
356
value = comedi_get_buffer_offset(self, *args)
357
raise ComediError.new if value == -1
361
# Module: SWIG::TYPE_p_comedi_t
364
status, value = comedi_data_read(self, *args)
365
raise ComediError.new if status == -1
369
# Module: SWIG::TYPE_p_comedi_t
371
def data_read_delayed(*args)
372
status, value = comedi_data_read_delayed(self, *args)
373
raise ComediError.new if status == -1
377
# Module: SWIG::TYPE_p_comedi_t
380
status, value = comedi_dio_read(self, *args)
381
raise ComediError.new if status == -1
385
# Module: SWIG::TYPE_p_comedi_t
387
def dio_bitfield(*args)
388
status, value = comedi_dio_bitfield(self, *args)
389
raise ComediError.new if status == -1
393
# Module: SWIG::TYPE_p_comedi_t
395
def get_cmd_src_mask(*args)
396
status, value = comedi_get_cmd_src_mask(self, *args)
397
raise ComediError.new if status == -1
401
# Module: SWIG::TYPE_p_comedi_t
403
def get_cmd_generic_timed(*args)
404
status, value = comedi_get_cmd_generic_timed(self, *args)
405
raise ComediError.new if status == -1
409
# Module: SWIG::TYPE_p_comedi_t
411
def command_test(*args)
412
status, value = comedi_command_test(self, *args)
413
raise ComediError.new if status == -1
417
# Module: SWIG::TYPE_p_comedi_t
419
def get_maxdata(*args)
420
value = comedi_get_maxdata(self, *args)
421
raise ComediError.new if value == 0
425
# Module: SWIG::TYPE_p_comedi_t
427
def apply_calibration(*args)
428
value = comedi_apply_calibration(self, *args)
429
raise ComediError.new if value < 0
433
# Module: SWIG::TYPE_p_comedi_t
435
def apply_parsed_calibration(*args)
436
value = comedi_apply_parsed_calibration(self, *args)
437
raise ComediError.new if value < 0
441
# Module: SWIG::TYPE_p_comedi_t
443
def get_driver_name(*args)
444
value = comedi_get_driver_name(self, *args)
445
raise ComediError.new if value.nil?
449
# Module: SWIG::TYPE_p_comedi_t
451
def get_board_name(*args)
452
value = comedi_get_board_name(self, *args)
453
raise ComediError.new if value.nil?
457
# Module: SWIG::TYPE_p_comedi_t
460
value = comedi_get_range(self, *args)
461
raise ComediError.new if value.nil?
465
# Module: SWIG::TYPE_p_comedi_t
467
def get_default_calibration_path(*args)
468
value = comedi_get_default_calibration_path(self, *args)
469
raise ComediError.new if value.nil?
473
# Module: SWIG::TYPE_p_comedi_t
475
def get_n_subdevices(*args)
476
value = comedi_get_n_subdevices(self, *args)
480
# Module: SWIG::TYPE_p_comedi_t
482
def get_version_code(*args)
483
value = comedi_get_version_code(self, *args)
487
# Module: Comedi::Comedi_sv_t
490
value = comedi_sv_init(self, *args)
491
raise ComediError.new if value == -1
495
# Module: Comedi::Comedi_sv_t
498
value = comedi_sv_update(self, *args)
499
raise ComediError.new if value == -1
503
# Module: Comedi::Comedi_sv_t
505
def sv_measure(*args)
506
status, value = comedi_sv_measure(self, *args)
507
raise ComediError.new if status == -1
511
# Module: Comedi::Comedi_calibration_t
513
def cleanup_calibration_file(*args)
514
value = comedi_cleanup_calibration_file(self, *args)
519
steven.jenkins@ieee.org