Skip to content

Commit

Permalink
modified app to not rely on external lib
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Aug 20, 2023
1 parent 422791f commit 2813d5a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
16 changes: 0 additions & 16 deletions non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
#include <string.h>

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);
Expand All @@ -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(
Expand Down
5 changes: 1 addition & 4 deletions non_catalog_apps/nrf24channelscanner/lib/nrf24/nrf24.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <furi_hal_spi.h>
#include <xtreme.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 2813d5a

Please sign in to comment.