Class: PiDriver::Pin::DirectoryHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/pi_driver/pin/directory_helper.rb

Constant Summary collapse

DIR_BASE =

TODO: figure out environment variables for test DIR_BASE = ‘/sys/class’

File.expand_path '~/pi/gpio/sys/class'
DIR_GPIO =
"#{DIR_BASE}/gpio".freeze

Instance Method Summary collapse

Constructor Details

#initialize(gpio_number) ⇒ DirectoryHelper

Returns a new instance of DirectoryHelper.



9
10
11
# File 'lib/pi_driver/pin/directory_helper.rb', line 9

def initialize(gpio_number)
  @gpio_number = gpio_number
end

Instance Method Details

#directionObject



13
14
15
# File 'lib/pi_driver/pin/directory_helper.rb', line 13

def direction
  "#{dir_pin}/direction"
end

#exportObject



17
18
19
# File 'lib/pi_driver/pin/directory_helper.rb', line 17

def export
  "#{DIR_GPIO}/export"
end

#valueObject



21
22
23
# File 'lib/pi_driver/pin/directory_helper.rb', line 21

def value
  "#{dir_pin}/value"
end