-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from bmorcelli/main
NRF24 Dedicated Menu and 2,4Ghz Spectrum
- Loading branch information
Showing
15 changed files
with
274 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "NRF24.h" | ||
#include "core/display.h" | ||
#include "modules/NRF24/nrf_common.h" | ||
#include "modules/NRF24/nrf_jammer.h" | ||
#include "modules/NRF24/nrf_spectrum.h" | ||
|
||
void NRF24Menu::optionsMenu() { | ||
options.clear(); | ||
options.push_back({"Information", [=]() { nrf_info(); }}); | ||
#if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) | ||
options.push_back({"Spectrum", [=]() { nrf_spectrum(&CC_NRF_SPI); }}); | ||
#elif defined(CARDPUTER) || defined(ESP32S3DEVKITC1) | ||
options.push_back({"Spectrum", [=]() { nrf_spectrum(&sdcardSPI); }}); | ||
#else | ||
options.push_back({"Spectrum", [=]() { nrf_spectrum(&SPI); }}); | ||
#endif | ||
options.push_back({"Jammer 2.4G", [=]() { nrf_jammer(); }}); | ||
|
||
options.push_back({"Main Menu", [=]() { backToMenu(); }}); | ||
delay(200); | ||
loopOptions(options,false,true,"Bluetooth"); | ||
} | ||
|
||
String NRF24Menu::getName() { | ||
return _name; | ||
} | ||
|
||
void NRF24Menu::draw() { | ||
// Blank | ||
tft.fillRect(iconX,iconY,80,80,BGCOLOR); | ||
|
||
// Case | ||
tft.drawRect(0+iconX,40+iconY,60,40,FGCOLOR); | ||
tft.fillRect(60+iconX,55+iconY,10,10,FGCOLOR); | ||
//Antenna | ||
tft.fillRoundRect(70+iconX,10+iconY,10,55,5,FGCOLOR); | ||
|
||
//Chip connecto | ||
tft.fillCircle(10+iconX, 48+iconY,3,FGCOLOR); | ||
tft.fillCircle(10+iconX, 56+iconY,3,FGCOLOR); | ||
tft.fillCircle(10+iconX, 64+iconY,3,FGCOLOR); | ||
tft.fillCircle(10+iconX, 72+iconY,3,FGCOLOR); | ||
|
||
tft.fillCircle(20+iconX, 48+iconY,3,FGCOLOR); | ||
tft.fillCircle(20+iconX, 56+iconY,3,FGCOLOR); | ||
tft.fillCircle(20+iconX, 64+iconY,3,FGCOLOR); | ||
tft.fillCircle(20+iconX, 72+iconY,3,FGCOLOR); | ||
|
||
//Chip | ||
tft.fillRect(35+iconX,55+iconY,10,10,FGCOLOR); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef __NRF24_MENU_H__ | ||
#define __NRF24_MENU_H__ | ||
|
||
#include "MenuItemInterface.h" | ||
|
||
|
||
class NRF24Menu : public MenuItemInterface { | ||
public: | ||
void optionsMenu(void); | ||
void draw(void); | ||
String getName(void); | ||
|
||
private: | ||
String _name = "NRF24"; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "nrf_common.h" | ||
#include "../../core/mykeyboard.h" | ||
|
||
RF24 NRFradio(NRF24_CE_PIN, NRF24_SS_PIN); | ||
|
||
void nrf_info() { | ||
tft.fillScreen(BGCOLOR); | ||
tft.setTextSize(FM); | ||
tft.setTextColor(TFT_RED, BGCOLOR); | ||
tft.drawCentreString("_Disclaimer_",WIDTH/2,10,1); | ||
tft.setTextColor(TFT_WHITE, BGCOLOR); | ||
tft.setTextSize(FP); | ||
tft.setCursor(15,33); | ||
tft.println("These functions were made to be used in a controlled environment for STUDY only."); | ||
tft.println("\nDO NOT use these functions to harm people or companies, you can go to jail!"); | ||
tft.setTextColor(FGCOLOR, BGCOLOR); | ||
tft.println("\nThis device is VERY sensible to noise, so long wires or passing near VCC line can make things go wrong."); | ||
delay(1000); | ||
while(!checkAnyKeyPress()); | ||
} | ||
|
||
bool nrf_start() { | ||
#if defined(USE_NRF24_VIA_SPI) | ||
pinMode(NRF24_SS_PIN, OUTPUT); | ||
digitalWrite(NRF24_SS_PIN, HIGH); | ||
pinMode(NRF24_CE_PIN, OUTPUT); | ||
digitalWrite(NRF24_CE_PIN, LOW); | ||
|
||
#if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) | ||
CC_NRF_SPI.begin(NRF24_SCK_PIN,NRF24_MISO_PIN,NRF24_MOSI_PIN,NRF24_SS_PIN); | ||
#elif defined(CARDPUTER) || defined(ESP32S3DEVKITC1) | ||
sdcardSPI.begin(NRF24_SCK_PIN,NRF24_MISO_PIN,NRF24_MOSI_PIN,NRF24_SS_PIN); | ||
#else | ||
SPI.begin(NRF24_SCK_PIN,NRF24_MISO_PIN,NRF24_MOSI_PIN,NRF24_SS_PIN); | ||
#endif | ||
|
||
#if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) | ||
if(NRFradio.begin(&CC_NRF_SPI)) | ||
#elif defined(CARDPUTER) || defined(ESP32S3DEVKITC1) | ||
if(NRFradio.begin(&sdcardSPI)) | ||
#else | ||
if(NRFradio.begin(&SPI)) | ||
#endif | ||
{ | ||
return true; | ||
} | ||
else | ||
return false; | ||
|
||
|
||
|
||
#else // NRF24 not set in platfrmio.ini | ||
return false; | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <RF24.h> | ||
#include "../../core/globals.h" | ||
|
||
//Define the Macros case it hasn't been declared | ||
#ifndef NRF24_CE_PIN | ||
#define NRF24_CE_PIN -1 | ||
#endif | ||
#ifndef NRF24_SS_PIN | ||
#define NRF24_SS_PIN -1 | ||
#endif | ||
|
||
extern RF24 NRFradio; | ||
|
||
bool nrf_start(); | ||
|
||
void nrf_info(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.