Initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
DESCRIPTION = "Package that provides access to GPIO and other IO\
|
||||
functions on the Broadcom BCM 2835 chip, allowing access to the\
|
||||
GPIO pins on the 26 pin IDE plug on the RPi board"
|
||||
SECTION = "base"
|
||||
HOMEPAGE = "http://www.open.com.au/mikem/bcm2835"
|
||||
AUTHOR = "Mike McCauley (mikem@open.com.au)"
|
||||
|
||||
LICENSE = "GPL-3.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=e49f4652534af377a713df3d9dec60cb"
|
||||
|
||||
COMPATIBLE_MACHINE = "^rpi$"
|
||||
|
||||
SRC_URI = "http://www.airspayce.com/mikem/bcm2835/bcm2835-${PV}.tar.gz"
|
||||
|
||||
SRC_URI[md5sum] = "9bd2d39bf4b3a9e81dce799ca51c826a"
|
||||
SRC_URI[sha256sum] = "564920d205977d7e2846e434947708455d468d3a952feca9faef643abd03a227"
|
||||
|
||||
inherit autotools
|
||||
|
||||
do_compile:append() {
|
||||
# Now compiling the examples provided by the package
|
||||
mkdir -p ${B}/examples/spiram
|
||||
for file in `ls ${S}/examples`; do
|
||||
example="$file"
|
||||
if [ "$file" = "spiram" ]; then
|
||||
# This includes a tiny library
|
||||
EXAMPLE_LDFLAGS="-L${B}/examples/spiram -lspiram"
|
||||
example="spiram_test"
|
||||
${CC} ${CFLAGS} -c ${S}/examples/spiram/spiram.c -o ${B}/examples/spiram/libspiram.o -I${S}/src -I${S}/examples/spiram
|
||||
rm -f ${B}/examples/spiram/libspiram.a && ${BUILD_AR} crD ${B}/examples/spiram/libspiram.a ${B}/examples/spiram/libspiram.o
|
||||
fi
|
||||
${CC} ${LDFLAGS} ${S}/examples/${file}/${example}.c -o ${B}/examples/${example} -Bstatic -L${B}/src -lbcm2835 ${EXAMPLE_LDFLAGS} -I${S}/src
|
||||
done
|
||||
}
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}/${libdir}/${BPN}
|
||||
for example in $(find ${B}/examples -type f -maxdepth 1)
|
||||
do
|
||||
install -m 0755 ${example} ${D}/${libdir}/${BPN}
|
||||
done
|
||||
}
|
||||
|
||||
PACKAGES += "${PN}-tests"
|
||||
|
||||
RDEPENDS:${PN}-dev = ""
|
||||
|
||||
FILES:${PN} = ""
|
||||
FILES:${PN}-tests = "${libdir}/${BPN}"
|
||||
FILES:${PN}-dbg += "${libdir}/${BPN}/.debug"
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
From 1338f98a279616f4e5e9ea30a25d1dfa0c7df5d6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petter=20Mab=C3=A4cker?= <petter@technux.se>
|
||||
Date: Sun, 4 Jun 2017 12:22:40 +0200
|
||||
Subject: [PATCH] Remove dependencies on LSB functions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
See this as a rebase of the previous 'Remove dependencies on LSB
|
||||
functions patch' with only minor modifications from the original version,
|
||||
based on the work done by Alex Lennon <ajlennon@dynamicdevices.co.uk> in
|
||||
'25fd817 pi-blaster: Added recipe'.
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
|
||||
Signed-off-by: Petter Mabäcker <petter@technux.se>
|
||||
---
|
||||
debian/pi-blaster.init | 38 +++++++-------------------------------
|
||||
1 file changed, 7 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/debian/pi-blaster.init b/debian/pi-blaster.init
|
||||
index b142d70..01a686c 100644
|
||||
--- a/debian/pi-blaster.init
|
||||
+++ b/debian/pi-blaster.init
|
||||
@@ -28,12 +28,12 @@ SCRIPTNAME=/etc/init.d/$NAME
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
-. /lib/init/vars.sh
|
||||
+#. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||
# and status_of_proc is working.
|
||||
-. /lib/lsb/init-functions
|
||||
+#. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
@@ -77,48 +77,24 @@ do_stop()
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
+ [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
- case "$?" in
|
||||
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
- esac
|
||||
;;
|
||||
stop)
|
||||
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
+ [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
- case "$?" in
|
||||
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
- esac
|
||||
- ;;
|
||||
- status)
|
||||
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
- log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
+ echo "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
- case "$?" in
|
||||
- 0|1)
|
||||
- do_start
|
||||
- case "$?" in
|
||||
- 0) log_end_msg 0 ;;
|
||||
- 1) log_end_msg 1 ;; # Old process is still running
|
||||
- *) log_end_msg 1 ;; # Failed to start
|
||||
- esac
|
||||
- ;;
|
||||
- *)
|
||||
- # Failed to stop
|
||||
- log_end_msg 1
|
||||
- ;;
|
||||
- esac
|
||||
+ do_start
|
||||
;;
|
||||
*)
|
||||
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
DESCRIPTION = "This project enables PWM on the GPIO pins you request of a Raspberry Pi."
|
||||
HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
|
||||
SECTION = "devel/libs"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://README.md;beginline=295;endline=319;md5=86d10e4bcf4b4014d306dde7c1d2a80d"
|
||||
|
||||
SRC_URI = "git://github.com/sarfata/pi-blaster;branch=master;protocol=https \
|
||||
file://remove-initscript-lsb-dependency.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
SRCREV = "fbba9a7dcef0f352a11f8a2a5f6cbc15b62c0829"
|
||||
|
||||
inherit update-rc.d autotools
|
||||
|
||||
INITSCRIPT_PACKAGES = "${PN}"
|
||||
INITSCRIPT_NAME:${PN} = "${PN}.boot.sh"
|
||||
INITSCRIPT_PARAMS:${PN} = "defaults 15 85"
|
||||
|
||||
COMPATIBLE_MACHINE = "^rpi$"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "CircuitPython data descriptor classes to represent hardware registers on I2C and SPI devices."
|
||||
HOMEPAGE = "https://github.com/adafruit/Adafruit_CircuitPython_Register"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=6ec69d6e9e6c85adfb7799d7f8cf044e"
|
||||
|
||||
SRC_URI = "git://github.com/adafruit/Adafruit_CircuitPython_Register.git;branch=main;protocol=https"
|
||||
SRCREV = "d1e8ac7ad9dcd65ab83749db3e5c96ffee80ebb7"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
DEPENDS += "python3-setuptools-scm-native"
|
||||
|
||||
inherit setuptools3
|
||||
|
||||
RDEPENDS:${PN} += "python3-core"
|
||||
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "Platform detection for use by libraries like Adafruit-Blinka."
|
||||
HOMEPAGE = "https://github.com/adafruit/Adafruit_Python_PlatformDetect"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=fccd531dce4b989c05173925f0bbb76c"
|
||||
|
||||
SRC_URI = "git://github.com/adafruit/Adafruit_Python_PlatformDetect.git;branch=main;protocol=https"
|
||||
SRCREV = "e1460098eeca5ea573f92814691bb378e15530d9"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit setuptools3
|
||||
|
||||
DEPENDS += "python3-setuptools-scm-native"
|
||||
|
||||
RDEPENDS:${PN} += "python3-core"
|
||||
@@ -0,0 +1,19 @@
|
||||
SUMMARY = "Pure python (i.e. no native extensions) access to Linux IO including I2C and SPI. Drop in replacement for smbus and spidev modules."
|
||||
HOMEPAGE = "https://github.com/adafruit/Adafruit_Python_PureIO"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=2a21fcca821a506d4c36f7bbecc0d009"
|
||||
|
||||
SRC_URI = "git://github.com/adafruit/Adafruit_Python_PureIO.git;branch=main;protocol=https"
|
||||
SRCREV = "383b615ce9ff5bbefdf77652799f380016fda353"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit setuptools3
|
||||
|
||||
DEPENDS += "python3-setuptools-scm-native"
|
||||
|
||||
RDEPENDS:${PN} += " \
|
||||
python3-core \
|
||||
python3-ctypes \
|
||||
python3-fcntl \
|
||||
"
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
From c3aa4af56652b403e304ea5f321acfe289e42922 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 30 Jan 2016 16:07:14 -0800
|
||||
Subject: [PATCH] include asm/ioctl.h for ioctl() define
|
||||
|
||||
also fixes errors e.g.
|
||||
|
||||
../../RTIMULib/RTIMUHal.cpp:208:29: error: '_IOC_SIZEBITS' was not
|
||||
declared in this scope
|
||||
return ioctl(m_SPI, SPI_IOC_MESSAGE(1), &wrIOC);
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Upstream-Status: Submitted
|
||||
|
||||
RTIMULib/RTIMUHal.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/RTIMULib/RTIMUHal.cpp b/RTIMULib/RTIMUHal.cpp
|
||||
index f9c3d15..d968326 100644
|
||||
--- a/RTIMULib/RTIMUHal.cpp
|
||||
+++ b/RTIMULib/RTIMUHal.cpp
|
||||
@@ -29,6 +29,7 @@
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
|
||||
#include <linux/spi/spidev.h>
|
||||
+#include <asm/ioctl.h>
|
||||
|
||||
RTIMUHal::RTIMUHal()
|
||||
{
|
||||
--
|
||||
2.7.0
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
From f5ab30abd37ee884fb3ccaad0a8d21108ca2c812 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 28 Feb 2022 21:37:19 -0800
|
||||
Subject: [PATCH] setup.py: Port to use setuptools
|
||||
|
||||
Needed to get it going with wheel, distutils is deprecated for long
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Linux/python/setup.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Linux/python/setup.py b/Linux/python/setup.py
|
||||
index e429e6f..da96843 100644
|
||||
--- a/Linux/python/setup.py
|
||||
+++ b/Linux/python/setup.py
|
||||
@@ -22,7 +22,7 @@
|
||||
#// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-from distutils.core import setup, Extension
|
||||
+from setuptools import setup, Extension
|
||||
import os.path
|
||||
|
||||
RTIMU_sources = [
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
DESCRIPTION = "RTIMULib is a C++ and Python library that makes it easy to use 9-dof and \
|
||||
10-dof IMUs with embedded Linux systems"
|
||||
HOMEPAGE = "https://github.com/RPi-Distro/RTIMULib/"
|
||||
SECTION = "devel/python"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://../../LICENSE;md5=96cdecb41125f498958e09b72faf318e"
|
||||
|
||||
SRC_URI = "git://github.com/RPi-Distro/RTIMULib.git;protocol=http;branch=master;protocol=https \
|
||||
file://0001-include-asm-ioctl.h-for-ioctl-define.patch;patchdir=../.. \
|
||||
file://0001-setup.py-Port-to-use-setuptools.patch;patchdir=../.. \
|
||||
"
|
||||
SRCREV = "b949681af69b45f0f7f4bb53b6770037b5b02178"
|
||||
|
||||
S = "${WORKDIR}/git/Linux/python"
|
||||
inherit setuptools3
|
||||
@@ -0,0 +1,265 @@
|
||||
From 23d7ab77865f8b17042f5cd4c6720cca475e0eb5 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 13 Jan 2016 14:27:10 -0800
|
||||
Subject: [PATCH] Remove nested functions
|
||||
|
||||
nested functions are not supported on llvm/clang compiler, replacing
|
||||
them helps make code portable and be compilable with non-gcc compilers
|
||||
additionally fix the diagnostic messages clang reported
|
||||
|
||||
source/c_gpio.c:130:18: warning: comparison of distinct pointer types
|
||||
('volatile uint32_t *' (aka 'volatile unsigned int *') an
|
||||
d 'void *') [-Wcompare-distinct-pointer-types]
|
||||
if (gpio_map < MAP_FAILED)
|
||||
~~~~~~~~ ^ ~~~~~~~~~~
|
||||
|
||||
source/c_gpio.c:89:13: warning: variable 'peri_base' is used
|
||||
uninitialized whenever 'if' condition is false [-Wsometimes-uninit
|
||||
ialized]
|
||||
if (fread(buf, 1, sizeof buf, fp) == sizeof buf) {
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
source/c_gpio.c:116:17: note: uninitialized use occurs here
|
||||
gpio_base = peri_base + GPIO_BASE_OFFSET;
|
||||
^~~~~~~~~
|
||||
source/c_gpio.c:89:9: note: remove the 'if' if its condition is always
|
||||
true
|
||||
if (fread(buf, 1, sizeof buf, fp) == sizeof buf) {
|
||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
source/c_gpio.c:64:23: note: initialize the variable 'peri_base' to
|
||||
silence this warning
|
||||
uint32_t peri_base;
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Pierre-Jean: update for version 0.7.0]
|
||||
Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
|
||||
---
|
||||
Upstream-Status: Submitted
|
||||
|
||||
source/c_gpio.c | 6 +--
|
||||
source/py_gpio.c | 135 ++++++++++++++++++++++++++++---------------------------
|
||||
2 files changed, 71 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/source/py_gpio.c b/source/py_gpio.c
|
||||
index d54cc7f..007bad5 100644
|
||||
--- a/source/py_gpio.c
|
||||
+++ b/source/py_gpio.c
|
||||
@@ -69,6 +69,20 @@ static int mmap_gpio_mem(void)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+static inline int cleanup_one(unsigned int gpio)
|
||||
+{
|
||||
+ // clean up any /sys/class exports
|
||||
+ event_cleanup(gpio);
|
||||
+
|
||||
+ // set everything back to input
|
||||
+ if (gpio_direction[gpio] != -1) {
|
||||
+ setup_gpio(gpio, INPUT, PUD_OFF);
|
||||
+ gpio_direction[gpio] = -1;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
||||
// python function cleanup(channel=None)
|
||||
static PyObject *py_cleanup(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
@@ -83,19 +97,6 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
PyObject *tempobj;
|
||||
static char *kwlist[] = {"channel", NULL};
|
||||
|
||||
- void cleanup_one(void)
|
||||
- {
|
||||
- // clean up any /sys/class exports
|
||||
- event_cleanup(gpio);
|
||||
-
|
||||
- // set everything back to input
|
||||
- if (gpio_direction[gpio] != -1) {
|
||||
- setup_gpio(gpio, INPUT, PUD_OFF);
|
||||
- gpio_direction[gpio] = -1;
|
||||
- found = 1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist, &chanlist))
|
||||
return NULL;
|
||||
|
||||
@@ -140,7 +141,7 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
} else if (channel != -666) { // channel was an int indicating single channel
|
||||
if (get_gpio_number(channel, &gpio))
|
||||
return NULL;
|
||||
- cleanup_one();
|
||||
+ found = cleanup_one(gpio);
|
||||
} else { // channel was a list/tuple
|
||||
for (i=0; i<chancount; i++) {
|
||||
if (chanlist) {
|
||||
@@ -169,7 +170,7 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
|
||||
if (get_gpio_number(channel, &gpio))
|
||||
return NULL;
|
||||
- cleanup_one();
|
||||
+ found = cleanup_one(gpio);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,6 +183,37 @@ static PyObject *py_cleanup(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
+static inline int setup_one(unsigned int *gpio, int channel, int pud, int direction, int initial) {
|
||||
+ if (get_gpio_number(channel, gpio))
|
||||
+ return 0;
|
||||
+
|
||||
+ int func = gpio_function(*gpio);
|
||||
+ if (gpio_warnings && // warnings enabled and
|
||||
+ ((func != 0 && func != 1) || // (already one of the alt functions or
|
||||
+ (gpio_direction[*gpio] == -1 && func == 1))) // already an output not set from this program)
|
||||
+ {
|
||||
+ PyErr_WarnEx(NULL, "This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.", 1);
|
||||
+ }
|
||||
+
|
||||
+ // warn about pull/up down on i2c channels
|
||||
+ if (gpio_warnings) {
|
||||
+ if (rpiinfo.p1_revision == 0) { // compute module - do nothing
|
||||
+ } else if ((rpiinfo.p1_revision == 1 && (*gpio == 0 || *gpio == 1)) ||
|
||||
+ (*gpio == 2 || *gpio == 3)) {
|
||||
+ if (pud == PUD_UP || pud == PUD_DOWN)
|
||||
+ PyErr_WarnEx(NULL, "A physical pull up resistor is fitted on this channel!", 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (direction == OUTPUT && (initial == LOW || initial == HIGH)) {
|
||||
+ output_gpio(*gpio, initial);
|
||||
+ }
|
||||
+ setup_gpio(*gpio, direction, pud);
|
||||
+ gpio_direction[*gpio] = direction;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
// python function setup(channel(s), direction, pull_up_down=PUD_OFF, initial=None)
|
||||
static PyObject *py_setup_channel(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
@@ -195,37 +227,6 @@ static PyObject *py_setup_channel(PyObject *self, PyObject *args, PyObject *kwar
|
||||
int pud = PUD_OFF + PY_PUD_CONST_OFFSET;
|
||||
int initial = -1;
|
||||
static char *kwlist[] = {"channel", "direction", "pull_up_down", "initial", NULL};
|
||||
- int func;
|
||||
-
|
||||
- int setup_one(void) {
|
||||
- if (get_gpio_number(channel, &gpio))
|
||||
- return 0;
|
||||
-
|
||||
- func = gpio_function(gpio);
|
||||
- if (gpio_warnings && // warnings enabled and
|
||||
- ((func != 0 && func != 1) || // (already one of the alt functions or
|
||||
- (gpio_direction[gpio] == -1 && func == 1))) // already an output not set from this program)
|
||||
- {
|
||||
- PyErr_WarnEx(NULL, "This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.", 1);
|
||||
- }
|
||||
-
|
||||
- // warn about pull/up down on i2c channels
|
||||
- if (gpio_warnings) {
|
||||
- if (rpiinfo.p1_revision == 0) { // compute module - do nothing
|
||||
- } else if ((rpiinfo.p1_revision == 1 && (gpio == 0 || gpio == 1)) ||
|
||||
- (gpio == 2 || gpio == 3)) {
|
||||
- if (pud == PUD_UP || pud == PUD_DOWN)
|
||||
- PyErr_WarnEx(NULL, "A physical pull up resistor is fitted on this channel!", 1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (direction == OUTPUT && (initial == LOW || initial == HIGH)) {
|
||||
- output_gpio(gpio, initial);
|
||||
- }
|
||||
- setup_gpio(gpio, direction, pud);
|
||||
- gpio_direction[gpio] = direction;
|
||||
- return 1;
|
||||
- }
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii", kwlist, &chanlist, &direction, &pud, &initial))
|
||||
return NULL;
|
||||
@@ -290,7 +291,7 @@ static PyObject *py_setup_channel(PyObject *self, PyObject *args, PyObject *kwar
|
||||
} else if (chantuple) {
|
||||
chancount = PyTuple_Size(chantuple);
|
||||
} else {
|
||||
- if (!setup_one())
|
||||
+ if (!setup_one(&gpio, channel, pud, direction, initial))
|
||||
return NULL;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -320,12 +321,29 @@ static PyObject *py_setup_channel(PyObject *self, PyObject *args, PyObject *kwar
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (!setup_one())
|
||||
+ if (!setup_one(&gpio, channel, pud, direction, initial))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
+static inline int output_val(unsigned int *gpio, int channel, int value) {
|
||||
+ if (get_gpio_number(channel, gpio))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (gpio_direction[*gpio] != OUTPUT)
|
||||
+ {
|
||||
+ PyErr_SetString(PyExc_RuntimeError, "The GPIO channel has not been set up as an OUTPUT");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (check_gpio_priv())
|
||||
+ return 0;
|
||||
+
|
||||
+ output_gpio(*gpio, value);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
|
||||
// python function output(channel(s), value(s))
|
||||
static PyObject *py_output_gpio(PyObject *self, PyObject *args)
|
||||
@@ -342,23 +360,6 @@ static PyObject *py_output_gpio(PyObject *self, PyObject *args)
|
||||
int chancount = -1;
|
||||
int valuecount = -1;
|
||||
|
||||
- int output(void) {
|
||||
- if (get_gpio_number(channel, &gpio))
|
||||
- return 0;
|
||||
-
|
||||
- if (gpio_direction[gpio] != OUTPUT)
|
||||
- {
|
||||
- PyErr_SetString(PyExc_RuntimeError, "The GPIO channel has not been set up as an OUTPUT");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (check_gpio_priv())
|
||||
- return 0;
|
||||
-
|
||||
- output_gpio(gpio, value);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
if (!PyArg_ParseTuple(args, "OO", &chanlist, &valuelist))
|
||||
return NULL;
|
||||
|
||||
@@ -416,7 +417,7 @@ static PyObject *py_output_gpio(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
if (chancount == -1) {
|
||||
- if (!output())
|
||||
+ if (!output_val(&gpio, channel, value))
|
||||
return NULL;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -472,7 +473,7 @@ static PyObject *py_output_gpio(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
- if (!output())
|
||||
+ if (!output_val(&gpio, channel, value))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
--
|
||||
2.7.0
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
DESCRIPTION = "A module to control Raspberry Pi GPIO channels"
|
||||
HOMEPAGE = "https://sourceforge.net/projects/raspberry-gpio-python/"
|
||||
SECTION = "devel/python"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=a2294b0b1daabc30dfb5b3de73b2e00a"
|
||||
|
||||
PYPI_PACKAGE = "RPi.GPIO"
|
||||
|
||||
inherit pypi setuptools3
|
||||
|
||||
SRC_URI += "file://0001-Remove-nested-functions.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "cd61c4b03c37b62bba4a5acfea9862749c33c618e0295e7e90aa4713fb373b70"
|
||||
|
||||
COMPATIBLE_MACHINE = "^rpi$"
|
||||
@@ -0,0 +1,24 @@
|
||||
DESCRIPTION = "Advanced GPIO for the Raspberry Pi. Extends RPi.GPIO with PWM, \
|
||||
GPIO interrups, TCP socket interrupts, command line tools and more"
|
||||
HOMEPAGE = "https://github.com/metachris/RPIO"
|
||||
SECTION = "devel/python"
|
||||
LICENSE = "LGPL-3.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=bb3ca60759f3202f1ae42e3519cd06bc"
|
||||
|
||||
SRC_URI = "\
|
||||
git://github.com/metachris/RPIO.git;protocol=https;branch=master \
|
||||
"
|
||||
SRCREV = "be1942a69b2592ddacd9dc833d2668a19aafd8d2"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit setuptools3
|
||||
|
||||
COMPATIBLE_MACHINE = "^rpi$"
|
||||
|
||||
RDEPENDS:${PN} = "\
|
||||
python3-logging \
|
||||
python3-threading \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "cefc45422833dcafcd59b78dffc540f4"
|
||||
SRC_URI[sha256sum] = "b89f75dec9de354681209ebfaedfe22b7c178aacd91a604a7bd6d92024e4cf7e"
|
||||
@@ -0,0 +1,16 @@
|
||||
DESCRIPTION = "Tool to help debug / hack at the BCM283x GPIO"
|
||||
HOMEPAGE = "https://github.com/RPi-Distro/raspi-gpio"
|
||||
SECTION = "devel/libs"
|
||||
LICENSE = "BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=a14affa234debc057b47cdca615b2192"
|
||||
|
||||
COMPATIBLE_MACHINE = "^rpi$"
|
||||
|
||||
inherit autotools
|
||||
|
||||
SRCREV = "22b44e4765b4b78dc5b22394fff484e353d5914d"
|
||||
SRC_URI = "git://github.com/RPi-Distro/raspi-gpio.git;protocol=https;branch=master \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
Reference in New Issue
Block a user