phidgets 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ --readme README.rdoc
2
+ 'ext/phidgets/phidgets.c' 'ext/phidgets/phidgets_common.c' 'lib/**/*.rb' 'ext/phidgets/phidgets_*.c' - 'GNU_GPL.txt' 'History.txt'
3
+
@@ -1,3 +1,6 @@
1
+ == 0.1.2 2013-10-22
2
+ * Rearranged the c code to make it easier for yard to parse and extract documentation
3
+
1
4
  == 0.1.1 2013-10-22
2
5
  * Fixed bug in phidget executable that caused invalid arg exception when listing all attached phidget devices
3
6
  * Updated some documentation that had examples from the old interface (using 1 and 0 instead of true and false)
@@ -176,29 +176,29 @@ void Init_phidgets() {
176
176
  */
177
177
  rb_define_singleton_method(ph_module, "log", ph_log, 3);
178
178
 
179
- Init_phidgets_dictionary(ph_module);
180
- Init_phidgets_manager(ph_module);
181
- ph_common = Init_phidgets_common(ph_module);
182
- Init_phidgets_accel(ph_module, ph_common);
183
- Init_phidgets_advservo(ph_module, ph_common);
184
- Init_phidgets_analog(ph_module, ph_common);
185
- Init_phidgets_bridge(ph_module, ph_common);
186
- Init_phidgets_encoder(ph_module, ph_common);
187
- Init_phidgets_freq(ph_module, ph_common);
188
- Init_phidgets_gps(ph_module, ph_common);
189
- Init_phidgets_ifkit(ph_module, ph_common);
190
- Init_phidgets_ir(ph_module, ph_common);
191
- Init_phidgets_led(ph_module, ph_common);
192
- Init_phidgets_motor_control(ph_module, ph_common);
193
- Init_phidgets_phsensor(ph_module, ph_common);
194
- Init_phidgets_rfid(ph_module, ph_common);
195
- Init_phidgets_servo(ph_module, ph_common);
196
- Init_phidgets_spatial(ph_module, ph_common);
197
- Init_phidgets_stepper(ph_module, ph_common);
198
- Init_phidgets_temp(ph_module, ph_common);
199
- Init_phidgets_textlcd(ph_module, ph_common);
200
- Init_phidgets_textled(ph_module, ph_common);
201
- Init_phidgets_weight(ph_module, ph_common);
179
+ Init_dictionary();
180
+ Init_manager();
181
+ Init_common();
182
+ Init_accelerometer();
183
+ Init_advanced_servo();
184
+ Init_analog();
185
+ Init_bridge();
186
+ Init_encoder();
187
+ Init_frequency_counter();
188
+ Init_gps();
189
+ Init_interface_kit();
190
+ Init_ir();
191
+ Init_led();
192
+ Init_motor_control();
193
+ Init_ph_sensor();
194
+ Init_rfid();
195
+ Init_servo();
196
+ Init_spatial();
197
+ Init_stepper();
198
+ Init_temperature_sensor();
199
+ Init_text_lcd();
200
+ Init_text_led();
201
+ Init_weight_sensor();
202
202
  }
203
203
 
204
204
 
