// Application-only, RAM-only USB reference transmitter for the XIAO nRF52840 // plus Wio SX1262. No Mesh identity/settings, BLE, autonomous TX or flash writes. #include #include #include #include #include "ProfileSwitchUsb.h" #include "ProfileMixedChannels.h" CustomSX1262 chip = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI, SPISettings(8000000, MSBFIRST, SPI_MODE0)); bool ready = false; unsigned channelStepKhz=250; void referenceTransmit(unsigned channel, unsigned seq, unsigned len, unsigned preamble, unsigned sf, float bw) { if (seq == lastTxResult.sequence) { emitBenchResult(lastTxResult); return; } const uint32_t requested = micros(); int rc = chip.std_init(&SPI) ? RADIOLIB_ERR_NONE : RADIOLIB_ERR_CHIP_NOT_FOUND; const unsigned frequencyKhz=909500+channelStepKhz*channel; if (!rc) rc = chip.setFrequency(float(frequencyKhz)/1000); if (!rc) rc = chip.setLoRaModulationParams(bw, sf, 5); if (!rc) rc = chip.setPreambleLength(preamble); if (!rc) rc = chip.setOutputPower(-9); uint8_t bytes[255]; memcpy(bytes, "CHS1", 4); memcpy(bytes+4, &seq, 4); bytes[8] = channel; for (unsigned i=9; i=5 && sf<=10 && (bw==125 || bw==250)) { referenceTransmit(channel,seq,len,preamble,sf,bw); } else { Serial.println("{\"error\":\"unsupported reference TX command\"}"); } } else if (!overflow) { if (used