Exercises 00 & 01 working, Documentation still in progress, moving to my source control server.

This commit is contained in:
John Poole 2026-02-13 14:03:09 -08:00
commit 8cf97e0e5a
15 changed files with 541 additions and 0 deletions

View file

View file

@ -0,0 +1,43 @@
; 20260212 ChatGPT
; $Id$
; $HeadURL$
[platformio]
default_envs = node_a
[env]
platform = espressif32
framework = arduino
board = esp32-s3-devkitc-1
monitor_speed = 115200
lib_deps =
jgromes/RadioLib@^6.6.0
; Common build flags (pins from Meshtastic tbeam-s3-core variant.h)
build_flags =
-D LORA_CS=10
-D LORA_MOSI=11
-D LORA_SCK=12
-D LORA_MISO=13
-D LORA_RESET=5
-D LORA_DIO1=1
-D LORA_BUSY=4
-D LORA_TCXO_VOLTAGE=1.8
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
; Radio params for println/printf + RadioLib init
-D LORA_FREQ=915.000
-D LORA_SF=7
-D LORA_BW=125
-D LORA_CR=5
[env:node_a]
build_flags =
${env.build_flags}
-D NODE_LABEL=\"A\"
[env:node_b]
build_flags =
${env.build_flags}
-D NODE_LABEL=\"B\"

View file

@ -0,0 +1,60 @@
#include <Arduino.h>
#include <SPI.h>
#include <RadioLib.h>
#ifndef LORA_FREQ
#define LORA_FREQ 915.000
#endif
#ifndef LORA_SF
#define LORA_SF 7
#endif
#ifndef LORA_BW
#define LORA_BW 125
#endif
#ifndef LORA_CR
#define LORA_CR 5
#endif
// SX1262 on T-Beam Supreme (tbeam-s3-core pinout)
SX1262 radio = new Module(LORA_CS, LORA_DIO1, LORA_RESET, LORA_BUSY);
int state; // = radio.begin(915.0, 125.0, 7, 5, 0x12, 14);
void setup() {
Serial.begin(115200);
delay(2000); // give USB time to enumerate
Serial.println("Booting LoRa test...");
Serial.println();
Serial.println("Initializing radio...");
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
Serial.printf("Radio chip: SX1262\r\n");
Serial.printf("Frequency: %.3f MHz\r\n", (double)LORA_FREQ);
Serial.printf("SF: %d BW: %d CR: %d\r\n", LORA_SF, LORA_BW, LORA_CR);
int state = radio.begin(915.0, 125.0, 7, 5, 0x12, 14);
Serial.printf("radio.begin returned: %d\r\n", state);
}
void loop() {
static uint32_t counter = 0;
Serial.printf("alive %lu\n", counter++);
Serial.println("Sending test frame...");
int tx = radio.transmit("USB RADIO CHECK");
Serial.printf("TX state: %d\r\n", tx);
// we're not expecting to receive anything, just testing that we
// can call Receive()
Serial.println("Starting receive...");
state = radio.startReceive();
Serial.printf("startReceive returned: %d\r\n", state);
delay(1000);
}