Skip to content

Commit

Permalink
Python wrapper now respects RPI/SPIDEV/MRAA RF24 configuration.
Browse files Browse the repository at this point in the history
Signed-off-by: mz-fuzzy <mzfuzzy800@gmail.com>
  • Loading branch information
martin-mat committed Jan 27, 2016
1 parent 031d388 commit 95926b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RPi/pyRF24/pyRF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(txStandBy_wrap1, RF24::txStandBy, 0, 2)

BOOST_PYTHON_MODULE(RF24){

#ifdef BCM2835_H
bp::enum_< RPiGPIOPin>("RPiGPIOPin")
.value("RPI_GPIO_P1_03", RPI_GPIO_P1_03)
.value("RPI_GPIO_P1_05", RPI_GPIO_P1_05)
Expand Down Expand Up @@ -243,6 +244,7 @@ BOOST_PYTHON_MODULE(RF24){
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)
Expand Down
7 changes: 6 additions & 1 deletion examples_RPi/pingpair_dyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@

#RPi B+
# Setup for GPIO 22 CE and CE0 CSN for RPi B+ with SPI Speed @ 8Mhz
radio = RF24(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ)
#radio = RF24(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ)

# 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);


# Setup for connected IRQ pin, GPIO 24 on RPi B+; uncomment to activate
#irq_gpio_pin = RPI_BPLUS_GPIO_J8_18
#irq_gpio_pin = 24

##########################################
def try_read_data(channel=0):
Expand Down

1 comment on commit 95926b2

@martin-mat
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.