pigpio 0.1.10 → 0.1.12

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/lib/pigpio.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "pigpio/version"
2
2
  require "pigpio/constant"
3
+ require "pigpio/buffer"
3
4
  require "pigpio/pigpio"
4
5
  require "pigpio/gpio"
5
6
  require "pigpio/user_gpio"
@@ -15,49 +16,59 @@ require "pigpio/i2c"
15
16
 
16
17
  class Pigpio
17
18
  attr_reader :pi
18
- def initialize(addr=nil,port=nil,&blk)
19
- @pi=IF.pigpio_start(addr,port)
19
+ def initialize(addr = nil, port = nil, &blk)
20
+ @pi = IF.pigpio_start(addr, port)
20
21
  if blk && connect
21
- blk.call(self)
22
+ blk.call(self)
22
23
  IF.pigpio_stop(@pi)
23
24
  end
24
25
  end
26
+
25
27
  def connect
26
- @pi>=0
28
+ @pi >= 0
27
29
  end
30
+
28
31
  def stop
29
32
  IF.pigpio_stop(@pi)
30
- @pi=-1
33
+ @pi = -1
31
34
  end
35
+
32
36
  def current_tick
33
37
  IF.get_current_tick(@pi)
34
38
  end
39
+
35
40
  def hardware_revision
36
41
  IF.get_hardware_revision(@pi)
37
42
  end
43
+
38
44
  def pigpio_version
39
45
  IF.get_pigpio_version(@pi)
40
46
  end
41
-
47
+
42
48
  def bank(num)
43
- Bank.new(@pi,num)
49
+ Bank.new(@pi, num)
44
50
  end
51
+
45
52
  def gpio(gpio)
46
- (gpio<32 ? UserGPIO : GPIO).new(@pi,gpio)
53
+ (gpio < 32 ? UserGPIO : GPIO).new(@pi, gpio)
47
54
  end
48
- def wave()
55
+
56
+ def wave
49
57
  Wave.new(@pi)
50
58
  end
51
- def serial(rx,tx=nil,baud=9600,data_bits=8,stop_bits=1,parity_type=:none)
52
- return BitBangSerialRx.new(rx,baud,data_bits) if tx==nil
53
- return BitBangSerialTx.new(tx,baud,data_bits,stop_bits) if rx==nil
54
- return BitBangSerial.new(rx,tx,baud,data_bits,stop_bits)
59
+
60
+ def serial(rx, tx = nil, baud = 9600, data_bits = 8, stop_bits = 1, parity_type = :none)
61
+ return BitBangSerialRx.new(rx, baud, data_bits) if tx.nil?
62
+ return BitBangSerialTx.new(tx, baud, data_bits, stop_bits) if rx.nil?
63
+ BitBangSerial.new(rx, tx, baud, data_bits, stop_bits)
55
64
  end
56
- def spi(spi_channel=0,enable_cex=1,baud=500000,
57
- bits_per_word: 8,first_MISO: false,first_MOSI: false,idol_bytes: 0,is_3wire: false,active_low_cex: 0,spi_mode: 0)
58
- SPI.new(@pi,spi_channel,enable_cex,baud,bits_per_word: bits_per_word,first_MISO:first_MISO,first_MOSI:first_MOSI,idol_bytes:idol_bytes,is_3wire:is_3wire,active_low_cex:active_low_cex,spi_mode:spi_mode)
65
+
66
+ def spi(spi_channel = 0, enable_cex = 1, baud = 500000,
67
+ bits_per_word: 8, first_MISO: false, first_MOSI: false, idol_bytes: 0, is_3wire: false, active_low_cex: 0, spi_mode: 0)
68
+ SPI.new(@pi, spi_channel, enable_cex, baud, bits_per_word: bits_per_word, first_MISO: first_MISO, first_MOSI: first_MOSI, idol_bytes: idol_bytes, is_3wire: is_3wire, active_low_cex: active_low_cex, spi_mode: spi_mode)
59
69
  end
