From 2813d5a61d8f4a9a03ea64f61a33e2d7a844d130 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 20 Aug 2023 05:13:56 +0300 Subject: [PATCH] modified app to not rely on external lib --- .../nrf24channelscanner/lib/nrf24/nrf24.c | 16 ---------------- .../nrf24channelscanner/lib/nrf24/nrf24.h | 5 +---- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.c b/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.c index 611a5dbd..9e2f5ccd 100644 --- a/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.c +++ b/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.c @@ -6,15 +6,6 @@ #include void nrf24_init() { - // this is needed if multiple SPI devices are connected to the same bus but with different CS pins - if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) { - furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull); - furi_hal_gpio_write(&gpio_ext_pc3, true); - } else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) { - furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull); - furi_hal_gpio_write(&gpio_ext_pa4, true); - } - furi_hal_spi_bus_handle_init(nrf24_HANDLE); furi_hal_spi_acquire(nrf24_HANDLE); furi_hal_gpio_init(nrf24_CE_PIN, GpioModeOutputPushPull, GpioPullUp, GpioSpeedVeryHigh); @@ -26,13 +17,6 @@ void nrf24_deinit() { furi_hal_spi_bus_handle_deinit(nrf24_HANDLE); furi_hal_gpio_write(nrf24_CE_PIN, false); furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow); - - // resetting the CS pins to floating - if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) { - furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog); - } else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) { - furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog); - } } void nrf24_spi_trx( diff --git a/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.h b/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.h index cd1bab2f..dc4bb8a4 100644 --- a/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.h +++ b/non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.h @@ -2,7 +2,6 @@ #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -42,9 +41,7 @@ extern "C" { #define nrf24_TIMEOUT 500 #define nrf24_CE_PIN &gpio_ext_pb2 -#define nrf24_HANDLE \ - (XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \ - &furi_hal_spi_bus_handle_external_extra) +#define nrf24_HANDLE &furi_hal_spi_bus_handle_external /* Low level API */