bonekit 0.0.4-arm-linux → 0.0.5-arm-linux

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.
data/ext/bonekit/gpio.h CHANGED
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_GPIO_H__
29
- #define BONEKIT_GPIO_H__
28
+ #ifndef __BONEKIT_GPIO_H__
29
+ #define __BONEKIT_GPIO_H__
30
30
 
31
31
  #ifdef __cplusplus
32
32
  extern "C" {
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_HMC5883L_H__
29
- #define BONEKIT_HMC5883L_H__
28
+ #ifndef __BONEKIT_HMC5883L_H__
29
+ #define __BONEKIT_HMC5883L_H__
30
30
 
31
31
  #ifdef __cplusplus
32
32
  extern "C" {
@@ -28,7 +28,7 @@
28
28
  #include "hmc5883l_class.h"
29
29
 
30
30
  #include "ruby.h"
31
- #include "hmc5883l.h"
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;
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_HMC5883L_CLASS_H__
29
- #define BONEKIT_HMC5883L_CLASS_H__
28
+ #ifndef __BONEKIT_HMC5883L_CLASS_H__
29
+ #define __BONEKIT_HMC5883L_CLASS_H__
30
30
 
31
31
  void BoneKit_HMC5883L_class_init();
32
32
 
data/ext/bonekit/i2c.h CHANGED
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_I2C_H__
29
- #define BONEKIT_I2C_H__
28
+ #ifndef __BONEKIT_I2C_H__
29
+ #define __BONEKIT_I2C_H__
30
30
 
31
31
  #ifdef __cplusplus
32
32
  extern "C" {
@@ -29,9 +29,7 @@
29
29
  #include "i2c_class.h"
30
30
 
31
31
  #include "ruby.h"
32
-
33
- #include "beaglebone.h"
34
- #include "i2c.h"
32
+ #include "bonekit.h"
35
33
 
36
34
  VALUE cBoneKit_I2c;
37
35
 
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_I2C_CLASS_H__
29
- #define BONEKIT_I2C_CLASS_H__
28
+ #ifndef __BONEKIT_I2C_CLASS_H__
29
+ #define __BONEKIT_I2C_CLASS_H__
30
30
 
31
31
  void BoneKit_I2c_class_init();
32
32
 
data/ext/bonekit/pin.h CHANGED
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_PIN_H__
29
- #define BONEKIT_PIN_H__
28
+ #ifndef __BONEKIT_PIN_H__
29
+ #define __BONEKIT_PIN_H__
30
30
 
31
31
  #ifdef __cplusplus
32
32
  extern "C" {
@@ -29,9 +29,7 @@
29
29
  #include "pin_class.h"
30
30
 
31
31
  #include "ruby.h"
32
-
33
- #include "beaglebone.h"
34
- #include "pin.h"
32
+ #include "bonekit.h"
35
33
 
36
34
  VALUE cBoneKit_Pin;
37
35
 
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_PIN_CLASS_H__
29
- #define BONEKIT_PIN_CLASS_H__
28
+ #ifndef __BONEKIT_PIN_CLASS_H__
29
+ #define __BONEKIT_PIN_CLASS_H__
30
30
 
31
31
  void BoneKit_Pin_class_init();
32
32
 
data/ext/bonekit/pwm.h CHANGED
@@ -25,8 +25,8 @@
25
25
 
26
26
  */
27
27
 
28
- #ifndef BONEKIT_PWM_H__
29
- #define BONEKIT_PWM_H__
28
+ #ifndef __BONEKIT_PWM_H__
29
+ #define __BONEKIT_PWM_H__
30
30
 
31
31
  #ifdef __cplusplus
32
32
  extern "C" {
data/ext/bonekit/rbinit.c CHANGED
@@ -40,4 +40,5 @@ void Init_bonekit(void)
40
40
 
41
41
  // ICs
42
42
  BoneKit_HMC5883L_class_init();
43
+ BoneKit_ADXL345_class_init();
43
44
  }
Binary file
@@ -1,3 +1,3 @@
1
1
  module BoneKit
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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-10-27 00:00:00.000000000 Z
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
- - .gitignore
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.4
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,20 +0,0 @@
1
- tmp
2
- build
3
- configure
4
- Makefile
5
- *.cache
6
- *.m4
7
- *.in
8
- *.in~
9
- *.framework
10
- .deps
11
- xcuserdata
12
- .DS_Store
13
- references
14
- Gemfile.lock
15
- vendor
16
- .bundle
17
- .gem
18
- .yardoc
19
- pkg
20
- research
@@ -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
- }
@@ -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
- }