pi_piper 2.0.beta.3 → 2.0.beta.4

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: 14f0ac39d4e0f23013f42d657d6bc68ccca9433b
4
- data.tar.gz: 3bb43ad2e9d6a72300f08990ca6b98850eae6026
3
+ metadata.gz: 4db33bd67174aa5889959cf3eddcb2e8b7a6ac7e
4
+ data.tar.gz: 2a9d53cc16b42c4642f99f15cfaa5600a990cd96
5
5
  SHA512:
6
- metadata.gz: 9a1358e44e9a4648d132323dfcd24bb1494cc2a5e77145499e5292372c6e317659c507421e4aebc34926529b194760b55b1bfe5517997c8166179d3d5230f819
7
- data.tar.gz: ce642bff726a8b60382ef781ca85b4097707bfe7f0154b6bb4f50cc442e838e4a8108b053583aa540578a082575b457dce7c303dfff0c51df0901b47cc2d58d5
6
+ metadata.gz: 33caeb1cc9c76871be9c7ea6c49bf2f738eff563bac9bc41bbb5febfbaeb6161a1bb3740cfa15b673f92da2b299a601a332fbd717481706fe6e2534a23d0987c
7
+ data.tar.gz: 3feece4a4633c52ad6ea15c6acbfd596cdc2ab1ee5c558002c2e934682f985a73419e2d9a861387a25a142438134d9b06386d1a9f724f87f824d6cdff8cb9943
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rake/testtask'
8
8
  #gem build pi_piper.gemspec
9
9
  #gem push xxx.gem
10
10
 
11
- Echoe.new('pi_piper', '2.0.beta.3') do |p|
11
+ Echoe.new('pi_piper', '2.0.beta.4') do |p|
12
12
  p.description = "Event driven Raspberry Pi GPIO library"
13
13
  p.url = "http://github.com/jwhitehorn/pi_piper"
14
14
  p.author = "Jason Whitehorn"
@@ -54,11 +54,12 @@ module PiPiper
54
54
  :bcm2835_spi_setChipSelectPolarity, [:uint8, :uint8], :void
55
55
 
56
56
  #I2C support...
57
- #attach_function :i2c_begin, :bcm2835_i2c_begin, [], :void
58
- #attach_function :i2c_end, :bcm2835_i2c_end, [], :void
59
- #attach_function :i2c_write, :bcm2835_i2c_write, [:pointer, :uint], :uint8
60
- #attach_function :i2c_set_address,:bcm2835_i2c_setSlaveAddress, [:uint8], :void
61
- #attach_function :i2c_set_clock_divider, :bcm2835_i2c_setClockDivider, [:uint16], :void
57
+ attach_function :i2c_begin, :bcm2835_i2c_begin, [], :void
58
+ attach_function :i2c_end, :bcm2835_i2c_end, [], :void
59
+ attach_function :i2c_write, :bcm2835_i2c_write, [:pointer, :uint], :uint8
60
+ attach_function :i2c_set_address,:bcm2835_i2c_setSlaveAddress, [:uint8], :void
61
+ attach_function :i2c_set_clock_divider, :bcm2835_i2c_setClockDivider, [:uint16], :void
62
+ attach_function :i2c_read, :bcm2835_i2c_read, [:pointer, :uint], :uint8
62
63
 
63
64
  def self.i2c_allowed_clocks
64
65
  [100.kilohertz,
@@ -84,5 +85,12 @@ module PiPiper
84
85
  i2c_write data_out, data.count
85
86
  end
86
87
 
88
+ def self.i2c_read_bytes(bytes)
89
+ data_in = FFI::MemoryPointer.new(bytes)
90
+ i2c_read(data_in, bytes) #TODO reason codes
91
+
92
+ (0..bytes-1).map { |i| data_in.get_uint8(i) }
93
+ end
94
+
87
95
  end
88
96
  end
@@ -43,6 +43,10 @@ module PiPiper
43
43
  Platform.driver.i2c_transfer_bytes data
44
44
  end
45
45
 
46
+ def read(bytes)
47
+ Platform.driver.i2c_read_bytes(bytes)
48
+ end
49
+
46
50
  end
47
51
 
48
52
  end
Binary file
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pi_piper"
5
- s.version = "2.0.beta.3"
5
+ s.version = "2.0.beta.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jason Whitehorn"]
9
- s.date = "2013-09-11"
9
+ s.date = "2013-09-14"
10
10
  s.description = "Event driven Raspberry Pi GPIO library"
11
11
  s.email = "jason.whitehorn@gmail.com"
12
12
  s.extra_rdoc_files = ["README.md", "lib/pi_piper.rb", "lib/pi_piper/bcm2835.rb", "lib/pi_piper/frequency.rb", "lib/pi_piper/i2c.rb", "lib/pi_piper/libbcm2835.img", "lib/pi_piper/pin.rb", "lib/pi_piper/platform.rb", "lib/pi_piper/spi.rb"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pi_piper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.beta.3
4
+ version: 2.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Whitehorn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2013-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi