From 7bd5f7f99f07e0d3ad2bc5b0f28994c5624b6e02 Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Thu, 23 Jul 2020 07:24:33 -0600 Subject: [PATCH] Update python wrapper - Newest version of BCM2835 driver removes SPI_SPEED constants. Update python wrapper to reflect these changes Per #610 - Correct mistake in constructor for python example --- examples_linux/pingpair_dyn.py | 2 +- pyRF24/pyRF24.cpp | 15 --------------- pyRF24/pyRF24/pyRF24.cpp | 15 --------------- pyRF24/pyRF24/setup.py | 2 +- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/examples_linux/pingpair_dyn.py b/examples_linux/pingpair_dyn.py index 2af5f619c..08a470fc2 100755 --- a/examples_linux/pingpair_dyn.py +++ b/examples_linux/pingpair_dyn.py @@ -21,7 +21,7 @@ # ie: RF24 radio(, *10+); spidev1.0 is 10, spidev1.1 is 11 etc.. # Generic: -RF24 radio(22,0); +radio = RF24(22,0); # RPi Alternate, with SPIDEV - Note: Edit RF24/arch/BBB/spi.cpp and set 'this->device = "/dev/spidev0.0";;' or as listed in /dev #radio = RF24(22, 0); diff --git a/pyRF24/pyRF24.cpp b/pyRF24/pyRF24.cpp index 6bb0a2109..dfb9dfa60 100644 --- a/pyRF24/pyRF24.cpp +++ b/pyRF24/pyRF24.cpp @@ -233,21 +233,6 @@ bp::enum_< bcm2835SPIChipSelect>("bcm2835SPIChipSelect") .value("BCM2835_SPI_CS_NONE", BCM2835_SPI_CS_NONE) .export_values(); -// exposing '#define's for SPI speed as this is needed for RF24 constructor -bp::scope().attr("BCM2835_SPI_SPEED_64MHZ") = BCM2835_SPI_SPEED_64MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_32MHZ") = BCM2835_SPI_SPEED_32MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_16MHZ") = BCM2835_SPI_SPEED_16MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_8MHZ") = BCM2835_SPI_SPEED_8MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_4MHZ") = BCM2835_SPI_SPEED_4MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_2MHZ") = BCM2835_SPI_SPEED_2MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_1MHZ") = BCM2835_SPI_SPEED_1MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_512KHZ") = BCM2835_SPI_SPEED_512KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_256KHZ") = BCM2835_SPI_SPEED_256KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_128KHZ") = BCM2835_SPI_SPEED_128KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_64KHZ") = BCM2835_SPI_SPEED_64KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_32KHZ") = BCM2835_SPI_SPEED_32KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_16KHZ") = BCM2835_SPI_SPEED_16KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_8KHZ") = BCM2835_SPI_SPEED_8KHZ; #endif // BCM2835_H bp::enum_("rf24_crclength_e").value("RF24_CRC_DISABLED", RF24_CRC_DISABLED).value("RF24_CRC_8", RF24_CRC_8).value( diff --git a/pyRF24/pyRF24/pyRF24.cpp b/pyRF24/pyRF24/pyRF24.cpp index ad14a95de..df4321857 100644 --- a/pyRF24/pyRF24/pyRF24.cpp +++ b/pyRF24/pyRF24/pyRF24.cpp @@ -233,21 +233,6 @@ bp::enum_< bcm2835SPIChipSelect>("bcm2835SPIChipSelect") .value("BCM2835_SPI_CS_NONE", BCM2835_SPI_CS_NONE) .export_values(); -// exposing '#define's for SPI speed as this is needed for RF24 constructor -bp::scope().attr("BCM2835_SPI_SPEED_64MHZ") = BCM2835_SPI_SPEED_64MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_32MHZ") = BCM2835_SPI_SPEED_32MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_16MHZ") = BCM2835_SPI_SPEED_16MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_8MHZ") = BCM2835_SPI_SPEED_8MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_4MHZ") = BCM2835_SPI_SPEED_4MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_2MHZ") = BCM2835_SPI_SPEED_2MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_1MHZ") = BCM2835_SPI_SPEED_1MHZ; -bp::scope().attr("BCM2835_SPI_SPEED_512KHZ") = BCM2835_SPI_SPEED_512KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_256KHZ") = BCM2835_SPI_SPEED_256KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_128KHZ") = BCM2835_SPI_SPEED_128KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_64KHZ") = BCM2835_SPI_SPEED_64KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_32KHZ") = BCM2835_SPI_SPEED_32KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_16KHZ") = BCM2835_SPI_SPEED_16KHZ; -bp::scope().attr("BCM2835_SPI_SPEED_8KHZ") = BCM2835_SPI_SPEED_8KHZ; #endif // BCM2835_H bp::enum_("rf24_crclength_e").value("RF24_CRC_DISABLED", RF24_CRC_DISABLED).value("RF24_CRC_8", RF24_CRC_8).value( diff --git a/pyRF24/pyRF24/setup.py b/pyRF24/pyRF24/setup.py index f8ace892a..340b57493 100644 --- a/pyRF24/pyRF24/setup.py +++ b/pyRF24/pyRF24/setup.py @@ -11,7 +11,7 @@ def process_configparams(): global version - with open('../Makefile.inc') as f: + with open('../../Makefile.inc') as f: config_lines = f.read().splitlines() cflags = os.getenv("CFLAGS", "")