From 75e435e314cb193eb2d5da39d6dbfb467f8ea8b6 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Fri, 28 Jun 2024 13:40:23 -0700 Subject: [PATCH] [CMake] default to SPIDEV driver per nRF24/RF24#971 --- CMakeLists.txt | 5 ---- cmake/AutoConfig_RF24_DRIVER.cmake | 42 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07dc9099..9525b09e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,11 +151,6 @@ if(DEFINED SLOW_ADDR_POLL_RESPONSE) message(STATUS "SLOW_ADDR_POLL_RESPONSE set to ${SLOW_ADDR_POLL_RESPONSE}") target_compile_definitions(${LibTargetName} PUBLIC SLOW_ADDR_POLL_RESPONSE=${SLOW_ADDR_POLL_RESPONSE}) endif() -# conditionally disable interruot support (a pigpio specific feature) -if("${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND" OR DEFINED RF24_NO_INTERRUPT) - message(STATUS "Disabling IRQ pin support") - target_compile_definitions(${LibTargetName} PUBLIC RF24_NO_INTERRUPT) -endif() ########################### # target install rules for the RF24Network lib diff --git a/cmake/AutoConfig_RF24_DRIVER.cmake b/cmake/AutoConfig_RF24_DRIVER.cmake index 6e942caf..99e04082 100644 --- a/cmake/AutoConfig_RF24_DRIVER.cmake +++ b/cmake/AutoConfig_RF24_DRIVER.cmake @@ -26,31 +26,33 @@ else() endif() -if(${RF24_DRIVER} STREQUAL "UNKNOWN") # invokes automatic configuration - if("${SOC}" STREQUAL "BCM2708" OR "${SOC}" STREQUAL "BCM2709" OR "${SOC}" STREQUAL "BCM2835") - set(RF24_DRIVER RPi CACHE STRING "using folder /utility/RPi" FORCE) - elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND") - message(STATUS "Found pigpio library: ${LibPIGPIO}") - set(RF24_DRIVER pigpio CACHE STRING "using folder /utility/pigpio" FORCE) - elseif(NOT "${LibWiringPi}" STREQUAL "LibWiringPi-NOTFOUND") - message(STATUS "Found wiringPi library: ${LibWiringPi}") - set(RF24_DRIVER wiringPi CACHE STRING "using folder /utility/wiringPi" FORCE) - elseif(NOT "${LibLittleWire}" STREQUAL "LibLittleWire-NOTFOUND") - message(STATUS "Found LittleWire library: ${LibLittleWire}") - set(RF24_DRIVER LittleWire CACHE STRING "using folder /utility/LittleWire" FORCE) - elseif(NOT "${LibMRAA}" STREQUAL "LibMRAA-NOTFOUND") - message(STATUS "Found MRAA library: ${LibMRAA}") - set(RF24_DRIVER MRAA CACHE STRING "using folder /utility/MRAA" FORCE) - elseif(SPIDEV_EXISTS) # should be a non-empty string if SPI is enabled - message(STATUS "detected that SPIDEV is enabled: ${SPIDEV_EXISTS}") - set(RF24_DRIVER SPIDEV CACHE STRING "using folder /utility/SPIDEV" FORCE) - endif() -endif() +# if(${RF24_DRIVER} STREQUAL "UNKNOWN") # invokes automatic configuration +# if("${SOC}" STREQUAL "BCM2708" OR "${SOC}" STREQUAL "BCM2709" OR "${SOC}" STREQUAL "BCM2835") +# set(RF24_DRIVER RPi CACHE STRING "using folder /utility/RPi" FORCE) +# elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND") +# message(STATUS "Found pigpio library: ${LibPIGPIO}") +# set(RF24_DRIVER pigpio CACHE STRING "using folder /utility/pigpio" FORCE) +# elseif(NOT "${LibWiringPi}" STREQUAL "LibWiringPi-NOTFOUND") +# message(STATUS "Found wiringPi library: ${LibWiringPi}") +# set(RF24_DRIVER wiringPi CACHE STRING "using folder /utility/wiringPi" FORCE) +# elseif(NOT "${LibLittleWire}" STREQUAL "LibLittleWire-NOTFOUND") +# message(STATUS "Found LittleWire library: ${LibLittleWire}") +# set(RF24_DRIVER LittleWire CACHE STRING "using folder /utility/LittleWire" FORCE) +# elseif(NOT "${LibMRAA}" STREQUAL "LibMRAA-NOTFOUND") +# message(STATUS "Found MRAA library: ${LibMRAA}") +# set(RF24_DRIVER MRAA CACHE STRING "using folder /utility/MRAA" FORCE) +# elseif(SPIDEV_EXISTS) # should be a non-empty string if SPI is enabled +# message(STATUS "detected that SPIDEV is enabled: ${SPIDEV_EXISTS}") +# set(RF24_DRIVER SPIDEV CACHE STRING "using folder /utility/SPIDEV" FORCE) +# endif() +# endif() # override the auto-detect if RF24_DRIVER is defined in an env var if(DEFINED ENV{RF24_DRIVER}) message(STATUS "RF24_DRIVER (set from env var) = $ENV{RF24_DRIVER}") set(RF24_DRIVER $ENV{RF24_DRIVER} CACHE STRING "" FORCE) +elseif(${RF24_DRIVER} STREQUAL "UNKNOWN") + set(RF24_DRIVER SPIDEV CACHE STRING "using folder RF24/utility/SPIDEV" FORCE) endif() message(STATUS "Using driver: ${RF24_DRIVER}")