Files
car-key-killer/include/config.h
2026-04-03 21:34:35 -07:00

95 lines
3.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef CONFIG_H
#define CONFIG_H
// CC1101 #1 (315 MHz band)
#define CC1101_1_CS 7
#define CC1101_1_GDO0 4
#define CC1101_1_FREQ_MHZ 315.0f
// CC1101 #2 (433.92 MHz band)
#define CC1101_2_CS 8
#define CC1101_2_GDO0 5
#define CC1101_2_FREQ_MHZ 433.92f
// Shared SPI (FSPI default on ESP32-S3: 11=MOSI, 12=SCK, 13=MISO)
#define SPI_SCK_PIN 12
#define SPI_MISO_PIN 13
#define SPI_MOSI_PIN 11
#define SPI_SPEED_HZ 500000
// WiFi AP for read-only telemetry UI
#define WIFI_AP_SSID "killer"
#define WIFI_AP_PASS "password" // simple demo password
// Web server
#define WEB_PORT 80
// Jamming: max CC1101 TX (+10 dBm). External PA gain added to ERP calculation.
// Jam always starts after boot self-test; use web “Stop Jamming” (or capture REC) to pause for RX/capture.
#define DEFAULT_AUTO_START_JAM true
#define JAM_EXT_PA_GAIN_DB 30 // Gain of external RF amplifier (e.g. 30 dB / 1 Watt)
// CC1101 only accepts 8 discrete power levels (index 0-7); jam path always uses max (10 dBm).
#define JAM_POWER_LEVELS 8
#define DEFAULT_JAM_POWER_IDX 7 // 10 dBm — full device output (see TI SWRS061 PATABLE / output power)
// Modulation parameters for jamming (LFSR drives GDO0 in direct async TX)
#define JAM_BITRATE_KBPS 250.0f // baseband / channel filter context for RadioLib begin()
#define JAM_FREQ_DEV_KHZ 380.0f // default passed to begin(); per-radio deviation applied after init
#define JAM_RX_BW_KHZ 812.0f // wide RX BW for begin()
// GDO0 toggle rate during jam.
// 100 kHz (10 µs period) gives plenty of LFSR noise (AM sidebands at ±100, ±300, ±500 kHz)
// and leaves enough CPU time for the Arduino interrupt dispatcher to avoid WDT boot-loops.
#define JAM_LFSR_KEY_HZ 100000
// Fixed dual-carrier jamming: each radio holds one frequency at full TX power (TI CC1101 freq + deviation).
// Many NA ~315 MHz RKE remotes are ASK/OOK (see TI CC1101 datasheet MDMCFG2.MOD_FORMAT). Jam path uses OOK on
// R1 so LFSR on GDO0 keys the PA (broad AM sidebands). Set JAM_R1_USE_OOK 0 for 2-FSK only at JAM_DEV_KHZ_R1_WIDE.
// Fobs may sit on 314.8315.2 MHz — measure with an SDR and retune JAM_LOCK_FREQ_1_MHZ if needed.
#define JAM_LOCK_FREQ_1_MHZ 315.0f
#define JAM_LOCK_FREQ_2_MHZ 433.92f
#define JAM_DEV_KHZ_R2_WIDE 380.0f
#define JAM_DEV_KHZ_R1_NARROW 25.0f // probe / RadioLib begin() only
#define JAM_DEV_KHZ_R1_WIDE 380.0f // max CC1101 2-FSK deviation on R1 when OOK fails or JAM_R1_USE_OOK=0
#define JAM_R1_USE_OOK 1 // 1 = R1 jam ASK/OOK (typical NA); 0 = wide 2-FSK on R1
// Precision jam: narrow 2-FSK on both + slower LFSR (energy in a smaller RF slice).
#define JAM_PRECISION_DEV_R1_KHZ 28.0f
#define JAM_PRECISION_DEV_R2_KHZ 55.0f
#define JAM_PRECISION_LFSR_HZ 40000
// Pulse jam: slow square wave (spoofs preamble AGC)
#define JAM_PULSE_HZ 2000
// Flood jam: packet-mode random payloads (mcore1976-style bursty TX); deviation for symbol spread.
// 61 bytes max: CC1101 64-byte FIFO minus 1 length byte (variable-length mode) minus 2 bytes margin.
// 64 caused TXFIFO_UNDERFLOW — RadioLib writes MIN(len, FIFO_SIZE-1)=63 bytes but CC1101 expects 64.
#define JAM_FLOOD_PKT_BYTES 61
#define JAM_FLOOD_DEV_R1_KHZ 140.0f
#define JAM_FLOOD_DEV_R2_KHZ 200.0f
// Special jam: 60-byte random payloads with 10ms delay (cypher-pulse exact clone).
// SmartRF-style dump: config space only (TI SWRS061); PATABLE/ strobes not included.
#define CC1101_CFG_REG_LAST 0x2E
// 0.96" SSD1306 OLED display — I2C via SW_I2C (any free GPIO)
#define OLED_SDA_PIN 17
#define OLED_SCL_PIN 18
// Rotary encoder — dial to cycle OLED pages
#define ENC_CLK_PIN 14
#define ENC_DT_PIN 21
// Signal capture / replay
#define CAP_SAMPLE_HZ 100000
#define CAP_DURATION_S 4
#define CAP_BUF_BYTES ((CAP_SAMPLE_HZ * CAP_DURATION_S) / 8 + 8)
#define CAP_HISTORY_MAX 8
// ESP-NOW mesh
#define ESPNOW_BEACON_MS 750
#define ESPNOW_PEER_STALE_MS 12000
#define ESPNOW_MAX_PEERS 8
#endif