60
- def i2c(i2c_bus,i2c_addr)
61
- I2C.new(@pi,i2c_bus,i2c_addr)
70
+
71
+ def i2c(i2c_bus, i2c_addr)
72
+ I2C.new(@pi, i2c_bus, i2c_addr)
62
73
  end
63
74
  end
data/pigpio.gemspec CHANGED
@@ -1,24 +1,23 @@
1
-
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "pigpio/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "pigpio"
8
- spec.version = Pigpio::VERSION
9
- spec.authors = ["nak1114"]
10
- spec.email = ["naktak1114@gmail.com"]
6
+ spec.name = "pigpio"
7
+ spec.version = Pigpio::VERSION
8
+ spec.authors = ["nak1114"]
9
+ spec.email = ["naktak1114@gmail.com"]
11
10
 
12
- spec.summary = %q{This gem is a ruby binding to a pigpio library.}
13
- spec.description = %q{This gem is a ruby binding to a pigpio library.}
14
- spec.homepage = "http://www.github.com/nak1114/ruby-extension-pigpio"
15
- spec.license = "MIT"
16
- spec.extensions = %w(ext/pigpio/extconf.rb)
11
+ spec.summary = "This gem is a ruby binding to a pigpio library."
12
+ spec.description = "This gem is a ruby binding to a pigpio library."
13
+ spec.homepage = "http://www.github.com/nak1114/ruby-extension-pigpio"
14
+ spec.license = "MIT"
15
+ spec.extensions = %w[ext/pigpio/extconf.rb]
17
16
 
18
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
20
19
  if spec.respond_to?(:metadata)
21
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
22
21
 
23
22
  spec.metadata["homepage_uri"] = spec.homepage
24
23
  spec.metadata["source_code_uri"] = spec.homepage
@@ -30,17 +29,17 @@ Gem::Specification.new do |spec|
30
29
 
31
30
  # Specify which files should be added to the gem when it is released.
32
31
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
34
33
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|example|test|spec|features)/}) }
35
34
  end
36
- spec.bindir = "exe"
37
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ["ext","lib"]
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["ext", "lib"]
39
38
 
40
- spec.required_ruby_version = '>= 2.0.0'
39
+ spec.required_ruby_version = ">= 2.0.0"
41
40
  spec.add_development_dependency "bundler", "> 1.17"
42
41
  spec.add_development_dependency "rake", "~> 10.0"
43
42
  spec.add_development_dependency "rspec", "~> 3.0"
44
43
  spec.add_development_dependency "rake-compiler", "~> 1.0"
45
-
44
+ spec.add_development_dependency "standard"
46
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigpio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - nak1114
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-17 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: standard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: This gem is a ruby binding to a pigpio library.
70
84
  email:
71
85
  - naktak1114@gmail.com
@@ -77,6 +91,7 @@ files:
77
91
  - ".dockerignore"
78
92
  - ".gitignore"
79
93
  - ".rspec"
94
+ - ".standard_todo.yml"
80
95
  - ".travis.yml"
81
96
  - CODE_OF_CONDUCT.md
82
97
  - Gemfile
@@ -95,6 +110,7 @@ files:
95
110
  - lib/pigpio/bit_bang_serial.rb
96
111
  - lib/pigpio/bit_bang_serial_rx.rb
97
112
  - lib/pigpio/bit_bang_serial_tx.rb
113
+ - lib/pigpio/buffer.rb
98
114
  - lib/pigpio/constant.rb
99
115
  - lib/pigpio/gpio.rb
100
116
  - lib/pigpio/i2c.rb
@@ -129,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
145
  version: '0'
130
146
  requirements: []
131
147
  rubyforge_project:
132
- rubygems_version: 2.6.11
148
+ rubygems_version: 2.7.6
133
149
  signing_key:
134
150
  specification_version: 4
135
151
  summary: This gem is a ruby binding to a pigpio library.