question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for C.H.I.P.

See original GitHub issue

Hi,

First of all, great library! I use it to control my porch light through a component in Home Assitant. I recently migrated my setup from a RPi to a C.H.I.P. and noticed that this package does not work anymore. This because RPi.GPIO of course only works on a RPi. However there is a (almost) drop-in replacement for this dependency called CHIP_IO. The only method that CHIP_IO seems to lack is GPIO.setmode.

With this patch a got the library working on the C.H.I.P.:

diff --git a/rpi_rf/rpi_rf.py b/rpi_rf/rpi_rf.py
index 3949169..72c1e70 100644
--- a/rpi_rf/rpi_rf.py
+++ b/rpi_rf/rpi_rf.py
@@ -6,7 +6,10 @@ import logging
 import time
 from collections import namedtuple

-from RPi import GPIO
+try:
+    from RPi import GPIO
+except:
+    from CHIP_IO import GPIO

 MAX_CHANGES = 67

@@ -54,8 +57,11 @@ class RFDevice:
         self.rx_proto = None
         self.rx_bitlength = None
         self.rx_pulselength = None
-
-        GPIO.setmode(GPIO.BCM)
+        # the method 'setmode' is not available in CHIP_IO.GPIO
+        try:
+            GPIO.setmode(GPIO.BCM)
+        except:
+            pass
         _LOGGER.debug("Using GPIO " + str(gpio))

     def cleanup(self):

If you are willing to add support for C.H.I.P. I could make a PR out of this patch.

Cheers!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
nunojustocommented, Jan 4, 2017

Hello guys, i started porting rpi-rf (that i love) to CHIP using the new CHIP_IO.GPIO from @xtacocorex It’s working now… or sort of… you can check it out here https://github.com/nunojusto/CHIP-rf/

The problem is that i cannot have clear results and i’, working directly with CHIP_IO guy to solve some of the error. Please try and help if you can 😃 Thankx

EDIT: Oops, i see that “chrisvis” is advanced on it also. Lets share common problems.

@bachp @chrisvis @milaq

1reaction
bachpcommented, Oct 30, 2016

I think it would make more sense to make the module injectable by some means. This could then also be used for Beaglebone black with Adafruit_BBIO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Children's Health Insurance Program (CHIP) - Medicaid
The Children's Health Insurance Program (CHIP) provides health coverage to eligible children, through both Medicaid and separate CHIP programs. CHIP is ...
Read more >
Children's Health Insurance Program (CHIP)
Whatever the reason, if your child or teen is uninsured and ineligible for or enrolled in Medical Assistance, the Children's Health Insurance Program...
Read more >
CHIPS for America Act & FABS Act
In July 2022, Congress passed the CHIPS Act of 2022 to strengthen domestic semiconductor manufacturing, design and research, fortify the economy and ...
Read more >
FACT SHEET: CHIPS and Science Act Will Lower Costs ...
Today, President Biden will sign into law the bipartisan CHIPS and Science ... It will also support good-paying, union construction jobs by ...
Read more >
CHIPS bill: Here's what's in the bipartisan semiconductor chip ...
Congress has passed a bill that will invest more than $200 billion over the next five years to help the US regain a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found