module ChipGPIO
*** TODO *** Reads *** Baudrate *** Phase
Public Class Methods
get_pins()
click to toggle source
# File lib/chip-gpio/Pin.rb, line 194 def self.get_pins cis = [132, 133, 134, 135, 136, 137, 138, 139 ] xio = [] xio_base = get_xio_base() (0..7).each { |i| xio << (xio_base + i) } pins = {} cis.each_with_index { |gpio, index| sym = "CSI#{index}".to_sym; pins[sym] = Pin::Pin.new(gpio, sym) } xio.each_with_index { |gpio, index| sym = "XIO#{index}".to_sym; pins[sym] = Pin::Pin.new(gpio, sym) } return pins end
get_xio_base()
click to toggle source
# File lib/chip-gpio/Pin.rb, line 179 def self.get_xio_base labels = Dir::glob("/sys/class/gpio/*/label") labels.each do |label| value = File.read(label).strip if value == "pcf8574a" base_path = File.dirname(label) base_path = File.join(base_path, 'base') base = File.read(base_path).strip return base.to_i end end throw "Could not find XIO base" end