object_oriented_beaglebone_black 0.2.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b12eebdcfd145dcf383e623349d7f844241b2ad
4
- data.tar.gz: 52b1e565447eda98535b8e03a7a8363d8d2a8d10
3
+ metadata.gz: 0d50d4a5e405aaf4a8a2eb0cc753003898af3727
4
+ data.tar.gz: 77570e9e927f7e0dba758f41fa49b92c31ea60a9
5
5
  SHA512:
6
- metadata.gz: 673e08d66213879c0b2350598309a087161363dd0796e2ee08600d76dbbbcad768ce0bebb2e8a10910c0dab16486e047065de07195639ec3efa8b958cf99c4aa
7
- data.tar.gz: 567ad8f836785de958d232f041440d3df89f40ababaae1b6c30032dcb4d0578e4da57efef0769baeca6096ffbd438b428eaff609035f6bd41f06b81c5204eddc
6
+ metadata.gz: e89d8f813c455dfae761bf9d7a0631a732289b2187bb3256fd614e4c393ddeb69c7077918bbb2f7f8d78f5ada765847bd0623889fd8b2665091e08d977a859a0
7
+ data.tar.gz: ee89313d3c4dfadbd391336e54ee09f8087bf040bf1efdcccdeb5f4f5a2623383a4c1955dceed970e646d5ad7b1c6d02542f412d48589d54c5ed2ee86bc974a8
data/CHANGELOG.md CHANGED
@@ -1,19 +1,3 @@
1
- ## object_oriented_beaglebone_black 0.0.2 (December 26, 2014) ##
2
-
3
- * GPIO
4
-
5
- * Analog input
6
-
7
- * PWM
8
-
9
- ## object_oriented_beaglebone_black 0.1.0 ##
10
-
11
- There is no 0.1.0. I simply made a mistake to change the version to 0.2.0, after changing the version to 0.1.1 in one commit.
12
-
13
- ## object_oriented_beaglebone_black 0.2.0 (September 26, 2015) ##
14
-
15
- * PWM period can be set and read.
16
-
17
1
  ## object_oriented_beaglebone_black 0.2.1 (September 27, 2015) ##
18
2
 
19
3
  * When the PWM period is set, the internal "duty" value is modified automatically to keep the same duty cycle.
@@ -33,3 +17,19 @@ There is no 0.1.0. I simply made a mistake to change the version to 0.2.0, after
33
17
  When "period" is modified to be 10000, "duty" is modified to be 5000, which gives the duty cycle 5000 / 10000 = 0.5.
34
18
 
35
19
  Note: This can be considered to be incompatible API change. However, at this point, it is not yet considered to be a stable public API. Hence, the MAJOR version is kept to be 0. (See, [Semantic Versioning](http://semver.org/))
20
+
21
+ ## object_oriented_beaglebone_black 0.2.0 (September 26, 2015) ##
22
+
23
+ * PWM period can be set and read.
24
+
25
+ ## object_oriented_beaglebone_black 0.1.0 ##
26
+
27
+ There is no 0.1.0. I simply made a mistake to change the version to 0.2.0, after changing the version to 0.1.1 in one commit.
28
+
29
+ ## object_oriented_beaglebone_black 0.0.2 (December 26, 2014) ##
30
+
31
+ * GPIO
32
+
33
+ * Analog input
34
+
35
+ * PWM
@@ -1,6 +1,7 @@
1
1
  require 'object_oriented_beaglebone_black'
2
2
 
3
3
  require 'current_measurement/current_input'
4
+ require 'current_measurement/current_input_with_point04_shunt'
4
5
 
5
6
  module CurrentMeasurement
6
7
  # Your code goes here...
@@ -0,0 +1,12 @@
1
+ require 'bigdecimal'
2
+
3
+ module CurrentMeasurement
4
+ class CurrentInputWithPoint04Shunt < CurrentInput
5
+
6
+ def value
7
+ # Conversion for 0.04 Ohm shunt resistance Breakout.
8
+ (@analog_input.raw_value / BigDecimal("0.04")).to_f
9
+ end
10
+
11
+ end
12
+ end
@@ -1,6 +1,7 @@
1
1
  require 'object_oriented_beaglebone_black'
2
2
 
3
3
  require 'voltage_measurement/voltage_input'
4
+ require 'voltage_measurement/voltage_input_with_100k_and_20k_voltage_divider'
4
5
 
5
6
  module VoltageMeasurement
6
7
  # Your code goes here...
@@ -0,0 +1,12 @@
1
+ require 'bigdecimal'
2
+
3
+ module VoltageMeasurement
4
+ class VoltageInputWith100kAnd20kVoltageDivider < VoltageInput
5
+
6
+ def value
7
+ # For voltage divider 6:1, e.g. 100[kΩ] and 20[kΩ].
8
+ (@analog_input.raw_value * BigDecimal("6")).to_f
9
+ end
10
+
11
+ end
12
+ end
@@ -14,7 +14,11 @@ module ObjectOrientedBeagleboneBlack
14
14
  def activate_device_tree_overlays
15
15
  # Note: Since slots file acts as an interface to activate Device Tree Overlay, simply writing to it does what needs to be done.
16
16
  # I'm using appending here so that testing in a local environment becomes straightfoward.
17
- File.open(@slots_file_path, "a") { |file| file.write("cape-bone-iio") }
17
+ # Note: Closing this file caused an error in BeagleBone Black:
18
+ # Errno::EEXIST: File exists @ fptr_finalize - /sys/devices/bone_capemgr.9/slots
19
+ # So modified the code not to close the file.
20
+ # File.open(@slots_file_path, "a") { |file| file.write("cape-bone-iio") }
21
+ File.open(@slots_file_path, "a").write("cape-bone-iio")
18
22
  end
19
23
 
20
24
  def raw_value
@@ -1,3 +1,3 @@
1
1
  module ObjectOrientedBeagleboneBlack
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_oriented_beaglebone_black
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadatoshi Takahashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,8 +76,10 @@ files:
76
76
  - config/uarts.json
77
77
  - examples/current_measurement.rb
78
78
  - examples/current_measurement/current_input.rb
79
+ - examples/current_measurement/current_input_with_point04_shunt.rb
79
80
  - examples/voltage_measurement.rb
80
81
  - examples/voltage_measurement/voltage_input.rb
82
+ - examples/voltage_measurement/voltage_input_with_100k_and_20k_voltage_divider.rb
81
83
  - lib/object_oriented_beaglebone_black.rb
82
84
  - lib/object_oriented_beaglebone_black/analog_input.rb
83
85
  - lib/object_oriented_beaglebone_black/gpio.rb