Skip to content

Commit

Permalink
nRF52: build with WiFiNINA (or WiFiNINA_Generic) library
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Mar 15, 2024
1 parent 82f7e20 commit 47e12e5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/driver/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "../system/SoC.h"

#if defined(ARDUINO) && !defined(EXCLUDE_WIFI)
#if defined(ARDUINO) && !defined(EXCLUDE_WIFI) && !defined(USING_WIFI101_GENERIC)
#include <WiFiUdp.h>
#endif

Expand Down
9 changes: 9 additions & 0 deletions software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIX_NUM, SOC_GPIO_PIN_LED,

#if defined(EXCLUDE_WIFI)
char UDPpacketBuffer[4]; // Dummy definition to satisfy build sequence
#else
#if defined(USING_WIFI101_GENERIC) || defined(WiFiNINA_h)
#include <SoftSPI.h>
SoftSPI WiFiSPI(_PINNUM(1, 7), _PINNUM(1, 6), _PINNUM(0, 8));
#endif /* USING_WIFI101_GENERIC || WiFiNINA_h */
#endif /* EXCLUDE_WIFI */

static uint32_t prev_tx_packets_counter = 0;
Expand Down Expand Up @@ -821,6 +826,10 @@ static void nRF52_setup()
Serial1.begin(115200);
WiFi.init(&Serial1);
#endif /* _WIFI_ESP_AT_H_ */

#if defined(WiFiNINA_h)
WiFi.setPins(SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
#endif /* WiFiNINA_h */
#endif /* EXCLUDE_WIFI */
}

Expand Down
9 changes: 9 additions & 0 deletions software/firmware/source/SoftRF/src/platform/nRF52.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,16 @@ struct rst_info {
//#define USE_ARDUINO_WIFI
//#define USE_WIFI_NINA false
//#define USE_WIFI_CUSTOM true

//#include <WiFiEspAT.h>

//#define SPIWIFI WiFiSPI
//#define SPIWIFI_SS _PINNUM(0, 6)
//#define ESP32_RESETN _PINNUM(1, 3)
//#define SPIWIFI_ACK _PINNUM(0,15)
//#define ESP32_GPIO0 -1
//#include <WiFiNINA.h>
//#include <WiFiNINA_Generic.h>
//#define Serial_setDebugOutput(x) ({})
//#define WIFI_STA_TIMEOUT 20000

Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/ui/Web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ void handleSettings() {
server.sendHeader(String(F("Cache-Control")), String(F("no-cache, no-store, must-revalidate")));
server.sendHeader(String(F("Pragma")), String(F("no-cache")));
server.sendHeader(String(F("Expires")), String(F("-1")));
#if !defined(USE_ARDUINO_WIFI)
#if !defined(USE_ARDUINO_WIFI) || defined(USING_WIFI101_GENERIC)
server.send ( 200, "text/html", Settings_temp );
#else
char *content = Settings_temp;
Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/ui/Web.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "../system/SoC.h"

#if defined(ARDUINO) && !defined(EXCLUDE_WIFI)
#if defined(ARDUINO) && !defined(EXCLUDE_WIFI) && !defined(USING_WIFI101_GENERIC)
#include <WiFiClient.h>
#endif /* ARDUINO */

Expand Down

0 comments on commit 47e12e5

Please sign in to comment.