@@ -49,29 +49,29 @@ typedef struct ph_data {
49
49
 
50
50
 
51
51
  void Init_phidgets();
52
- VALUE Init_phidgets_dictionary(VALUE ph_module);
53
- VALUE Init_phidgets_manager(VALUE ph_module);
54
- VALUE Init_phidgets_common(VALUE ph_module);
55
- VALUE Init_phidgets_accel(VALUE ph_module, VALUE ph_common);
56
- VALUE Init_phidgets_advservo(VALUE ph_module, VALUE ph_common);
57
- VALUE Init_phidgets_analog(VALUE ph_module, VALUE ph_common);
58
- VALUE Init_phidgets_bridge(VALUE ph_module, VALUE ph_common);
59
- VALUE Init_phidgets_encoder(VALUE ph_module, VALUE ph_common);
60
- VALUE Init_phidgets_freq(VALUE ph_module, VALUE ph_common);
61
- VALUE Init_phidgets_gps(VALUE ph_module, VALUE ph_common);
62
- VALUE Init_phidgets_ifkit(VALUE ph_module, VALUE ph_common);
63
- VALUE Init_phidgets_ir(VALUE ph_module, VALUE ph_common);
64
- VALUE Init_phidgets_led(VALUE ph_module, VALUE ph_common);
65
- VALUE Init_phidgets_motor_control(VALUE ph_module, VALUE ph_common);
66
- VALUE Init_phidgets_phsensor(VALUE ph_module, VALUE ph_common);
67
- VALUE Init_phidgets_rfid(VALUE ph_module, VALUE ph_common);
68
- VALUE Init_phidgets_servo(VALUE ph_module, VALUE ph_common);
69
- VALUE Init_phidgets_spatial(VALUE ph_module, VALUE ph_common);
70
- VALUE Init_phidgets_stepper(VALUE ph_module, VALUE ph_common);
71
- VALUE Init_phidgets_temp(VALUE ph_module, VALUE ph_common);
72
- VALUE Init_phidgets_textlcd(VALUE ph_module, VALUE ph_common);
73
- VALUE Init_phidgets_textled(VALUE ph_module, VALUE ph_common);
74
- VALUE Init_phidgets_weight(VALUE ph_module, VALUE ph_common);
52
+ void Init_dictionary();
53
+ void Init_manager();
54
+ void Init_common();
55
+ void Init_accelerometer();
56
+ void Init_advanced_servo();
57
+ void Init_analog();
58
+ void Init_bridge();
59
+ void Init_encoder();
60
+ void Init_frequency_counter();
61
+ void Init_gps();
62
+ void Init_interface_kit();
63
+ void Init_ir();
64
+ void Init_led();
65
+ void Init_motor_control();
66
+ void Init_ph_sensor();
67
+ void Init_rfid();
68
+ void Init_servo();
69
+ void Init_spatial();
70
+ void Init_stepper();
71
+ void Init_temperature_sensor();
72
+ void Init_text_lcd();
73
+ void Init_text_led();
74
+ void Init_weight_sensor();
75
75
 
76
76
 
77
77
  ph_data_t *get_ph_data(VALUE self);
@@ -17,7 +17,9 @@ int ph_accel_on_acceleration_change(CPhidgetAccelerometerHandle phid, void *user
17
17
 
18
18
 
19
19
 
20
- VALUE Init_phidgets_accel(VALUE ph_module, VALUE ph_common) {
20
+ void Init_accelerometer() {
21
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
22
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
21
23
  VALUE ph_accel = rb_define_class_under(ph_module, "Accelerometer", ph_common);
22
24
 
23
25
  /* Document-method: new
@@ -79,8 +81,6 @@ VALUE Init_phidgets_accel(VALUE ph_module, VALUE ph_common) {
79
81
  rb_define_alias(ph_accel, "acceleration_max", "getAccelerationMax");
80
82
  rb_define_alias(ph_accel, "acceleration_change_trigger", "getAccelerationChangeTrigger");
81
83
  rb_define_alias(ph_accel, "set_acceleration_change_trigger", "setAccelerationChangeTrigger");
82
-
83
- return ph_accel;
84
84
  }
85
85
 
86
86
 
@@ -39,7 +39,9 @@ int ph_advservo_on_current_change(CPhidgetAdvancedServoHandle phid, void *userPt
39
39
  #endif
40
40
 
41
41
 
42
- VALUE Init_phidgets_advservo(VALUE ph_module, VALUE ph_common) {
42
+ void Init_advanced_servo() {
43
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
44
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
43
45
  VALUE ph_advservo = rb_define_class_under(ph_module, "AdvancedServo", ph_common);
44
46
 
45
47
  /* Default - This is what the servo API been historically used, originally based on the Futaba FP-S148 */
@@ -310,8 +312,6 @@ VALUE Init_phidgets_advservo(VALUE ph_module, VALUE ph_common) {
310
312
  rb_define_alias(ph_advservo, "servo_type", "getServoType");
311
313
  rb_define_alias(ph_advservo, "set_servo_type", "setServoType");
312
314
  rb_define_alias(ph_advservo, "set_servo_parameters", "setServoParameters");
313
-
314
- return ph_advservo;
315
315
  }
316
316
 
317
317
 
@@ -12,7 +12,9 @@ VALUE ph_analog_get_enabled(VALUE self, VALUE index);
12
12
  VALUE ph_analog_set_enabled(VALUE self, VALUE index, VALUE state);
13
13
 
14
14
 
15
- VALUE Init_phidgets_analog(VALUE ph_module, VALUE ph_common) {
15
+ void Init_analog() {
16
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
17
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
16
18
  VALUE ph_analog = rb_define_class_under(ph_module, "Analog", ph_common);
17
19
 
18
20
  /* Document-method: new
@@ -78,8 +80,6 @@ VALUE Init_phidgets_analog(VALUE ph_module, VALUE ph_common) {
78
80
  rb_define_alias(ph_analog, "set_voltage", "setVoltage");
79
81
  rb_define_alias(ph_analog, "enabled?", "getEnabled");
80
82
  rb_define_alias(ph_analog, "set_enabled", "setEnabled");
81
-
82
- return ph_analog;
83
83
  }
84
84
 
85
85
 
@@ -22,7 +22,9 @@ int ph_bridge_on_bridge_data(CPhidgetBridgeHandle phid, void *userPtr, int index
22
22
  #endif
23
23
 
24
24
 
25
- VALUE Init_phidgets_bridge(VALUE ph_module, VALUE ph_common) {
25
+ void Init_bridge() {
26
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
27
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
26
28
  VALUE ph_bridge = rb_define_class_under(ph_module, "Bridge", ph_common);
27
29
 
28
30
  rb_define_const(ph_bridge, "GAIN_1", INT2FIX(PHIDGET_BRIDGE_GAIN_1));
@@ -140,8 +142,6 @@ VALUE Init_phidgets_bridge(VALUE ph_module, VALUE ph_common) {
140
142
  rb_define_alias(ph_bridge, "data_rate_min", "getDataRateMin");
141
143
  rb_define_alias(ph_bridge, "data_rate_max", "getDataRateMax");
142
144
  rb_define_alias(ph_bridge, "data_rate=", "setDataRate");
143
-
144
- return ph_bridge;
145
145
  }
146
146
 
147
147
 
@@ -37,7 +37,8 @@ int ph_common_on_server_disconnect(CPhidgetHandle phid, void *userPtr);
37
37
  #endif
38
38
 
39
39
 
40
- VALUE Init_phidgets_common(VALUE ph_module) {
40
+ void Init_common() {
41
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
41
42
  VALUE ph_common = rb_define_class_under(ph_module, "Common", rb_cObject);
42
43
  rb_define_alloc_func(ph_common, ph_common_allocate);
43
44
  rb_define_private_method(ph_common, "ext_open", ph_common_open, 1);
@@ -200,8 +201,6 @@ VALUE Init_phidgets_common(VALUE ph_module) {
200
201
  rb_define_alias(ph_common, "server_id", "getServerID");
201
202
  rb_define_alias(ph_common, "server_address", "getServerAddress");
202
203
  rb_define_alias(ph_common, "server_status", "getServerStatus");
203
-
204
- return ph_common;
205
204
  }
206
205
 
207
206
 
@@ -25,7 +25,8 @@ int ph_dictionary_on_server_disconnect(CPhidgetDictionaryHandle phid, void *user
25
25
  #endif
26
26
 
27
27
 
28
- VALUE Init_phidgets_dictionary(VALUE ph_module) {
28
+ void Init_dictionary() {
29
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
29
30
  VALUE ph_dictionary = rb_define_class_under(ph_module, "Dictionary", rb_cObject);
30
31
  rb_define_alloc_func(ph_dictionary, ph_dictionary_allocate);
31
32
 
@@ -128,8 +129,6 @@ VALUE Init_phidgets_dictionary(VALUE ph_module) {
128
129
  rb_define_alias(ph_dictionary, "remove_key", "removeKey");
129
130
  rb_define_alias(ph_dictionary, "server_address", "getServerAddress");
130
131
  rb_define_alias(ph_dictionary, "server_status", "getServerStatus");
131
-
132
- return ph_dictionary;
133
132
  }
134
133
 
135
134
 
@@ -22,7 +22,9 @@ int ph_encoder_on_index(CPhidgetEncoderHandle phid, void *userPtr, int index, in
22
22
  #endif
23
23
 
24
24
 
25
- VALUE Init_phidgets_encoder(VALUE ph_module, VALUE ph_common) {
25
+ void Init_encoder() {
26
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
27
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
26
28
  VALUE ph_encoder = rb_define_class_under(ph_module, "Encoder", ph_common);
27
29
 
28
30
  /* Document-method: new
@@ -103,8 +105,6 @@ VALUE Init_phidgets_encoder(VALUE ph_module, VALUE ph_common) {
103
105
  rb_define_alias(ph_encoder, "index_position", "getIndexPosition");
104
106
  rb_define_alias(ph_encoder, "enabled?", "getEnabled");
105
107
  rb_define_alias(ph_encoder, "set_enabled", "setEnabled");
106
-
107
- return ph_encoder;
108
108
  }
109
109
 
110
110
 
@@ -21,7 +21,9 @@ int ph_freq_on_count(CPhidgetFrequencyCounterHandle phid, void *userPtr, int ind
21
21
  #endif
22
22
 
23
23
 
24
- VALUE Init_phidgets_freq(VALUE ph_module, VALUE ph_common) {
24
+ void Init_frequency_counter() {
25
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
26
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
25
27
  VALUE ph_freq = rb_define_class_under(ph_module, "FrequencyCounter", ph_common);
26
28
 
27
29
  rb_define_const(ph_freq, "FILTERTYPE_ZERO_CROSSING", INT2FIX(PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_ZERO_CROSSING));
@@ -126,8 +128,6 @@ VALUE Init_phidgets_freq(VALUE ph_module, VALUE ph_common) {
126
128
  rb_define_alias(ph_freq, "set_enabled", "setEnabled");
127
129
  rb_define_alias(ph_freq, "filter", "getFilter");
128
130
  rb_define_alias(ph_freq, "set_filter", "setFilter");
129
-
130
- return ph_freq;
131
131
  }
132
132
 
133
133
 
@@ -21,7 +21,9 @@ int ph_gps_on_position_fix_status_change(CPhidgetGPSHandle phid, void *userPtr,
21
21
  #endif
22
22
 
23
23
 
24
- VALUE Init_phidgets_gps(VALUE ph_module, VALUE ph_common) {
24
+ void Init_gps() {
25
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
26
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
25
27
  VALUE ph_gps = rb_define_class_under(ph_module, "GPS", ph_common);
26
28
 
27
29
  /* Document-method: new
@@ -107,8 +109,6 @@ VALUE Init_phidgets_gps(VALUE ph_module, VALUE ph_common) {
107
109
  rb_define_alias(ph_gps, "date", "getDate");
108
110
  rb_define_alias(ph_gps, "position_fix_status", "getPositionFixStatus");
109
111
  rb_define_alias(ph_gps, "nmea_data", "getNMEAData");
110
-
111
- return ph_gps;
112
112
  }
113
113
 
114
114
 
@@ -28,7 +28,9 @@ int ph_ifkit_on_sensor_change(CPhidgetInterfaceKitHandle phid, void *userPtr, in
28
28
  #endif
29
29
 
30
30
 
31
- VALUE Init_phidgets_ifkit(VALUE ph_module, VALUE ph_common) {
31
+ void Init_interface_kit() {
32
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
33
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
32
34
  VALUE ph_ifkit = rb_define_class_under(ph_module, "InterfaceKit", ph_common);
33
35
 
34
36
  /* Document-method: new
@@ -156,8 +158,6 @@ VALUE Init_phidgets_ifkit(VALUE ph_module, VALUE ph_common) {
156
158
  rb_define_alias(ph_ifkit, "data_rate_min", "getDataRateMin");
157
159
  rb_define_alias(ph_ifkit, "data_rate_max", "getDataRateMax");
158
160
  rb_define_alias(ph_ifkit, "set_data_rate", "setDataRate");
159
-
160
- return ph_ifkit;
161
161
  }
162
162
 
163
163
 
@@ -20,7 +20,9 @@ int ph_ir_on_raw_data(CPhidgetIRHandle phid, void *userPtr, int *data, int dataL
20
20
  #endif
21
21
 
22
22
 
23
- VALUE Init_phidgets_ir(VALUE ph_module, VALUE ph_common) {
23
+ void Init_ir() {
24
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
25
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
24
26
  VALUE ph_ir = rb_define_class_under(ph_module, "IR", ph_common);
25
27
 
26
28
  /* Unknown - the default value */
@@ -105,8 +107,6 @@ VALUE Init_phidgets_ir(VALUE ph_module, VALUE ph_common) {
105
107
  rb_define_alias(ph_ir, "raw_data", "getRawData");
106
108
  rb_define_alias(ph_ir, "last_code", "getLastCode");
107
109
  rb_define_alias(ph_ir, "last_learned_code", "getLastLearnedCode");
108
-
109
- return ph_ir;
110
110
  }
111
111
 
112
112
 
@@ -14,7 +14,9 @@ VALUE ph_led_get_current_limit_indexed(VALUE self, VALUE index);
14
14
  VALUE ph_led_set_current_limit_indexed(VALUE self, VALUE index, VALUE limit);
15
15
 
16
16
 
17
- VALUE Init_phidgets_led(VALUE ph_module, VALUE ph_common) {
17
+ void Init_led() {
18
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
19
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
18
20
  VALUE ph_led = rb_define_class_under(ph_module, "LED", ph_common);
19
21
 
20
22
  rb_define_const(ph_led, "CURRENT_LIMIT_20mA", INT2FIX(PHIDGET_LED_CURRENT_LIMIT_20mA));
@@ -105,8 +107,6 @@ VALUE Init_phidgets_led(VALUE ph_module, VALUE ph_common) {
105
107
  rb_define_alias(ph_led, "set_brightness", "setBrightness");
106
108
  rb_define_alias(ph_led, "current_limit_indexed", "getCurrentLimitIndexed");
107
109
  rb_define_alias(ph_led, "set_current_limit_indexed", "setCurrentLimitIndexed");
108
-
109
- return ph_led;
110
110
  }
111
111
 
112
112
 
@@ -27,7 +27,8 @@ int ph_manager_on_server_disconnect(CPhidgetManagerHandle phid, void *userPtr);
27
27
  #endif
28
28
 
29
29
 
30
- VALUE Init_phidgets_manager(VALUE ph_module) {
30
+ void Init_manager() {
31
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
31
32
  VALUE ph_manager = rb_define_class_under(ph_module, "Manager", rb_cObject);
32
33
  rb_define_alloc_func(ph_manager, ph_manager_allocate);
33
34
 
@@ -102,8 +103,6 @@ VALUE Init_phidgets_manager(VALUE ph_module) {
102
103
  rb_define_alias(ph_manager, "server_address", "getServerAddress");
103
104
  rb_define_alias(ph_manager, "server_status", "getServerStatus");
104
105
  rb_define_alias(ph_manager, "attached_devices", "getAttachedDevices");
105
-
106
- return ph_manager;
107
106
  }
108
107
 
109
108
 
@@ -48,7 +48,9 @@ int ph_motor_on_sensor_update(CPhidgetMotorControlHandle phid, void *userPtr, in
48
48
  #endif
49
49
 
50
50
 
51
- VALUE Init_phidgets_motor_control(VALUE ph_module, VALUE ph_common) {
51
+ void Init_motor_control() {
52
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
53
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
52
54
  VALUE ph_motor = rb_define_class_under(ph_module, "MotorControl", ph_common);
53
55
 
54
56
  /* Document-method: new
@@ -262,8 +264,6 @@ VALUE Init_phidgets_motor_control(VALUE ph_module, VALUE ph_common) {
262
264
  rb_define_alias(ph_motor, "sensor_raw_value", "getSensorRawValue");
263
265
  rb_define_alias(ph_motor, "ratiometric?", "getRatiometric");
264
266
  rb_define_alias(ph_motor, "ratiometric=", "setRatiometric");
265
-
266
- return ph_motor;
267
267
  }
268
268
 
269
269
 
@@ -19,7 +19,9 @@ int ph_phsensor_on_ph_change(CPhidgetPHSensorHandle phid, void *userPtr, double
19
19
  #endif
20
20
 
21
21
 
22
- VALUE Init_phidgets_phsensor(VALUE ph_module, VALUE ph_common) {
22
+ void Init_ph_sensor() {
23
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
24
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
23
25
  VALUE ph_phsensor = rb_define_class_under(ph_module, "PHSensor", ph_common);
24
26
 
25
27
  /* Document-method: new
@@ -105,8 +107,6 @@ VALUE Init_phidgets_phsensor(VALUE ph_module, VALUE ph_common) {
105
107
  rb_define_alias(ph_phsensor, "potential_min", "getPotentialMin");
106
108
  rb_define_alias(ph_phsensor, "potential_max", "getPotentialMax");
107
109
  rb_define_alias(ph_phsensor, "temperature=", "setTemperature");
108
-
109
- return ph_phsensor;
110
110
  }
111
111
 
112
112
 
@@ -24,7 +24,9 @@ int ph_rfid_on_output_change(CPhidgetRFIDHandle phid, void *userPtr, int index,
24
24
  #endif
25
25
 
26
26
 
27
- VALUE Init_phidgets_rfid(VALUE ph_module, VALUE ph_common) {
27
+ void Init_rfid() {
28
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
29
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
28
30
  VALUE ph_rfid = rb_define_class_under(ph_module, "RFID", ph_common);
29
31
 
30
32
  /* EM4100 (EM4102) 40-bit */
@@ -126,8 +128,6 @@ VALUE Init_phidgets_rfid(VALUE ph_module, VALUE ph_common) {
126
128
  rb_define_alias(ph_rfid, "led_on=", "setLEDOn");
127
129
  rb_define_alias(ph_rfid, "last_tag", "getLastTag");
128
130
  rb_define_alias(ph_rfid, "tag_status", "getTagStatus");
129
-
130
- return ph_rfid;
131
131
  }
132
132
 
133
133
 
@@ -20,7 +20,9 @@ int ph_servo_on_position_change(CPhidgetServoHandle phid, void *userPtr, int ind
20
20
  #endif
21
21
 
22
22
 
23
- VALUE Init_phidgets_servo(VALUE ph_module, VALUE ph_common) {
23
+ void Init_servo() {
24
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
25
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
24
26
  VALUE ph_servo = rb_define_class_under(ph_module, "Servo", ph_common);
25
27
 
26
28
  /* Default - This is what the servo API been historically used, originally based on the Futaba FP-S148 */
@@ -168,8 +170,6 @@ VALUE Init_phidgets_servo(VALUE ph_module, VALUE ph_common) {
168
170
  rb_define_alias(ph_servo, "servo_type", "getServoType");
169
171
  rb_define_alias(ph_servo, "set_servo_type", "setServoType");
170
172
  rb_define_alias(ph_servo, "set_servo_parameters", "setServoParameters");
171
-
172
- return ph_servo;
173
173
  }
174
174
 
175
175
 
@@ -29,7 +29,9 @@ int ph_spatial_on_spatial_data(CPhidgetSpatialHandle phid, void *userPtr, CPhidg
29
29
  #endif
30
30
 
31
31
 
32
- VALUE Init_phidgets_spatial(VALUE ph_module, VALUE ph_common) {
32
+ void Init_spatial() {
33
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
34
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
33
35
  VALUE ph_spatial = rb_define_class_under(ph_module, "Spatial", ph_common);
34
36
 
35
37
  /* Document-method: new
@@ -197,8 +199,6 @@ VALUE Init_phidgets_spatial(VALUE ph_module, VALUE ph_common) {
197
199
  rb_define_alias(ph_spatial, "zero_gyro", "zeroGyro");
198
200
  rb_define_alias(ph_spatial, "set_compass_correction_parameters", "setCompassCorrectionParameters");
199
201
  rb_define_alias(ph_spatial, "reset_compass_correction_parameters", "resetCompassCorrectionParameters");
200
-
201
- return ph_spatial;
202
202
  }
203
203
 
204
204
 
@@ -42,7 +42,9 @@ int ph_stepper_on_current_change(CPhidgetStepperHandle phid, void *userPtr, int
42
42
  #endif
43
43
 
44
44
 
45
- VALUE Init_phidgets_stepper(VALUE ph_module, VALUE ph_common) {
45
+ void Init_stepper() {
46
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
47
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
46
48
  VALUE ph_stepper = rb_define_class_under(ph_module, "Stepper", ph_common);
47
49
 
48
50
  /* Document-method: new
@@ -267,8 +269,6 @@ VALUE Init_phidgets_stepper(VALUE ph_module, VALUE ph_common) {
267
269
  rb_define_alias(ph_stepper, "engaged?", "getEngaged");
268
270
  rb_define_alias(ph_stepper, "set_engaged", "setEngaged");
269
271
  rb_define_alias(ph_stepper, "stopped?", "getStopped");
270
-
271
- return ph_stepper;
272
272
  }
273
273
 
274
274
 
@@ -24,7 +24,9 @@ int ph_temp_on_temperature_change(CPhidgetTemperatureSensorHandle phid, void *us
24
24
  #endif
25
25
 
26
26
 
27
- VALUE Init_phidgets_temp(VALUE ph_module, VALUE ph_common) {
27
+ void Init_temperature_sensor() {
28
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
29
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
28
30
  VALUE ph_temp = rb_define_class_under(ph_module, "TemperatureSensor", ph_common);
29
31
 
30
32
  rb_define_const(ph_temp, "K_TYPE", INT2FIX(PHIDGET_TEMPERATURE_SENSOR_K_TYPE));
@@ -157,8 +159,6 @@ VALUE Init_phidgets_temp(VALUE ph_module, VALUE ph_common) {
157
159
  rb_define_alias(ph_temp, "ambient_temperature_max", "getAmbientTemperatureMax");
158
160
  rb_define_alias(ph_temp, "thermocouple_type", "getThermocoupleType");
159
161
  rb_define_alias(ph_temp, "set_thermocouple_type", "setThermocoupleType");
160
-
161
- return ph_temp;
162
162
  }
163
163
 
164
164
 
@@ -26,7 +26,9 @@ VALUE ph_textlcd_set_screen_size(VALUE self, VALUE screen);
26
26
  VALUE ph_textlcd_init_screen(VALUE self);
27
27
 
28
28
 
29
- VALUE Init_phidgets_textlcd(VALUE ph_module, VALUE ph_common) {
29
+ void Init_text_lcd() {
30
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
31
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
30
32
  VALUE ph_textlcd = rb_define_class_under(ph_module, "TextLCD", ph_common);
31
33
 
32
34
  /* no screen attached */
@@ -230,8 +232,6 @@ VALUE Init_phidgets_textlcd(VALUE ph_module, VALUE ph_common) {
230
232
  rb_define_alias(ph_textlcd, "screen_size", "getScreenSize");
231
233
  rb_define_alias(ph_textlcd, "screen_size=", "setScreenSize");
232
234
  rb_define_alias(ph_textlcd, "init_screen", "initScreen");
233
-
234
- return ph_textlcd;
235
235
  }
236
236
 
237
237
 
@@ -10,7 +10,9 @@ VALUE ph_textled_set_brightness(VALUE self, VALUE brightness);
10
10
  VALUE ph_textled_set_display_string(VALUE self, VALUE index, VALUE string);
11
11
 
12
12
 
13
- VALUE Init_phidgets_textled(VALUE ph_module, VALUE ph_common) {
13
+ void Init_text_led() {
14
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
15
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
14
16
  VALUE ph_textled = rb_define_class_under(ph_module, "TextLED", ph_common);
15
17
 
16
18
  /* Document-method: new
@@ -60,8 +62,6 @@ VALUE Init_phidgets_textled(VALUE ph_module, VALUE ph_common) {
60
62
  rb_define_alias(ph_textled, "brightness", "getBrightness");
61
63
  rb_define_alias(ph_textled, "brightness=", "setBrightness");
62
64
  rb_define_alias(ph_textled, "display_string", "setDisplayString");
63
-
64
- return ph_textled;
65
65
  }
66
66
 
67
67
 
@@ -13,7 +13,9 @@ int ph_weight_on_weight_change(CPhidgetWeightSensorHandle phid, void *userPtr, d
13
13
  #endif
14
14
 
15
15
 
16
- VALUE Init_phidgets_weight(VALUE ph_module, VALUE ph_common) {
16
+ void Init_weight_sensor() {
17
+ VALUE ph_module = rb_const_get(rb_cObject, rb_intern("Phidgets"));
18
+ VALUE ph_common = rb_const_get(ph_module, rb_intern("Common"));
17
19
  VALUE ph_weight = rb_define_class_under(ph_module, "WeightSensor", ph_common);
18
20
 
19
21
  /* Document-method: new
@@ -51,8 +53,6 @@ VALUE Init_phidgets_weight(VALUE ph_module, VALUE ph_common) {
51
53
  rb_define_alias(ph_weight, "weight", "getWeight");
52
54
  rb_define_alias(ph_weight, "weight_change_trigger", "getWeightChangeTrigger");
53
55
  rb_define_alias(ph_weight, "weight_change_trigger=", "setWeightChangeTrigger");
54
-
55
- return ph_weight;
56
56
  }
57
57
 
58
58
 
@@ -28,5 +28,5 @@ require File.dirname(__FILE__) + '/phidgets/text_led.rb'
28
28
  require File.dirname(__FILE__) + '/phidgets/weight_sensor.rb'
29
29
 
30
30
  module Phidgets
31
- VERSION = '0.1.1'
31
+ VERSION = '0.1.2'
32
32
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "phidgets"
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
  s.authors = ["Craig DeHaan"]
7
7
  s.email = ["cdehaan2@cfl.rr.com"]
8
8
  s.homepage = "https://github.com/csdehaan/phidgets"
9
9
  s.summary = "Phidgets are a set of \"plug and play\" building blocks for low cost USB sensing and control from your PC.\nThis gem provides a ruby interface to the phidgets library."
10
- s.description = s.summary
10
+ s.description = "This gem provides a ruby interface to the phidgets library."
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.executables = ["phidget"]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  Dir.glob("ext/**/*.{c,h}") +
18
18
  Dir.glob("lib/**/*.rb")+
19
19
  Dir.glob("test/*.rb")+
20
- %w(Rakefile GNU_GPL.txt History.txt README.rdoc phidgets.gemspec)
20
+ %w(Rakefile GNU_GPL.txt History.txt README.rdoc phidgets.gemspec .yardopts)
21
21
  s.test_files = Dir.glob("test/*.rb")
22
22
  s.post_install_message = "For more information on phidgets, see http://www.phidgets.com/"
23
23
  s.rdoc_options = ["--main", "README.rdoc"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phidgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,9 +43,7 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- description: Phidgets are a set of "plug and play" building blocks for low cost USB
47
- sensing and control from your PC. This gem provides a ruby interface to the phidgets
48
- library.
46
+ description: This gem provides a ruby interface to the phidgets library.
49
47
  email:
50
48
  - cdehaan2@cfl.rr.com
51
49
  executables:
@@ -137,6 +135,7 @@ files:
137
135
  - History.txt
138
136
  - README.rdoc
139
137
  - phidgets.gemspec
138
+ - .yardopts
140
139
  - ext/phidgets/extconf.rb
141
140
  homepage: https://github.com/csdehaan/phidgets
142
141
  licenses: []