firmware: add communication between 32u4 and teensy

main
EmaMaker 2021-05-16 16:01:26 +02:00
parent 5e8e89567a
commit 37579c511c
6 changed files with 358 additions and 2 deletions

246
Firmware/Teensy/.vscode/c_cpp_properties.json vendored Executable file
View File

@ -0,0 +1,246 @@
//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
"configurations": [
{
"name": "PlatformIO",
"includePath": [
"/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/include",
"/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/cores/teensy3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ADC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/AccelStepper/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_NeoPixel",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_STMPE610",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_VS1053",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/AltSoftSerial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Artnet",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Audio",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Audio/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Bounce",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Bounce2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/CapacitiveSensor",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/CryptoAccel/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DS1307RTC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DmxSimple",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DogLcd",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EEPROM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EasyTransfer",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EasyTransferI2C",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Encoder",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Encoder/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Entropy",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Ethernet/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FNET/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FastCRC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FastLED",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN_T4",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexiTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqCount",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasure",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasureMulti",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FrequencyTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ILI9341_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ILI9488_t3/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/IRremote",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Keypad/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LedControl/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LedDisplay",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystal/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystalFast",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LowPower",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MFRC522/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MIDI/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Metro",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MsTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NativeEthernet/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OSC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OctoWS2811",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OneWire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PWMServo",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Ping",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PulsePosition",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/QuadEncoder",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/RA8875",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/RadioHead",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ResponsiveAnalogRead/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SD",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SD/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SPI",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SPIFlash",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ST7735_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Servo",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ShiftPWM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Snooze/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SoftPWM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SoftwareSerial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TFT_ILI9163C",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Talkie",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TeensyThreads",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Time",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimeAlarms",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimerOne",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimerThree",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TinyGPS",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Tlc5940",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TouchScreen",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/UTFT",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/VirtualWire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/WS2812Serial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Wire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Wire/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/XBee",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/XPT2046_Touchscreen",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/i2c_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ks0108",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ssd1351",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/x10",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/include",
"/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/cores/teensy3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ADC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/AccelStepper/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_NeoPixel",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_STMPE610",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_VS1053",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Adafruit_nRF8001/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/AltSoftSerial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Artnet",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Audio",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Audio/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Bounce",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Bounce2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/CapacitiveSensor",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/CryptoAccel/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DS1307RTC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DmxSimple",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/DogLcd",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EEPROM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EasyTransfer",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/EasyTransferI2C",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Encoder",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Encoder/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Entropy",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Ethernet/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FNET/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FastCRC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FastLED",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexCAN_T4",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FlexiTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqCount",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasure",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FreqMeasureMulti",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/FrequencyTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ILI9341_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ILI9488_t3/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/IRremote",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Keypad/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LedControl/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LedDisplay",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystal/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LiquidCrystalFast",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/LowPower",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MFRC522/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MIDI/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Metro",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/MsTimer2",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NXPMotionSense/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/NativeEthernet/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OSC",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OctoWS2811",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/OneWire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PS2Keyboard/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PWMServo",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Ping",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/PulsePosition",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/QuadEncoder",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/RA8875",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/RadioHead",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ResponsiveAnalogRead/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SD",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SD/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SPI",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SPIFlash",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ST7735_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Servo",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ShiftPWM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Snooze/src",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SoftPWM",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/SoftwareSerial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TFT_ILI9163C",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Talkie",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TeensyThreads",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Time",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimeAlarms",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimerOne",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TimerThree",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TinyGPS",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Tlc5940",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/TouchScreen",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/USBHost_t36/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/UTFT",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/VirtualWire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/WS2812Serial",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Wire",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/Wire/utility",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/XBee",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/XPT2046_Touchscreen",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/i2c_t3",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ks0108",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/ssd1351",
"/home/emamaker/.platformio/packages/framework-arduinoteensy/libraries/x10",
""
]
},
"defines": [
"PLATFORMIO=50101",
"__MK64FX512__",
"ARDUINO_TEENSY35",
"TEENSY_OPT_FASTEST_PURE_CODE_LTO",
"USB_SERIAL",
"ARDUINO=10805",
"TEENSYDUINO=153",
"CORE_TEENSY",
"F_CPU=168000000L",
"LAYOUT_US_ENGLISH",
"__PURE_CODE__",
""
],
"cppStandard": "c++14",
"compilerPath": "/home/emamaker/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
"compilerArgs": [
"-mthumb",
"-mcpu=cortex-m4",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
"-mpure-code",
""
]
}
],
"version": 4
}

