Skip to content

Commit

Permalink
Update python wrapper
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
TMRh20 committed Jul 23, 2020
1 parent 9231656 commit 7bd5f7f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples_linux/pingpair_dyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# ie: RF24 radio(<ce_pin>, <a>*10+<b>); 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);
Expand Down
15 changes: 0 additions & 15 deletions pyRF24/pyRF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>("rf24_crclength_e").value("RF24_CRC_DISABLED", RF24_CRC_DISABLED).value("RF24_CRC_8", RF24_CRC_8).value(
Expand Down
15 changes: 0 additions & 15 deletions pyRF24/pyRF24/pyRF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>("rf24_crclength_e").value("RF24_CRC_DISABLED", RF24_CRC_DISABLED).value("RF24_CRC_8", RF24_CRC_8).value(
Expand Down
2 changes: 1 addition & 1 deletion pyRF24/pyRF24/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
Expand Down

0 comments on commit 7bd5f7f

Please sign in to comment.