Class: WiringPi::Modules::ModuleBase

Inherits:
Object
  • Object
show all
Defined in:
lib/wiringpi.rb

Direct Known Subclasses

Mcp23017, Mcp23s17

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeModuleBase

Returns a new instance of ModuleBase.



29
30
31
32
33
34
# File 'lib/wiringpi.rb', line 29

def initialize
  @name = 'Unknown'
  @pin_base = 0
  @pin_count = 0
  @pin_end = 0
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/wiringpi.rb', line 27

def name
  @name
end

#pin_baseObject (readonly)

Returns the value of attribute pin_base.



27
28
29
# File 'lib/wiringpi.rb', line 27

def pin_base
  @pin_base
end

#pin_countObject (readonly)

Returns the value of attribute pin_count.



27
28
29
# File 'lib/wiringpi.rb', line 27

def pin_count
  @pin_count
end

#pin_endObject (readonly)

Returns the value of attribute pin_end.



27
28
29
# File 'lib/wiringpi.rb', line 27

def pin_end
  @pin_end
end

Instance Method Details

#newObject



36
37
38
39
# File 'lib/wiringpi.rb', line 36

def new
  @pin_end = @pin_base + @pin_count
  update_name
end

#update_nameObject



41
42
43
# File 'lib/wiringpi.rb', line 41

def update_name
  @name = " at offset #{@pin_base}"
end