bonekit 0.0.4-arm-linux → 0.0.5-arm-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitmodules +3 -0
- data/Rakefile +6 -0
- data/bonekit.gemspec +1 -1
- data/docs/beaglebone/README.md +223 -0
- data/docs/beaglebone/mkmf.rb +2303 -0
- data/docs/beaglebone/ntp.conf +20 -0
- data/docs/beaglebone/ntpdate.service +12 -0
- data/docs/beaglebone/setup.sh +19 -0
- data/docs/beaglebone/wifi_init.sh +33 -0
- data/examples/devices/accelerometer.rb +19 -0
- data/ext/bonekit/adc.h +2 -2
- data/ext/bonekit/adxl345.c +90 -0
- data/ext/bonekit/adxl345.h +67 -0
- data/ext/bonekit/adxl345_class.c +86 -0
- data/ext/bonekit/adxl345_class.h +33 -0
- data/ext/bonekit/beaglebone.h +2 -2
- data/ext/bonekit/beaglebone_global_const.h +3 -3
- data/ext/bonekit/bonekit.h +49 -0
- data/ext/bonekit/gpio.h +2 -2
- data/ext/bonekit/hmc5883l.h +2 -2
- data/ext/bonekit/hmc5883l_class.c +13 -1
- data/ext/bonekit/hmc5883l_class.h +2 -2
- data/ext/bonekit/i2c.h +2 -2
- data/ext/bonekit/i2c_class.c +1 -3
- data/ext/bonekit/i2c_class.h +2 -2
- data/ext/bonekit/pin.h +2 -2
- data/ext/bonekit/pin_class.c +1 -3
- data/ext/bonekit/pin_class.h +2 -2
- data/ext/bonekit/pwm.h +2 -2
- data/ext/bonekit/rbinit.c +1 -0
- data/lib/bonekit/bonekit.so +0 -0
- data/lib/bonekit/version.rb +1 -1
- data/spec/accelerometer_spec.rb +18 -0
- metadata +19 -9
- data/.gitignore +0 -20
- data/test/bonekit-c/beaglebone_test.c +0 -26
- data/test/bonekit-c/pin_test.c +0 -56
data/ext/bonekit/gpio.h
CHANGED
data/ext/bonekit/hmc5883l.h
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
#include "hmc5883l_class.h"
|
29
29
|
|
30
30
|
#include "ruby.h"
|
31
|
-
#include "
|
31
|
+
#include "bonekit.h"
|
32
32
|
|
33
33
|
VALUE cBoneKit_HMC5883L;
|
34
34
|
|
@@ -40,6 +40,12 @@ static void HMC5883L_free(void * ptr)
|
|
40
40
|
hmc5883l_destroy(ptr);
|
41
41
|
}
|
42
42
|
|
43
|
+
/*
|
44
|
+
* call-seq:
|
45
|
+
* initialize() -> HMC5883L
|
46
|
+
*
|
47
|
+
* Returns a new HMC5883L object.
|
48
|
+
*/
|
43
49
|
static VALUE HMC5883L_new(VALUE class)
|
44
50
|
{
|
45
51
|
hmc5883l_t * ptr = hmc5883l_create();
|
@@ -47,6 +53,12 @@ static VALUE HMC5883L_new(VALUE class)
|
|
47
53
|
return wrap_struct;
|
48
54
|
}
|
49
55
|
|
56
|
+
/*
|
57
|
+
* call-seq:
|
58
|
+
* heading() -> Float
|
59
|
+
*
|
60
|
+
* Returns a Float with the heading value in degrees ([-180,180]).
|
61
|
+
*/
|
50
62
|
static VALUE HMC5883L_heading(VALUE self)
|
51
63
|
{
|
52
64
|
double value = 0.0f;
|
data/ext/bonekit/i2c.h
CHANGED
data/ext/bonekit/i2c_class.c
CHANGED
data/ext/bonekit/i2c_class.h
CHANGED
data/ext/bonekit/pin.h
CHANGED
data/ext/bonekit/pin_class.c
CHANGED
data/ext/bonekit/pin_class.h
CHANGED
data/ext/bonekit/pwm.h
CHANGED
data/ext/bonekit/rbinit.c
CHANGED
data/lib/bonekit/bonekit.so
CHANGED
Binary file
|
data/lib/bonekit/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ADXL345 do
|
4
|
+
|
5
|
+
describe "raw_acceleration" do
|
6
|
+
|
7
|
+
let :accelerometer do
|
8
|
+
ADXL345.new
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when default" do
|
12
|
+
it "returns raw acceleration vector with 3 elements" do
|
13
|
+
accelerometer.raw_acceleration.class.should eq(Array)
|
14
|
+
accelerometer.raw_acceleration.length.should eq(3)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: arm-linux
|
6
6
|
authors:
|
7
7
|
- Luis Laugga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,12 +88,18 @@ executables: []
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .
|
91
|
+
- .gitmodules
|
92
92
|
- Gemfile
|
93
93
|
- LICENSE
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
96
|
- bonekit.gemspec
|
97
|
+
- docs/beaglebone/README.md
|
98
|
+
- docs/beaglebone/mkmf.rb
|
99
|
+
- docs/beaglebone/ntp.conf
|
100
|
+
- docs/beaglebone/ntpdate.service
|
101
|
+
- docs/beaglebone/setup.sh
|
102
|
+
- docs/beaglebone/wifi_init.sh
|
97
103
|
- examples/analog/analog_read.rb
|
98
104
|
- examples/analog/fading.rb
|
99
105
|
- examples/analog/photo_resistor.rb
|
@@ -101,14 +107,20 @@ files:
|
|
101
107
|
- examples/basics/blink.rb
|
102
108
|
- examples/basics/digital_read.rb
|
103
109
|
- examples/basics/switch.rb
|
110
|
+
- examples/devices/accelerometer.rb
|
104
111
|
- examples/devices/compass.rb
|
105
112
|
- examples/devices/i2c_device.rb
|
106
113
|
- ext/bonekit/adc.c
|
107
114
|
- ext/bonekit/adc.h
|
115
|
+
- ext/bonekit/adxl345.c
|
116
|
+
- ext/bonekit/adxl345.h
|
117
|
+
- ext/bonekit/adxl345_class.c
|
118
|
+
- ext/bonekit/adxl345_class.h
|
108
119
|
- ext/bonekit/beaglebone.c
|
109
120
|
- ext/bonekit/beaglebone.h
|
110
121
|
- ext/bonekit/beaglebone_global_const.c
|
111
122
|
- ext/bonekit/beaglebone_global_const.h
|
123
|
+
- ext/bonekit/bonekit.h
|
112
124
|
- ext/bonekit/extconf.rb
|
113
125
|
- ext/bonekit/gpio.c
|
114
126
|
- ext/bonekit/gpio.h
|
@@ -128,19 +140,18 @@ files:
|
|
128
140
|
- ext/bonekit/pwm.h
|
129
141
|
- ext/bonekit/rbinit.c
|
130
142
|
- lib/bonekit.rb
|
143
|
+
- lib/bonekit/bonekit.so
|
131
144
|
- lib/bonekit/version.rb
|
145
|
+
- spec/accelerometer_spec.rb
|
132
146
|
- spec/compass_spec.rb
|
133
147
|
- spec/i2c_spec.rb
|
134
148
|
- spec/pin_spec.rb
|
135
149
|
- spec/spec_helper.rb
|
136
|
-
- test/bonekit-c/beaglebone_test.c
|
137
|
-
- test/bonekit-c/pin_test.c
|
138
150
|
- test/test_helper.rb
|
139
151
|
- test/unit/i2c_test.rb
|
140
152
|
- test/unit/pin_adc_test.rb
|
141
153
|
- test/unit/pin_gpio_test.rb
|
142
154
|
- test/unit/pin_pwm_test.rb
|
143
|
-
- lib/bonekit/bonekit.so
|
144
155
|
homepage: http://laugga.com/bonekit
|
145
156
|
licenses:
|
146
157
|
- MIT
|
@@ -161,17 +172,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
172
|
version: '0'
|
162
173
|
requirements: []
|
163
174
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.1.
|
175
|
+
rubygems_version: 2.1.10
|
165
176
|
signing_key:
|
166
177
|
specification_version: 4
|
167
178
|
summary: Physical interaction toolkit for the beaglebone.
|
168
179
|
test_files:
|
180
|
+
- spec/accelerometer_spec.rb
|
169
181
|
- spec/compass_spec.rb
|
170
182
|
- spec/i2c_spec.rb
|
171
183
|
- spec/pin_spec.rb
|
172
184
|
- spec/spec_helper.rb
|
173
|
-
- test/bonekit-c/beaglebone_test.c
|
174
|
-
- test/bonekit-c/pin_test.c
|
175
185
|
- test/test_helper.rb
|
176
186
|
- test/unit/i2c_test.rb
|
177
187
|
- test/unit/pin_adc_test.rb
|
data/.gitignore
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#include "../../ext/bonekit/beaglebone.h"
|
2
|
-
|
3
|
-
#include <stdio.h>
|
4
|
-
|
5
|
-
int main()
|
6
|
-
{
|
7
|
-
beaglebone_t p = P9_42;
|
8
|
-
|
9
|
-
printf("p %s %x\n", p.pin_name, p.pin_mask);
|
10
|
-
|
11
|
-
char pin_name[PIN_NAME_LEN];
|
12
|
-
int gpio, ain, pwm_mux_mode;
|
13
|
-
|
14
|
-
beaglebone_pin_name(P9_42, pin_name);
|
15
|
-
gpio = beaglebone_gpio(P9_42);
|
16
|
-
ain = beaglebone_ain(P9_42);
|
17
|
-
pwm_mux_mode = beaglebone_pwm_mux_mode(P9_42);
|
18
|
-
|
19
|
-
printf("%s %d %d %d\n", pin_name, gpio, ain, pwm_mux_mode);
|
20
|
-
|
21
|
-
beaglebone_t u = USR1;
|
22
|
-
|
23
|
-
printf("u %s %x\n", u.pin_name, u.pin_mask);
|
24
|
-
|
25
|
-
return 0;
|
26
|
-
}
|
data/test/bonekit-c/pin_test.c
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
#include "../../ext/bonekit/pin.h"
|
2
|
-
|
3
|
-
#include <stdio.h>
|
4
|
-
|
5
|
-
int main()
|
6
|
-
{
|
7
|
-
beaglebone_t p = P9_42;
|
8
|
-
|
9
|
-
pin_t * pin = pin_alloc();
|
10
|
-
pin_init(pin, P9_42);
|
11
|
-
|
12
|
-
pin_set_analog_value(pin, 1.0);
|
13
|
-
|
14
|
-
sleep(1);
|
15
|
-
|
16
|
-
pin_set_analog_value(pin, 0.5);
|
17
|
-
|
18
|
-
sleep(1);
|
19
|
-
|
20
|
-
pin_set_analog_value(pin, 0.0);
|
21
|
-
|
22
|
-
pin_destroy(pin);
|
23
|
-
|
24
|
-
pin = pin_alloc();
|
25
|
-
pin_init(pin, P9_13);
|
26
|
-
|
27
|
-
pin_set_mode(pin, OUTPUT);
|
28
|
-
pin_set_value(pin, HIGH);
|
29
|
-
|
30
|
-
sleep(1);
|
31
|
-
|
32
|
-
pin_set_value(pin, LOW);
|
33
|
-
|
34
|
-
sleep(1);
|
35
|
-
|
36
|
-
pin_set_value(pin, HIGH);
|
37
|
-
|
38
|
-
sleep(1);
|
39
|
-
|
40
|
-
pin_destroy(pin);
|
41
|
-
|
42
|
-
pin = pin_alloc();
|
43
|
-
pin_init(pin, P9_39);
|
44
|
-
|
45
|
-
printf("analog value %f\n", pin_analog_value(pin));
|
46
|
-
|
47
|
-
sleep(1);
|
48
|
-
|
49
|
-
printf("analog value %f\n", pin_analog_value(pin));
|
50
|
-
|
51
|
-
sleep(1);
|
52
|
-
|
53
|
-
pin_destroy(pin);
|
54
|
-
|
55
|
-
return 0;
|
56
|
-
}
|