phidgets 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.txt +3 -0
- data/ext/phidgets/extconf.rb +4 -0
- data/ext/phidgets/phidgets.c +10 -4
- data/ext/phidgets/phidgets.h +6 -1
- data/lib/phidgets.rb +1 -1
- data/phidgets.gemspec +5 -1
- metadata +89 -95
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e3fd7bef7f559dc77c93de80a317dd43f97da07f
|
4
|
+
data.tar.gz: 8a41b2c09ac0b90067b7f76d20aab7b2afb5bb1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b4500f256c1e668defc86a8f26c4eabb06758516f6bd3041b490ae5d1e6d13b64d7f6d75bde00f4139a0e5786eb1129171e1fa98cb67409d2669cade1dfaf49
|
7
|
+
data.tar.gz: 3233b9dcb43665bdb02e0d8323c226de86965dd7a11484e19fa5c9e09162ccbb6bf187afe235025083e0d830d21af91322565d401914adc695d5c8cc0631998f
|
data/History.txt
CHANGED
data/ext/phidgets/extconf.rb
CHANGED
@@ -8,6 +8,10 @@ have_framework('Phidget21') unless RUBY_VERSION < '1.9.0'
|
|
8
8
|
have_library('phidget21')
|
9
9
|
dir_config("phidgets")
|
10
10
|
|
11
|
+
have_header('ruby/thread.h')
|
12
|
+
have_func('rb_thread_blocking_region')
|
13
|
+
have_func('rb_thread_call_without_gvl')
|
14
|
+
|
11
15
|
$CFLAGS += ' -DPH_CALLBACK' unless RUBY_VERSION < '1.9.0'
|
12
16
|
|
13
17
|
create_makefile("phidgets")
|
data/ext/phidgets/phidgets.c
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
|
2
2
|
#include "phidgets.h"
|
3
3
|
|
4
|
+
#if defined(HAVE_RUBY_THREAD_H)
|
5
|
+
#include <ruby/thread.h>
|
6
|
+
#endif
|
4
7
|
|
5
8
|
VALUE ph_errors[PHIDGET_ERROR_CODE_COUNT+1];
|
6
9
|
|
@@ -14,7 +17,6 @@ VALUE ph_log(VALUE self, VALUE level, VALUE msg_id, VALUE message);
|
|
14
17
|
void Init_phidgets() {
|
15
18
|
VALUE ph_module = rb_define_module("Phidgets");
|
16
19
|
VALUE ph_error;
|
17
|
-
VALUE ph_common;
|
18
20
|
|
19
21
|
rb_define_const(ph_module, "NOTATTACHED", INT2FIX(PHIDGET_NOTATTACHED));
|
20
22
|
rb_define_const(ph_module, "ATTACHED", INT2FIX(PHIDGET_ATTACHED));
|
@@ -249,19 +251,23 @@ VALUE ph_log(VALUE self, VALUE level, VALUE msg_id, VALUE message) {
|
|
249
251
|
#ifdef PH_CALLBACK
|
250
252
|
void ph_callback_thread(ph_callback_data_t *callback_data) {
|
251
253
|
while(! callback_data->exit) {
|
254
|
+
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
255
|
+
rb_thread_call_without_gvl(wait_for_callback, (void *)callback_data, cancel_wait_for_callback, (void *)callback_data);
|
256
|
+
#else
|
252
257
|
rb_thread_blocking_region(wait_for_callback, (void *)callback_data, cancel_wait_for_callback, (void *)callback_data);
|
258
|
+
#endif
|
253
259
|
if(TYPE(callback_data->callback) != T_NIL) rb_funcall(callback_data->callback, rb_intern("call"), 1, callback_data->phidget);
|
254
260
|
callback_data->called = false;
|
255
261
|
};
|
256
262
|
}
|
257
263
|
|
258
|
-
|
264
|
+
ph_callback_return_t wait_for_callback(void *arg) {
|
259
265
|
ph_callback_data_t *callback_data = (ph_callback_data_t *)arg;
|
260
266
|
while(! callback_data->exit) {
|
261
267
|
usleep(PH_CALLBACK_POLLING_INTERVAL);
|
262
|
-
if(callback_data->called) return Qnil;
|
268
|
+
if(callback_data->called) return (ph_callback_return_t)Qnil;
|
263
269
|
};
|
264
|
-
return Qnil;
|
270
|
+
return (ph_callback_return_t)Qnil;
|
265
271
|
}
|
266
272
|
|
267
273
|
void cancel_wait_for_callback(void *arg) {
|
data/ext/phidgets/phidgets.h
CHANGED
@@ -24,7 +24,12 @@ typedef struct ph_callback_data {
|
|
24
24
|
} ph_callback_data_t;
|
25
25
|
|
26
26
|
void ph_callback_thread(ph_callback_data_t *callback_data);
|
27
|
-
|
27
|
+
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
28
|
+
typedef void * ph_callback_return_t;
|
29
|
+
#else
|
30
|
+
typedef VALUE ph_callback_return_t;
|
31
|
+
#endif
|
32
|
+
ph_callback_return_t wait_for_callback(void *arg);
|
28
33
|
void cancel_wait_for_callback(void *arg);
|
29
34
|
#endif
|
30
35
|
|
data/lib/phidgets.rb
CHANGED
data/phidgets.gemspec
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
require 'phidgets'
|
2
6
|
|
3
7
|
Gem::Specification.new do |s|
|
4
8
|
s.name = "phidgets"
|
5
|
-
s.version =
|
9
|
+
s.version = Phidgets::VERSION
|
6
10
|
s.authors = ["Craig DeHaan"]
|
7
11
|
s.email = ["cdehaan2@cfl.rr.com"]
|
8
12
|
s.homepage = "https://github.com/csdehaan/phidgets"
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phidgets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Craig DeHaan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rdoc
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.10'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '3.10'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake-compiler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: This gem provides a ruby interface to the phidgets library.
|
@@ -55,139 +50,138 @@ extra_rdoc_files:
|
|
55
50
|
- History.txt
|
56
51
|
- README.rdoc
|
57
52
|
files:
|
53
|
+
- ".yardopts"
|
54
|
+
- GNU_GPL.txt
|
55
|
+
- History.txt
|
56
|
+
- README.rdoc
|
57
|
+
- Rakefile
|
58
58
|
- bin/phidget
|
59
|
-
- ext/phidgets/
|
60
|
-
- ext/phidgets/phidgets_accelerometer.c
|
61
|
-
- ext/phidgets/phidgets_spatial.c
|
59
|
+
- ext/phidgets/extconf.rb
|
62
60
|
- ext/phidgets/phidgets.c
|
63
|
-
- ext/phidgets/
|
64
|
-
- ext/phidgets/
|
65
|
-
- ext/phidgets/
|
66
|
-
- ext/phidgets/phidgets_temp_sensor.c
|
67
|
-
- ext/phidgets/phidgets_rfid.c
|
61
|
+
- ext/phidgets/phidgets.h
|
62
|
+
- ext/phidgets/phidgets_accelerometer.c
|
63
|
+
- ext/phidgets/phidgets_advanced_servo.c
|
68
64
|
- ext/phidgets/phidgets_analog.c
|
69
|
-
- ext/phidgets/phidgets_frequency_counter.c
|
70
|
-
- ext/phidgets/phidgets_phsensor.c
|
71
65
|
- ext/phidgets/phidgets_bridge.c
|
72
|
-
- ext/phidgets/
|
73
|
-
- ext/phidgets/phidgets_led.c
|
74
|
-
- ext/phidgets/phidgets_advanced_servo.c
|
75
|
-
- ext/phidgets/phidgets_manager.c
|
76
|
-
- ext/phidgets/phidgets_weight_sensor.c
|
66
|
+
- ext/phidgets/phidgets_common.c
|
77
67
|
- ext/phidgets/phidgets_dictionary.c
|
78
|
-
- ext/phidgets/phidgets_interface_kit.c
|
79
|
-
- ext/phidgets/phidgets_gps.c
|
80
68
|
- ext/phidgets/phidgets_encoder.c
|
81
|
-
- ext/phidgets/
|
69
|
+
- ext/phidgets/phidgets_frequency_counter.c
|
70
|
+
- ext/phidgets/phidgets_gps.c
|
71
|
+
- ext/phidgets/phidgets_interface_kit.c
|
82
72
|
- ext/phidgets/phidgets_ir.c
|
83
|
-
- ext/phidgets/
|
73
|
+
- ext/phidgets/phidgets_led.c
|
74
|
+
- ext/phidgets/phidgets_manager.c
|
75
|
+
- ext/phidgets/phidgets_motor_control.c
|
76
|
+
- ext/phidgets/phidgets_phsensor.c
|
77
|
+
- ext/phidgets/phidgets_rfid.c
|
78
|
+
- ext/phidgets/phidgets_servo.c
|
79
|
+
- ext/phidgets/phidgets_spatial.c
|
80
|
+
- ext/phidgets/phidgets_stepper.c
|
81
|
+
- ext/phidgets/phidgets_temp_sensor.c
|
82
|
+
- ext/phidgets/phidgets_text_lcd.c
|
83
|
+
- ext/phidgets/phidgets_text_led.c
|
84
|
+
- ext/phidgets/phidgets_weight_sensor.c
|
84
85
|
- lib/phidgets.rb
|
85
|
-
- lib/phidgets/
|
86
|
-
- lib/phidgets/interfacekit.rb
|
86
|
+
- lib/phidgets/accelerometer.rb
|
87
87
|
- lib/phidgets/advanced_servo.rb
|
88
|
-
- lib/phidgets/
|
89
|
-
- lib/phidgets/
|
90
|
-
- lib/phidgets/temperature_sensor.rb
|
88
|
+
- lib/phidgets/analog.rb
|
89
|
+
- lib/phidgets/bridge.rb
|
91
90
|
- lib/phidgets/common.rb
|
91
|
+
- lib/phidgets/dictionary.rb
|
92
92
|
- lib/phidgets/encoder.rb
|
93
|
-
- lib/phidgets/
|
93
|
+
- lib/phidgets/frequency_counter.rb
|
94
|
+
- lib/phidgets/gps.rb
|
95
|
+
- lib/phidgets/interfacekit.rb
|
94
96
|
- lib/phidgets/ir.rb
|
95
|
-
- lib/phidgets/rfid.rb
|
96
|
-
- lib/phidgets/analog.rb
|
97
|
-
- lib/phidgets/dictionary.rb
|
98
|
-
- lib/phidgets/text_lcd.rb
|
99
|
-
- lib/phidgets/manager.rb
|
100
|
-
- lib/phidgets/stepper.rb
|
101
|
-
- lib/phidgets/accelerometer.rb
|
102
97
|
- lib/phidgets/led.rb
|
103
|
-
- lib/phidgets/
|
104
|
-
- lib/phidgets/
|
105
|
-
- lib/phidgets/weight_sensor.rb
|
98
|
+
- lib/phidgets/manager.rb
|
99
|
+
- lib/phidgets/motor_control.rb
|
106
100
|
- lib/phidgets/ph_sensor.rb
|
101
|
+
- lib/phidgets/rfid.rb
|
102
|
+
- lib/phidgets/servo.rb
|
103
|
+
- lib/phidgets/spatial.rb
|
104
|
+
- lib/phidgets/stepper.rb
|
105
|
+
- lib/phidgets/temperature_sensor.rb
|
106
|
+
- lib/phidgets/text_lcd.rb
|
107
107
|
- lib/phidgets/text_led.rb
|
108
|
-
-
|
109
|
-
-
|
108
|
+
- lib/phidgets/weight_sensor.rb
|
109
|
+
- phidgets.gemspec
|
110
|
+
- test/test_accelerometer.rb
|
111
|
+
- test/test_advanced_servo.rb
|
112
|
+
- test/test_analog.rb
|
113
|
+
- test/test_bridge.rb
|
114
|
+
- test/test_common.rb
|
110
115
|
- test/test_dictionary.rb
|
111
|
-
- test/
|
112
|
-
- test/
|
113
|
-
- test/
|
116
|
+
- test/test_encoder.rb
|
117
|
+
- test/test_frequency_counter.rb
|
118
|
+
- test/test_gps.rb
|
119
|
+
- test/test_helper.rb
|
114
120
|
- test/test_interfacekit.rb
|
115
|
-
- test/
|
121
|
+
- test/test_ir.rb
|
122
|
+
- test/test_led.rb
|
116
123
|
- test/test_manager.rb
|
117
|
-
- test/test_servo.rb
|
118
|
-
- test/test_helper.rb
|
119
|
-
- test/test_common.rb
|
120
124
|
- test/test_motor_control.rb
|
121
|
-
- test/
|
122
|
-
- test/test_bridge.rb
|
123
|
-
- test/test_accelerometer.rb
|
125
|
+
- test/test_phidgets.rb
|
124
126
|
- test/test_phsensor.rb
|
127
|
+
- test/test_rfid.rb
|
128
|
+
- test/test_servo.rb
|
129
|
+
- test/test_spatial.rb
|
125
130
|
- test/test_stepper.rb
|
126
|
-
- test/test_frequency_counter.rb
|
127
|
-
- test/test_phidgets.rb
|
128
131
|
- test/test_temp_sensor.rb
|
129
|
-
- test/
|
130
|
-
- test/
|
131
|
-
- test/
|
132
|
-
- test/test_gps.rb
|
133
|
-
- Rakefile
|
134
|
-
- GNU_GPL.txt
|
135
|
-
- History.txt
|
136
|
-
- README.rdoc
|
137
|
-
- phidgets.gemspec
|
138
|
-
- .yardopts
|
139
|
-
- ext/phidgets/extconf.rb
|
132
|
+
- test/test_text_lcd.rb
|
133
|
+
- test/test_text_led.rb
|
134
|
+
- test/test_weight_sensor.rb
|
140
135
|
homepage: https://github.com/csdehaan/phidgets
|
141
136
|
licenses: []
|
137
|
+
metadata: {}
|
142
138
|
post_install_message: For more information on phidgets, see http://www.phidgets.com/
|
143
139
|
rdoc_options:
|
144
|
-
- --main
|
140
|
+
- "--main"
|
145
141
|
- README.rdoc
|
146
142
|
require_paths:
|
147
143
|
- lib
|
148
144
|
- ext/phidgets
|
149
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
146
|
requirements:
|
152
|
-
- -
|
147
|
+
- - ">="
|
153
148
|
- !ruby/object:Gem::Version
|
154
149
|
version: '0'
|
155
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
-
none: false
|
157
151
|
requirements:
|
158
|
-
- -
|
152
|
+
- - ">="
|
159
153
|
- !ruby/object:Gem::Version
|
160
154
|
version: '0'
|
161
155
|
requirements: []
|
162
156
|
rubyforge_project:
|
163
|
-
rubygems_version:
|
157
|
+
rubygems_version: 2.4.8
|
164
158
|
signing_key:
|
165
159
|
specification_version: 3
|
166
160
|
summary: Phidgets are a set of "plug and play" building blocks for low cost USB sensing
|
167
161
|
and control from your PC. This gem provides a ruby interface to the phidgets library.
|
168
162
|
test_files:
|
169
|
-
- test/
|
163
|
+
- test/test_common.rb
|
164
|
+
- test/test_text_led.rb
|
165
|
+
- test/test_ir.rb
|
166
|
+
- test/test_helper.rb
|
167
|
+
- test/test_frequency_counter.rb
|
168
|
+
- test/test_phidgets.rb
|
169
|
+
- test/test_bridge.rb
|
170
170
|
- test/test_weight_sensor.rb
|
171
|
-
- test/test_dictionary.rb
|
172
|
-
- test/test_text_lcd.rb
|
173
|
-
- test/test_spatial.rb
|
174
|
-
- test/test_rfid.rb
|
175
171
|
- test/test_interfacekit.rb
|
176
|
-
- test/
|
172
|
+
- test/test_stepper.rb
|
173
|
+
- test/test_accelerometer.rb
|
177
174
|
- test/test_manager.rb
|
175
|
+
- test/test_text_lcd.rb
|
178
176
|
- test/test_servo.rb
|
179
|
-
- test/test_helper.rb
|
180
|
-
- test/test_common.rb
|
181
|
-
- test/test_motor_control.rb
|
182
177
|
- test/test_advanced_servo.rb
|
183
|
-
- test/
|
184
|
-
- test/
|
178
|
+
- test/test_dictionary.rb
|
179
|
+
- test/test_gps.rb
|
180
|
+
- test/test_encoder.rb
|
185
181
|
- test/test_phsensor.rb
|
186
|
-
- test/test_stepper.rb
|
187
|
-
- test/test_frequency_counter.rb
|
188
|
-
- test/test_phidgets.rb
|
189
|
-
- test/test_temp_sensor.rb
|
190
|
-
- test/test_ir.rb
|
191
|
-
- test/test_analog.rb
|
192
182
|
- test/test_led.rb
|
193
|
-
- test/
|
183
|
+
- test/test_analog.rb
|
184
|
+
- test/test_temp_sensor.rb
|
185
|
+
- test/test_spatial.rb
|
186
|
+
- test/test_motor_control.rb
|
187
|
+
- test/test_rfid.rb
|