Class: Pigpio::GPIO
- Inherits:
-
Object
- Object
- Pigpio::GPIO
- Defined in:
- lib/pigpio/gpio.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#gpio ⇒ Object
readonly
Returns the value of attribute gpio.
-
#pi ⇒ Object
readonly
Returns the value of attribute pi.
Instance Method Summary collapse
- #hardware_clock(clkfreq) ⇒ Object
- #hardware_PWM(vPWMfreq, vPWMduty) ⇒ Object
-
#initialize(pi, gpio) ⇒ GPIO
constructor
A new instance of GPIO.
- #mode ⇒ Object
- #mode=(mode) ⇒ Object
- #pud=(pud) ⇒ Object
- #read ⇒ Object
- #write(level) ⇒ Object
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
#gpio ⇒ Object (readonly)
Returns the value of attribute gpio.
3 4 5 |
# File 'lib/pigpio/gpio.rb', line 3 def gpio @gpio end |
#pi ⇒ Object (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 |
#mode ⇒ Object
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 |
#read ⇒ Object
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 |