Top Level Namespace
Defined Under Namespace
Modules: Denko
Instance Method Summary collapse
- #digital_read(pin) ⇒ Object
-
#digital_write(pin, value) ⇒ Object
DO NOT REQUIRE THIS FILE.
- #get_report ⇒ Object
Instance Method Details
#digital_read(pin) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/denko/piboard_core_optimize_lookup.rb', line 14 def digital_read(pin) if hardware_pwms[pin] state = hardware_pwms[pin].duty_percent else state = LGPIO.gpio_read(__GPIOCHIP_SINGLE_HANDLE__, pin) end self.update(pin, state) return state end |
#digital_write(pin, value) ⇒ Object
DO NOT REQUIRE THIS FILE. It is evaluated at runtime, if applicable.
Optimized method overrides when all GPIO pins are on one gpiochip.
6 7 8 9 10 11 12 |
# File 'lib/denko/piboard_core_optimize_lookup.rb', line 6 def digital_write(pin, value) if hardware_pwms[pin] hardware_pwms[pin].duty_percent = (value == 0) ? 0 : 100 else LGPIO.gpio_write(__GPIOCHIP_SINGLE_HANDLE__, pin, value) end end |
#get_report ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/denko/piboard_core_optimize_lookup.rb', line 24 def get_report report = LGPIO.gpio_get_report if report update(report[:gpio], report[:level]) else sleep REPORT_SLEEP_TIME end end |