Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4909

Advanced users • Re: Moving Linux Kernel to 6.6

$
0
0
GPIOZero can use several different pin factories. The suggestion is that you use lgpio:

https://gpiozero.readthedocs.io/en/late ... pins.lgpio

When the doc says "if no default factory can be constructed (e.g. because no GPIO implementations are installed, or all of them fail to load for whatever reason)" and "on a Raspberry Pi with the RPi.GPIO library installed, (assuming no environment variables are set), the default pin factory will be RPiGPIOFactory", I suspect you'll find that if "lgpio" is installed and RPi.GPIO isn't then "lgpio" will be the default. If not, you can change the default: https://gpiozero.readthedocs.io/en/late ... in-factory

In fact, you can see the order of preference in the code (https://github.com/gpiozero/gpiozero/bl ... es.py#L274):

Code:

        # We prefer lgpio here as it supports PWM, and all Pi revisions without        # banging on registers directly.  If no third-party libraries are        # available, however, we fall back to a pure Python implementation        # which supports platforms like PyPy        #        # NOTE: If the built-in pin factories are expanded, the dict must be        # updated along with the entry-points in setup.py.        default_factories = {            'lgpio':   'gpiozero.pins.lgpio:LGPIOFactory',            'rpigpio': 'gpiozero.pins.rpigpio:RPiGPIOFactory',            'pigpio':  'gpiozero.pins.pigpio:PiGPIOFactory',            'native':  'gpiozero.pins.native:NativeFactory',        }

Statistics: Posted by PhilE — Mon Apr 08, 2024 2:33 pm



Viewing all articles
Browse latest Browse all 4909

Trending Articles