Class: Pigpio::GPIO

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

Direct Known Subclasses

UserGPIO

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pi, gpio) ⇒ GPIO

Returns a new instance of GPIO.



4
5
6
7
# File 'lib/pigpio/gpio.rb', line 4

def initialize(pi, gpio)
  @pi = pi # 0-15
  @gpio = gpio # 0-53
end

Instance Attribute Details

#gpioObject (readonly)

Returns the value of attribute gpio.



3
4
5
# File 'lib/pigpio/gpio.rb', line 3

def gpio
  @gpio
end

#piObject (readonly)

Returns the value of attribute pi.



3
4
5
# File 'lib/pigpio/gpio.rb', line 3

def pi
  @pi
end

Instance Method Details

#hardware_clock(clkfreq) ⇒ Object



29
30
31
# File 'lib/pigpio/gpio.rb', line 29

def hardware_clock(clkfreq)
  ret = IF.hardware_clock(@pi, @gpio, clkfreq)
end

#hardware_PWM(vPWMfreq, vPWMduty) ⇒ Object



33
34
35
# File 'lib/pigpio/gpio.rb', line 33

def hardware_PWM(vPWMfreq, vPWMduty)
  ret = IF.hardware_PWM(@pi, @gpio, vPWMfreq, vPWMduty)
end

#modeObject



13
14
15
# File 'lib/pigpio/gpio.rb', line 13

def mode
  ret = IF.get_mode(@pi, @gpio)
end

#mode=(mode) ⇒ Object



9
10
11
# File 'lib/pigpio/gpio.rb', line 9

def mode=(mode)
  ret = IF.set_mode(@pi, @gpio, mode)
end

#pud=(pud) ⇒ Object



17
18
19
# File 'lib/pigpio/gpio.rb', line 17

def pud=(pud)
  ret = IF.set_pull_up_down(@pi, @gpio, pud)
end

#readObject



21
22
23
# File 'lib/pigpio/gpio.rb', line 21

def read
  ret = IF.gpio_read(@pi, @gpio)
end

#write(level) ⇒ Object



25
26
27
# File 'lib/pigpio/gpio.rb', line 25

def write(level)
  ret = IF.gpio_write(@pi, @gpio, level)
end