beagleboard 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9de4fc9c2d33be9532d660d9c80e2866c37932490cf3ab4aff86faa5274de3d1
4
- data.tar.gz: 57bdfe384676500035013e28b99de9301a149098b5bc3f7140c569311916fb91
3
+ metadata.gz: 7529c565c34774903cc1727c3ec2e4e7ca1215ccc4e841689b47d2c78283fccb
4
+ data.tar.gz: 2ad09edb5e7cf89d8041b834da41ad2650f58919ba6d6d7d766288cce575cffc
5
5
  SHA512:
6
- metadata.gz: 306269e3089ef8752a1a3e31dac6134fae4515fbc0099b53ff5f57077ccb20e782d0c32905e81497a87b0995747d3c1144ce342758e49133e6d7c74bad12bee2
7
- data.tar.gz: c0de1e483011775a1d113d2d76ee33e80c8abde5e10b234aca0640e7ef83785fa58a8b0c1809fa0c3864f5e1de23c8f33776384374d6377d36061c89a5412c40
6
+ metadata.gz: 5eb08ff8a874e132aa0facb4c1f6604e04ed2336e6d6e771bd481267f147bfe955f3a820f282cc4444048af2c9935f3252716a795bacc0d14887c4997557efa4
7
+ data.tar.gz: 451ab8d8c73d3737bb935541e732c130552535117535de805aa6a2ea641802714a519f82af409baf9eb60dc9e10edddc944bd8420d5f108f92520f02ae6a430d
data/README.md CHANGED
@@ -9,7 +9,7 @@ A Ruby gem to manipulate the BeagleBone and BeagleBone Black ADC and GPIOs
9
9
  ```ruby
10
10
  require 'beagleboard'
11
11
 
12
- device = BeagleBone::BeagleBoneBlack.new
12
+ device = BeagleBoard::BeagleBoneBlack.new
13
13
 
14
14
  # ADCs access
15
15
  device.p9_39.scale = 100
data/lib/beagleboard.rb CHANGED
@@ -2,5 +2,5 @@ require 'beagleboard/beaglebone'
2
2
  require 'beagleboard/beagleboneblack'
3
3
  require 'beagleboard/version'
4
4
 
5
- module Beagleboard
5
+ module BeagleBoard
6
6
  end
@@ -6,7 +6,11 @@ module BeagleBoard
6
6
  def initialize(_adc, scale = 2**12)
7
7
  @scale = scale
8
8
 
9
- enable
9
+ enable unless enabled?
10
+ end
11
+
12
+ def enabled?
13
+ raise StandardError, 'Not supported'
10
14
  end
11
15
 
12
16
  def enable
@@ -13,6 +13,14 @@ module BeagleBoard
13
13
  attach_function :sysctlbyname, %i[string pointer pointer pointer size_t], :int
14
14
  attach_function :sysctlnametomib, %i[string pointer pointer], :int
15
15
 
16
+ def self.enabled?(mib)
17
+ buf = FFI::MemoryPointer.new(:int)
18
+ bufsiz = FFI::MemoryPointer.new(:int).write_int(buf.size)
19
+ res = sysctl(mib, 6, buf, bufsiz, nil, 0)
20
+ raise StandardError, 'Read error' if res < 0
21
+ buf.read_int == 1
22
+ end
23
+
16
24
  def self.enable(mib)
17
25
  buf = FFI::MemoryPointer.new(:int).write_int(1)
18
26
  res = sysctl(mib, 6, nil, nil, buf, buf.size)
@@ -44,6 +52,10 @@ module BeagleBoard
44
52
  super
45
53
  end
46
54
 
55
+ def enabled?
56
+ Adc.enabled?(@enable_mib)
57
+ end
58
+
47
59
  def enable
48
60
  Adc.enable(@enable_mib)
49
61
  end
@@ -9,6 +9,8 @@ module BeagleBoard
9
9
  super
10
10
  end
11
11
 
12
+ def enabled?; end
13
+
12
14
  def enable; end
13
15
 
14
16
  def disable; end
@@ -1,3 +1,3 @@
1
1
  module Beagleboard
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beagleboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - atome
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.7.6
135
+ rubygems_version: 2.7.7
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Library to manipulate beagleBoard devices.