36
Firmware/Teensy/.vscode/launch.json vendored Executable file
View File

@ -0,0 +1,36 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
//
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html
{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/.pio/build/teensy35/firmware.elf",
"projectEnvName": "teensy35",
"toolchainBinDir": "/home/emamaker/.platformio/packages/toolchain-gccarmnoneeabi/bin",
"internalConsoleOptions": "openOnSessionStart",
"svdPath": "/home/emamaker/.platformio/platforms/teensy/misc/svd/MK64F12.svd",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
}
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "/home/emamaker/pi_server/Projects/FunctionGenerator/FunctionGen-Teensy/Teensy3.5DDS/Firmware/.pio/build/teensy35/firmware.elf",
"projectEnvName": "teensy35",
"toolchainBinDir": "/home/emamaker/.platformio/packages/toolchain-gccarmnoneeabi/bin",
"internalConsoleOptions": "openOnSessionStart",
"svdPath": "/home/emamaker/.platformio/platforms/teensy/misc/svd/MK64F12.svd"
}
]
}

View File

@ -7,3 +7,8 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:teensy35]
platform = teensy
board = teensy35
framework = arduino

View File

@ -3,16 +3,85 @@
#include "square.h"
#include "sine.h"
void communicate();
void generate(int, int, int);
bool receivingInfo, valid_flag;
String s, tmp_type, tmp_frequency, tmp_duty;
unsigned long frequency = 1000;
int type = 0, duty = 50;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
Serial1.begin(9600);
pinMode(21, INPUT_PULLDOWN);
attachInterrupt(digitalPinToInterrupt(21), communicate, RISING);
setupWaves();
setupSine();
setupSquare();
}
FASTRUN void loop() {
generateSquareDAC1(1000000, 50);
void loop() {
if(receivingInfo){
Serial1.write(42); //The answer to life, universe and everything else
digitalWriteFast(LED_BUILTIN, HIGH);
delay(1000);
receivingInfo = false;
valid_flag = false;
while(!valid_flag){
s = Serial1.readStringUntil('W');
Serial.println(s);
//Check if it's a valid string, it should start with 'w'
if(!s.startsWith('w')) continue;
// Get type
tmp_type = s.substring(s.indexOf('t')+1, s.indexOf('T'));
type = tmp_type.toInt();
// Get duty
tmp_duty = s.substring(s.indexOf('d')+1, s.indexOf('D'));
duty = tmp_duty.toInt();
// Get frequency
tmp_frequency = s.substring(s.indexOf('f')+1, s.indexOf('F'));
frequency = tmp_frequency.toInt();
for(int i = 0; i < 100; i++) Serial1.write(69);
valid_flag = true;
Serial1.flush();
valid_flag = true;
Serial.print("Type: " );
Serial.println(type);
Serial.print("Duty: " );
Serial.println(duty);
Serial.print("Frequency: " );
Serial.println(frequency);
digitalWriteFast(LED_BUILTIN, LOW);
generate(type, frequency, duty);
}
}
}
void communicate(){
receivingInfo = true;
stopGenerating();
}
void generate(int type, int frequency, int duty){
switch(type){
//sine
case 0:
generateSine(frequency);
break;
case 1:
generateSquareDAC1(frequency, duty);
break;
}
}