omega2_gpio 0.1.06.pre.alpha02 → 0.1.06

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -14
  3. data/lib/omega2_gpio/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a78a1b7725c58604f843bf7ec51dfe8f55f7e39e768a779a837b7b9ea1e18289
4
- data.tar.gz: 048d6c243b1e1a8b13a1f770966e3e1cbf82c19d804e3c05188b05ad2c74f0bb
3
+ metadata.gz: ea30354a0dfe7f029fc3c8d648ff40a639ee918bff03ce72a23b1d46804e93fe
4
+ data.tar.gz: 8ed75907a59d5d3bd0d75a0b19bc201898c89f5b7aa0a860f3bc2d1965d4cf87
5
5
  SHA512:
6
- metadata.gz: 15d49af68f1a7b63ce34bbb3bea968bd1a0b2bb51b4e00162bb0ff0a7760a1659712d9dbdb2e68d14d120459125ae95f35966bfc0c970ebc5679384522982918
7
- data.tar.gz: 8d659b90de87c7a68d89d3e87e7d26a61e458696e863eb0241df915f25ecd4aeea97176fae97943a017a11034bec6b7258b83a09631036704554fd01e8bfaf06
6
+ metadata.gz: 3706c8721a7ce8986187d07e683a582faa349c221fc5d2e6be7767433719bdbfa1832ef128951a466002b224fa632263d804cec0836557274bccdc402c905259
7
+ data.tar.gz: 46960a16255c24b39ea9c606a8f90d95a9fe9108a56d6b8b29fa3185608db8461da40e231898969b0a874b0e89cd31fa6ab0b6ee8f8884adf54b05f7260b797c
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Ruby Gem to control Omega2 GPIO
2
2
 
3
3
  Control [Onion Omega2](https://onion.io/omega2/) GPIOs in ruby
4
+ TODO: Discribe mocking
4
5
 
5
6
  ## Installation
6
7
 
@@ -9,21 +10,66 @@ Add this line to your application's Gemfile:
9
10
  ```ruby
10
11
  gem 'omega2_gpio'
11
12
  ```
13
+ And then execute in Omega2's console
14
+ ```
15
+ bundle
16
+ ```
12
17
 
13
- And then execute:
18
+ Or install it yourself in Omega2's console
19
+ ```
20
+ gem install omega2_gpio
21
+ ```
22
+ use following to install latest, likely broken pre-release
23
+ ```
24
+ gem install omega2_gpio --pre
25
+ ```
14
26
 
15
- $ bundle
16
27
 
17
- Or install it yourself as:
28
+ ## Get Started
29
+ ### Get the System ready
30
+ Make sure Ruby is installed on your Omega2 with all needed extensions
31
+ Execute following in Omega2's console:
32
+ ```
33
+ opkg update
34
+ opkg install ruby
35
+ opkg install ruby-gems ruby-enc-extra ruby-openssl ca-certificates
36
+ ```
37
+ Install this Gem, still in Omega2's console:
38
+ ```
39
+ gem install omega2_gpio
40
+ ```
41
+ If you want to play around in the Ruby Console (IRB), like in the GIF below
42
+ install the IRB
43
+ ```
44
+ opkg update
45
+ opkg install ruby-irb
46
+ ```
18
47
 
19
- $ gem install omega2_gpio
48
+ ### Start playing
49
+ Execute following in Omega2's console to run the Ruby Console (IRB):
50
+ ```
51
+ irb
52
+ ```
53
+ Ruby console looks like Omega's console but the line should start like this
54
+ ````ruby
55
+ irb(main):001:0>
56
+ ````
57
+ go ahead and play around with one GPIO.
58
+ Use one GPIO where nothing is connected to, to not damage your hardware.
59
+ It is important to first require the gem, even though it is installed.
60
+ ````ruby
61
+ require "omega2_gpio"
62
+ ````
63
+ This way you switch Omega's GPIO1 from low to high
64
+ ````ruby
65
+ my_gpio = Omega2Gpio::Output.new(1).low
66
+ my_gpio.high
67
+ ````
68
+ ![alt text](https://github.com/freizeitnerd/omega2_gpio_examples/blob/master/media/omega2_gpio_irb.gif?raw=true "IRB Example to play with Omega2 GPIO in Ruby")
20
69
 
70
+ ## Usage
71
+ TODO: There will be more detailed documentation!!!
21
72
 
22
- ## Get Started
23
- An Omega2 GPIO can be
24
- - an Input
25
- - an Output or
26
- - a PWM-Output (not yet implemented in this Gem)
27
73
  ### Input GPIO
28
74
  To use GPIO1 as an input, just instantiate an Omega2GPIO::Input using the `new`methode and pass in the number of the GPIO to use. (In this case 1 for GPIO1)
29
75
  This will set the GPIO orientation to 'output'.
@@ -36,18 +82,36 @@ Read the value of this GPIO as follows
36
82
  my_input_gpio_value = my_input_gpio.read
37
83
  ```
38
84
 
39
- ## Usage
85
+ ## Configuration
86
+ The Gem can be configured with following the ``Omega2Gpio.configuration`` Object
87
+ ````ruby
88
+ Omega2Gpio.configuration.messaging_level = 0 # silent: No messages to STDOUT (puts)
89
+ Omega2Gpio.configuration.messaging_level = 1 # warn: puts only warnings
90
+ Omega2Gpio.configuration.messaging_level = 2 # debug: puts hints and fast-gpio commands
40
91
 
41
- TODO: Write usage instructions here
92
+ Omega2Gpio.configuration.mock = true # mocks all Omega2 depending commands as valid, like fast-gpio commands
93
+ Omega2Gpio.configuration.mock = false # no mock
94
+ ````
42
95
 
96
+ Create a ``config.rb`` to your project to configure omega2_gpio like described above.
97
+ Add the file to your ``.gitignore`` file. This way you can have devise dependent configuration.
98
+ - On your Omega2 set ``mock`` to ``false`` and ``messaging_level`` to ``0``
99
+ - On your development computer set ``mock`` to ``true`` and ``messaging_level`` to ``2`` to conveniently develop you business logic without touching Omega2 all the time.
43
100
 
44
- ## Contributing
101
+ ## Versioning
102
+ [Semantic Versioning](http://semver.org/) versioning is used. For the versions available, see the [tags on this repository](https://github.com/your/project/tags) or
103
+ [https://rubygems.org/gems/omega2_gpio](https://rubygems.org/gems/omega2_gpio).
45
104
 
46
- Bug reports and pull requests are welcome! This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
105
+ ## Contributing
106
+ Bug reports and pull requests are welcome! Feel free to refactor! This is my first Gem, I'll be glad to learn!
107
+ Please write tests! (see section testing)
47
108
 
109
+ ## Testing (TDD)
110
+ Run ```Rake``` to run all save tests that don't touch your hardware. They are all mocked.
111
+ Tests that may damage hardware belong to files ending with ```_test_may_damage_hardware.rb``` in the ```test``` folder.
112
+ Run tests that may damage hardware on Omega2 with ```rake damagingtest```.
48
113
 
49
114
  ## License
50
-
51
115
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
52
116
 
53
117
  ## Similar Gems
@@ -1,4 +1,4 @@
1
1
  # coding: utf-8
2
2
  module Omega2Gpio
3
- VERSION = "0.1.06-alpha02".freeze
3
+ VERSION = "0.1.06".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omega2_gpio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.06.pre.alpha02
4
+ version: 0.1.06
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sönke Ohls
@@ -106,9 +106,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 1.3.1
111
+ version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 2.7.2