Compare commits
No commits in common. "esp32-devkit-doit" and "main" have entirely different histories.
esp32-devk
...
main
|
@ -8,10 +8,7 @@
|
|||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
|
||||
[env:metro]
|
||||
build_flags = -D ARDUINO1
|
||||
platform = atmelavr
|
||||
board = metro
|
||||
framework = arduino
|
||||
|
@ -20,16 +17,3 @@ lib_deps =
|
|||
paulstoffregen/Encoder@^1.4.4
|
||||
adafruit/Adafruit GFX Library@^1.11.9
|
||||
adafruit/Adafruit SSD1306@^2.5.9
|
||||
|
||||
[env:esp32doit-devkit-v1]
|
||||
build_flags = -D ESP32DOIT
|
||||
platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
lib_deps =
|
||||
etherkit/Etherkit Si5351@^2.1.4
|
||||
adafruit/Adafruit GFX Library@^1.11.9
|
||||
adafruit/Adafruit SSD1306@^2.5.9
|
||||
igorantolic/Ai Esp32 Rotary Encoder@^1.6
|
||||
|
|
47
src/main.cpp
47
src/main.cpp
|
@ -5,7 +5,7 @@
|
|||
***********************************************************************************************************/
|
||||
|
||||
//Libraries
|
||||
#include <Wire.h> //IDE Standard
|
||||
#include <Wire.h> //IDE Standard
|
||||
#include <Rotary.h> //Ben Buxton https://github.com/brianlow/Rotary
|
||||
#include <si5351.h> //Etherkit https://github.com/etherkit/Si5351Arduino
|
||||
#include <Adafruit_GFX.h> //Adafruit GFX https://github.com/adafruit/Adafruit-GFX-Library
|
||||
|
@ -13,26 +13,9 @@
|
|||
|
||||
//User preferences
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
#ifdef ESP32DOIT //use the ESP32 DEVKIT DOIT environment
|
||||
#pragma "ESP32DOIT" //show in console on build
|
||||
#define board 1 //Define board
|
||||
#define IF 0 //Enter your IF frequency, ex: 455 = 455kHz, 10700 = 10.7MHz, 0 = to direct convert receiver or RF generator, + will add and - will subtract IF offfset.
|
||||
#define BAND_INIT 7 //Enter your initial Band (1-21) at startup, ex: 1 = Freq Generator, 2 = 800kHz (MW), 7 = 7.2MHz (40m), 11 = 14.1MHz (20m).
|
||||
#define XT_CAL_F 33000 //Si5351 calibration factor, adjust to get exatcly 10MHz. Increasing this value will decreases the frequency and vice versa.
|
||||
#define S_GAIN 303 //Adjust the sensitivity of Signal Meter A/D input: 101 = 500mv; 202 = 1v; 303 = 1.5v; 404 = 2v; 505 = 2.5v; 1010 = 5v (max).
|
||||
#define tunestep 32 //The pin used by tune step push button.
|
||||
#define band 33 //The pin used by band selector push button.
|
||||
#define rx_tx 5 //The pin used by RX / TX selector switch, RX = switch open, TX = switch closed to GND. When in TX, the IF value is not considered.
|
||||
#define adc 4 //The pin used by Signal Meter A/D input.
|
||||
#define rotary1 34 //First pin for rotary encoder.
|
||||
#define rotary2 35 //Second pin for rotary encoder.
|
||||
|
||||
#else // use the ARDUINO1 environment
|
||||
#pragma "ARDUINO1" //show in console on build
|
||||
#define board 0 //Define board
|
||||
#define IF 0 //Enter your IF frequency, ex: 455 = 455kHz, 10700 = 10.7MHz, 0 = to direct convert receiver or RF generator, + will add and - will subtract IF offfset.
|
||||
#define BAND_INIT 7 //Enter your initial Band (1-21) at startup, ex: 1 = Freq Generator, 2 = 800kHz (MW), 7 = 7.2MHz (40m), 11 = 14.1MHz (20m).
|
||||
#define XT_CAL_F 33000 //Si5351 calibration factor, adjust to get exatcly 10MHz. Increasing this value will decreases the frequency and vice versa.
|
||||
#define XT_CAL_F 33000 //Si5351 calibration factor, adjust to get exatcly 10MHz. Increasing this value will decreases the frequency and vice versa.
|
||||
#define S_GAIN 303 //Adjust the sensitivity of Signal Meter A/D input: 101 = 500mv; 202 = 1v; 303 = 1.5v; 404 = 2v; 505 = 2.5v; 1010 = 5v (max).
|
||||
#define tunestep A0 //The pin used by tune step push button.
|
||||
#define band A1 //The pin used by band selector push button.
|
||||
|
@ -40,8 +23,6 @@
|
|||
#define adc A3 //The pin used by Signal Meter A/D input.
|
||||
#define rotary1 2 //First pin for rotary encoder.
|
||||
#define rotary2 3 //Second pin for rotary encoder.
|
||||
|
||||
#endif
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Rotary r = Rotary(rotary1, rotary2);
|
||||
|
@ -75,15 +56,11 @@ void set_frequency(short dir) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ESP32DOIT //use the ESP32 DEVKIT DOIT environment
|
||||
//TODO
|
||||
#else
|
||||
ISR(PCINT2_vect) {
|
||||
char result = r.process();
|
||||
if (result == DIR_CW) set_frequency(1);
|
||||
else if (result == DIR_CCW) set_frequency(-1);
|
||||
}
|
||||
#endif
|
||||
ISR(PCINT2_vect) {
|
||||
char result = r.process();
|
||||
if (result == DIR_CW) set_frequency(1);
|
||||
else if (result == DIR_CCW) set_frequency(-1);
|
||||
}
|
||||
|
||||
void tunegen() {
|
||||
si5351.set_freq((freq + (interfreq * 1000ULL)) * 100ULL, SI5351_CLK0);
|
||||
|
@ -280,13 +257,9 @@ void setup() {
|
|||
si5351.output_enable(SI5351_CLK1, 0);
|
||||
si5351.output_enable(SI5351_CLK2, 0);
|
||||
|
||||
#ifdef ESP32DOIT
|
||||
//TODO
|
||||
#else
|
||||
PCICR |= (1 << PCIE2);
|
||||
PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
|
||||
sei();
|
||||
#endif
|
||||
PCICR |= (1 << PCIE2);
|
||||
PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
|
||||
sei();
|
||||
|
||||
count = BAND_INIT;
|
||||
bandpresets();
|
||||
|
|
Loading…
Reference in New Issue
Block a user