From 6bc6b1d20213fe7a477d6501ffe8da528da2bd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Sat, 3 Oct 2020 21:56:09 +0200 Subject: [PATCH] Speed improvements --- .../Calibration/calibration.cpp | 4 +- Software/VNA_embedded/.cproject | 2 +- Software/VNA_embedded/Application/App.cpp | 34 ++++----- .../Communication/Communication.cpp | 6 +- .../Application/Communication/Communication.h | 4 +- .../Application/Communication/Protocol.cpp | 75 ++++++++++++------- .../Application/Communication/Protocol.hpp | 2 +- .../Application/Drivers/FPGA/FPGA.cpp | 59 ++++----------- .../Application/Drivers/FPGA/FPGA.hpp | 2 +- .../Application/Drivers/USB/usb.c | 5 +- .../VNA_embedded/Application/Hardware.cpp | 12 ++- .../VNA_embedded/Application/Hardware.hpp | 19 +++++ Software/VNA_embedded/Application/Manual.cpp | 2 +- Software/VNA_embedded/Application/Manual.hpp | 2 +- .../Application/SpectrumAnalyzer.cpp | 2 +- .../Application/SpectrumAnalyzer.hpp | 2 +- Software/VNA_embedded/Application/VNA.cpp | 2 +- Software/VNA_embedded/Application/VNA.hpp | 4 +- 18 files changed, 130 insertions(+), 108 deletions(-) diff --git a/Software/PC_Application/Calibration/calibration.cpp b/Software/PC_Application/Calibration/calibration.cpp index 6a7cfbe..77c5a2d 100644 --- a/Software/PC_Application/Calibration/calibration.cpp +++ b/Software/PC_Application/Calibration/calibration.cpp @@ -8,7 +8,7 @@ using namespace std; Calibration::Calibration() { - // Creator vectors for measurements + // Create vectors for measurements measurements[Measurement::Port1Open].datapoints = vector(); measurements[Measurement::Port1Short].datapoints = vector(); measurements[Measurement::Port1Load].datapoints = vector(); @@ -80,7 +80,6 @@ void Calibration::construct12TermPoints() requiredMeasurements.push_back(Measurement::Isolation); bool isolation_measured = SanityCheckSamples(requiredMeasurements); - // If we get here the calibration measurements are all okay points.clear(); for(unsigned int i = 0;i>(r22 * a, r22 * b, r22 * c, r22); auto Box_B = Tparam>(rho22 * alpha, rho22 * beta, rho22 * gamma, rho22); - // e00 is S11_A, S11 = T12/T22 = r22*a/r22 complex dummy1, dummy2; Box_A.toSparam(p.fe00, dummy1, p.fe10e01, p.fe11); Box_B.toSparam(p.fe22, p.fe10e32, dummy1, dummy2); diff --git a/Software/VNA_embedded/.cproject b/Software/VNA_embedded/.cproject index af2efed..fea700d 100644 --- a/Software/VNA_embedded/.cproject +++ b/Software/VNA_embedded/.cproject @@ -29,7 +29,7 @@ - + diff --git a/Software/VNA_embedded/Application/App.cpp b/Software/VNA_embedded/Application/App.cpp index 68e761e..b70bc86 100644 --- a/Software/VNA_embedded/Application/App.cpp +++ b/Software/VNA_embedded/Application/App.cpp @@ -25,7 +25,7 @@ static Protocol::Datapoint result; static Protocol::SweepSettings settings; -static Protocol::PacketInfo packet; +static Protocol::PacketInfo recv_packet, transmit_packet; static TaskHandle_t handle; #if HW_REVISION >= 'B' @@ -41,14 +41,17 @@ extern ADC_HandleTypeDef hadc1; #define FLAG_USB_PACKET 0x01 #define FLAG_DATAPOINT 0x02 -static void VNACallback(Protocol::Datapoint res) { - result = res; +static void VNACallback(const Protocol::Datapoint &res) { + DEBUG2_HIGH(); + transmit_packet.type = Protocol::PacketType::Datapoint; + transmit_packet.datapoint = res; BaseType_t woken = false; xTaskNotifyFromISR(handle, FLAG_DATAPOINT, eSetBits, &woken); portYIELD_FROM_ISR(woken); + DEBUG2_LOW(); } -static void USBPacketReceived(Protocol::PacketInfo p) { - packet = p; +static void USBPacketReceived(const Protocol::PacketInfo &p) { + recv_packet = p; BaseType_t woken = false; xTaskNotifyFromISR(handle, FLAG_USB_PACKET, eSetBits, &woken); portYIELD_FROM_ISR(woken); @@ -114,28 +117,25 @@ void App_Start() { if(xTaskNotifyWait(0x00, UINT32_MAX, ¬ification, 100) == pdPASS) { // something happened if(notification & FLAG_DATAPOINT) { - Protocol::PacketInfo packet; - packet.type = Protocol::PacketType::Datapoint; - packet.datapoint = result; - Communication::Send(packet); + Communication::Send(transmit_packet); lastNewPoint = HAL_GetTick(); } if(notification & FLAG_USB_PACKET) { - switch(packet.type) { + switch(recv_packet.type) { case Protocol::PacketType::SweepSettings: LOG_INFO("New settings received"); - settings = packet.settings; + settings = recv_packet.settings; sweepActive = VNA::Setup(settings, VNACallback); lastNewPoint = HAL_GetTick(); Communication::SendWithoutPayload(Protocol::PacketType::Ack); break; case Protocol::PacketType::ManualControl: sweepActive = false; - Manual::Setup(packet.manual); + Manual::Setup(recv_packet.manual); Communication::SendWithoutPayload(Protocol::PacketType::Ack); break; case Protocol::PacketType::Reference: - HW::Ref::set(packet.reference); + HW::Ref::set(recv_packet.reference); if(!sweepActive) { // can update right now HW::Ref::update(); @@ -145,13 +145,13 @@ void App_Start() { case Protocol::PacketType::Generator: sweepActive = false; LOG_INFO("Updating generator setting"); - Generator::Setup(packet.generator); + Generator::Setup(recv_packet.generator); Communication::SendWithoutPayload(Protocol::PacketType::Ack); break; case Protocol::PacketType::SpectrumAnalyzerSettings: sweepActive = false; LOG_INFO("Updating spectrum analyzer settings"); - SA::Setup(packet.spectrumSettings); + SA::Setup(recv_packet.spectrumSettings); Communication::SendWithoutPayload(Protocol::PacketType::Ack); break; case Protocol::PacketType::RequestDeviceLimits: @@ -174,8 +174,8 @@ void App_Start() { } break; case Protocol::PacketType::FirmwarePacket: - LOG_INFO("Writing firmware packet at address %u", packet.firmware.address); - if(flash.write(packet.firmware.address, sizeof(packet.firmware.data), packet.firmware.data)) { + LOG_INFO("Writing firmware packet at address %u", recv_packet.firmware.address); + if(flash.write(recv_packet.firmware.address, sizeof(recv_packet.firmware.data), recv_packet.firmware.data)) { Communication::SendWithoutPayload(Protocol::PacketType::Ack); } else { LOG_ERR("Failed to write FLASH"); diff --git a/Software/VNA_embedded/Application/Communication/Communication.cpp b/Software/VNA_embedded/Application/Communication/Communication.cpp index 0fb7122..25d2efe 100644 --- a/Software/VNA_embedded/Application/Communication/Communication.cpp +++ b/Software/VNA_embedded/Application/Communication/Communication.cpp @@ -42,10 +42,12 @@ void Communication::Input(const uint8_t *buf, uint16_t len) { } } while (handled_len > 0); } - -bool Communication::Send(Protocol::PacketInfo packet) { +#include "Hardware.hpp" +bool Communication::Send(const Protocol::PacketInfo &packet) { +// DEBUG1_HIGH(); uint16_t len = Protocol::EncodePacket(packet, outputBuffer, sizeof(outputBuffer)); +// DEBUG1_LOW(); return usb_transmit(outputBuffer, len); // if (hUsbDeviceFS.dev_state == USBD_STATE_CONFIGURED) { // uint16_t len = Protocol::EncodePacket(packet, outputBuffer, diff --git a/Software/VNA_embedded/Application/Communication/Communication.h b/Software/VNA_embedded/Application/Communication/Communication.h index 1db380c..130e45d 100644 --- a/Software/VNA_embedded/Application/Communication/Communication.h +++ b/Software/VNA_embedded/Application/Communication/Communication.h @@ -8,11 +8,11 @@ namespace Communication { -using Callback = void(*)(Protocol::PacketInfo); +using Callback = void(*)(const Protocol::PacketInfo&); void SetCallback(Callback cb); void Input(const uint8_t *buf, uint16_t len); -bool Send(Protocol::PacketInfo packet); +bool Send(const Protocol::PacketInfo &packet); bool SendWithoutPayload(Protocol::PacketType type); } diff --git a/Software/VNA_embedded/Application/Communication/Protocol.cpp b/Software/VNA_embedded/Application/Communication/Protocol.cpp index 27fed0c..74eec92 100644 --- a/Software/VNA_embedded/Application/Communication/Protocol.cpp +++ b/Software/VNA_embedded/Application/Communication/Protocol.cpp @@ -152,18 +152,26 @@ static Protocol::Datapoint DecodeDatapoint(uint8_t *buf) { } static int16_t EncodeDatapoint(Protocol::Datapoint d, uint8_t *buf, uint16_t bufSize) { - Encoder e(buf, bufSize); - e.add(d.real_S11); - e.add(d.imag_S11); - e.add(d.real_S21); - e.add(d.imag_S21); - e.add(d.real_S12); - e.add(d.imag_S12); - e.add(d.real_S22); - e.add(d.imag_S22); - e.add(d.frequency); - e.add(d.pointNum); - return e.getSize(); + // Special case, bypassing the encoder for speed optimizations. + // The datapoint is only ever encoded on the device and the + // Protocol::Datapoint struct is setup without any padding between + // the variables. In this case it is allowed to simply copy its + // content into the buffer. Compared to using the encoder, this + // saves approximately 40us for each datapoint + memcpy(buf, &d, sizeof(d)); + return sizeof(d); +// Encoder e(buf, bufSize); +// e.add(d.real_S11); +// e.add(d.imag_S11); +// e.add(d.real_S21); +// e.add(d.imag_S21); +// e.add(d.real_S12); +// e.add(d.imag_S12); +// e.add(d.real_S22); +// e.add(d.imag_S22); +// e.add(d.frequency); +// e.add(d.pointNum); +// return e.getSize(); } static Protocol::SweepSettings DecodeSweepSettings(uint8_t *buf) { @@ -484,15 +492,25 @@ uint16_t Protocol::DecodeBuffer(uint8_t *buf, uint16_t len, PacketInfo *info) { return data - buf; } - /* The complete frame has been received, check checksum */ - uint32_t crc = *(uint32_t*) &data[length - 4]; - uint32_t compare = CRC32(0, data, length - 4); - if(crc != compare) { - // CRC mismatch, remove header - data += 1; - info->type = PacketType::None; - return data - buf; - } +// /* The complete frame has been received, check checksum */ +// auto type = (PacketType) data[3]; +// uint32_t crc = *(uint32_t*) &data[length - 4]; +// if(type != PacketType::Datapoint) { +// uint32_t compare = CRC32(0, data, length - 4); +// if(crc != compare) { +// // CRC mismatch, remove header +// data += 1; +// info->type = PacketType::None; +// return data - buf; +// } +// } else { +// // Datapoint has the CRC set to zero +// if(crc != 0x00000000) { +// data += 1; +// info->type = PacketType::None; +// return data - buf; +// } +// } // Valid packet, extract packet info info->type = (PacketType) data[3]; @@ -544,12 +562,12 @@ uint16_t Protocol::DecodeBuffer(uint8_t *buf, uint16_t len, PacketInfo *info) { return data - buf + length; } -uint16_t Protocol::EncodePacket(PacketInfo packet, uint8_t *dest, uint16_t destsize) { - int16_t payload_size = 0; +uint16_t Protocol::EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_t destsize) { + int16_t payload_size = 0; switch (packet.type) { case PacketType::Datapoint: payload_size = EncodeDatapoint(packet.datapoint, &dest[4], destsize - 8); - break; + break; case PacketType::SweepSettings: payload_size = EncodeSweepSettings(packet.settings, &dest[4], destsize - 8); break; @@ -600,7 +618,14 @@ uint16_t Protocol::EncodePacket(PacketInfo packet, uint8_t *dest, uint16_t dests memcpy(&dest[1], &overall_size, 2); dest[3] = (int) packet.type; // Calculate checksum - uint32_t crc = CRC32(0, dest, overall_size - 4); + uint32_t crc = 0x00000000; + if(packet.type == PacketType::Datapoint) { + // CRC calculation takes about 18us which is the bulk of the time required to encode and transmit a datapoint. + // Skip CRC for data points to optimize throughput + crc = 0x00000000; + } else { + crc = CRC32(0, dest, overall_size - 4); + } memcpy(&dest[overall_size - 4], &crc, 4); return overall_size; } diff --git a/Software/VNA_embedded/Application/Communication/Protocol.hpp b/Software/VNA_embedded/Application/Communication/Protocol.hpp index 2898339..1f666e7 100644 --- a/Software/VNA_embedded/Application/Communication/Protocol.hpp +++ b/Software/VNA_embedded/Application/Communication/Protocol.hpp @@ -173,6 +173,6 @@ using PacketInfo = struct _packetinfo { uint32_t CRC32(uint32_t crc, const void *data, uint32_t len); uint16_t DecodeBuffer(uint8_t *buf, uint16_t len, PacketInfo *info); -uint16_t EncodePacket(PacketInfo packet, uint8_t *dest, uint16_t destsize); +uint16_t EncodePacket(const PacketInfo &packet, uint8_t *dest, uint16_t destsize); } diff --git a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp index bbba3f6..5b74bb7 100644 --- a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp +++ b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.cpp @@ -237,9 +237,7 @@ static inline int64_t sign_extend_64(int64_t x, uint16_t bits) { } static FPGA::ReadCallback callback; -static uint8_t raw[36]; -static bool halted; -static bool new_sample; +static uint8_t raw[38]; static FPGA::SamplingResult result; static bool busy_reading = false; @@ -249,38 +247,11 @@ bool FPGA::InitiateSampleRead(ReadCallback cb) { return false; } callback = cb; - uint8_t cmd[2] = {0xC0, 0x00}; - uint16_t status; - - Low(CS); - HAL_SPI_TransmitReceive(&FPGA_SPI, cmd, (uint8_t*) &status, 2, 100); - - SwitchBytes(status); - - if (status & 0x0010) { - halted = true; - } else { - halted = false; - } - - if (!(status & 0x0004)) { - // no new data available yet - High(CS); - - if (halted) { - if (halted && halted_cb) { - halted_cb(); - halted = false; - } - } else { - LOG_WARN("ISR without new data, status: 0x%04x", status); - } - return false; - } - + uint8_t cmd[38] = {0xC0, 0x00}; // Start data read + Low(CS); busy_reading = true; - HAL_SPI_Receive_DMA(&FPGA_SPI, raw, 36); + HAL_SPI_TransmitReceive_DMA(&FPGA_SPI, cmd, raw, 38); return true; } @@ -292,24 +263,22 @@ static int64_t assembleSampleResultValue(uint8_t *raw) { } extern "C" { -void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi) { +void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { + uint16_t status = (uint16_t) raw[0] << 8 | raw[1]; // Assemble data from words - result.P1I = assembleSampleResultValue(&raw[30]); - result.P1Q = assembleSampleResultValue(&raw[24]); - result.P2I = assembleSampleResultValue(&raw[18]); - result.P2Q = assembleSampleResultValue(&raw[12]); - result.RefI = assembleSampleResultValue(&raw[6]); - result.RefQ = assembleSampleResultValue(&raw[0]); + result.P1I = assembleSampleResultValue(&raw[32]); + result.P1Q = assembleSampleResultValue(&raw[26]); + result.P2I = assembleSampleResultValue(&raw[20]); + result.P2Q = assembleSampleResultValue(&raw[14]); + result.RefI = assembleSampleResultValue(&raw[8]); + result.RefQ = assembleSampleResultValue(&raw[2]); High(CS); busy_reading = false; - new_sample = true; - if (new_sample && callback) { + if ((status & 0x0004) && callback) { callback(result); - new_sample = false; } - if (halted && halted_cb) { + if ((status & 0x0010) && halted_cb) { halted_cb(); - halted = false; } } } diff --git a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp index 0b2f326..c628a8c 100644 --- a/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp +++ b/Software/VNA_embedded/Application/Drivers/FPGA/FPGA.hpp @@ -110,7 +110,7 @@ void DisableInterrupt(Interrupt i); void WriteMAX2871Default(uint32_t *DefaultRegs); void WriteSweepConfig(uint16_t pointnum, bool lowband, uint32_t *SourceRegs, uint32_t *LORegs, uint8_t attenuation, uint64_t frequency, SettlingTime settling, Samples samples, bool halt = false, LowpassFilter filter = LowpassFilter::Auto); -using ReadCallback = void(*)(SamplingResult result); +using ReadCallback = void(*)(const SamplingResult &result); bool InitiateSampleRead(ReadCallback cb); ADCLimits GetADCLimits(); void ResetADCLimits(); diff --git a/Software/VNA_embedded/Application/Drivers/USB/usb.c b/Software/VNA_embedded/Application/Drivers/USB/usb.c index b06eab3..0cd1891 100644 --- a/Software/VNA_embedded/Application/Drivers/USB/usb.c +++ b/Software/VNA_embedded/Application/Drivers/USB/usb.c @@ -19,7 +19,7 @@ static uint8_t *USBD_Class_GetDeviceQualifierDescriptor (uint16_t *length); static usbd_recv_callback_t cb; static uint8_t usb_receive_buffer[1024]; -static uint8_t usb_transmit_fifo[4096]; +static uint8_t usb_transmit_fifo[4092]; static uint16_t usb_transmit_read_index = 0; static uint16_t usb_transmit_fifo_level = 0; static bool data_transmission_active = false; @@ -218,10 +218,9 @@ void usb_init(usbd_recv_callback_t receive_callback) { USBD_Start(&hUsbDeviceFS); HAL_NVIC_SetPriority(USB_HP_IRQn, 0, 0); HAL_NVIC_EnableIRQ(USB_HP_IRQn); - HAL_NVIC_SetPriority(USB_LP_IRQn, 7, 0); + HAL_NVIC_SetPriority(USB_LP_IRQn, 5, 0); HAL_NVIC_EnableIRQ(USB_LP_IRQn); } - bool usb_transmit(const uint8_t *data, uint16_t length) { // attempt to add data to fifo if(usb_transmit_fifo_level + length > sizeof(usb_transmit_fifo)) { diff --git a/Software/VNA_embedded/Application/Hardware.cpp b/Software/VNA_embedded/Application/Hardware.cpp index 295beec..6e65c12 100644 --- a/Software/VNA_embedded/Application/Hardware.cpp +++ b/Software/VNA_embedded/Application/Hardware.cpp @@ -30,7 +30,7 @@ static void HaltedCallback() { } } -static void ReadComplete(FPGA::SamplingResult result) { +static void ReadComplete(const FPGA::SamplingResult &result) { bool needs_work = false; switch(activeMode) { case HW::Mode::VNA: @@ -71,6 +71,16 @@ void HW::Work() { } bool HW::Init() { +#ifdef USE_DEBUG_PINS + // initialize debug pins + GPIO_InitTypeDef gpio; + gpio.Pin = DEBUG1_PIN; + gpio.Mode = GPIO_MODE_OUTPUT_PP; + gpio.Speed = GPIO_SPEED_HIGH; + HAL_GPIO_Init(DEBUG1_GPIO, &gpio); + gpio.Pin = DEBUG2_PIN; + HAL_GPIO_Init(DEBUG2_GPIO, &gpio); +#endif LOG_DEBUG("Initializing..."); activeMode = Mode::Idle; diff --git a/Software/VNA_embedded/Application/Hardware.hpp b/Software/VNA_embedded/Application/Hardware.hpp index bdbc887..b1f08d1 100644 --- a/Software/VNA_embedded/Application/Hardware.hpp +++ b/Software/VNA_embedded/Application/Hardware.hpp @@ -3,6 +3,25 @@ #include #include "Protocol.hpp" +#define USE_DEBUG_PINS + +#ifdef USE_DEBUG_PINS +#define DEBUG1_GPIO GPIOA +#define DEBUG1_PIN GPIO_PIN_13 +#define DEBUG2_GPIO GPIOA +#define DEBUG2_PIN GPIO_PIN_14 + +#define DEBUG1_LOW() do {DEBUG1_GPIO->BSRR = DEBUG1_PIN<<16; }while(0) +#define DEBUG1_HIGH() do {DEBUG1_GPIO->BSRR = DEBUG1_PIN; }while(0) +#define DEBUG2_LOW() do {DEBUG2_GPIO->BSRR = DEBUG2_PIN<<16; }while(0) +#define DEBUG2_HIGH() do {DEBUG2_GPIO->BSRR = DEBUG2_PIN; }while(0) +#else +#define DEBUG1_LOW() +#define DEBUG1_HIGH() +#define DEBUG2_LOW() +#define DEBUG2_HIGH() +#endif + namespace HW { static constexpr uint32_t ADCSamplerate = 800000; diff --git a/Software/VNA_embedded/Application/Manual.cpp b/Software/VNA_embedded/Application/Manual.cpp index 42d0f29..42cb1e2 100644 --- a/Software/VNA_embedded/Application/Manual.cpp +++ b/Software/VNA_embedded/Application/Manual.cpp @@ -77,7 +77,7 @@ void Manual::Setup(Protocol::ManualControl m) { FPGA::StartSweep(); } -bool Manual::MeasurementDone(FPGA::SamplingResult result) { +bool Manual::MeasurementDone(const FPGA::SamplingResult &result) { if(!active) { return false; } diff --git a/Software/VNA_embedded/Application/Manual.hpp b/Software/VNA_embedded/Application/Manual.hpp index ab3f39d..35e6517 100644 --- a/Software/VNA_embedded/Application/Manual.hpp +++ b/Software/VNA_embedded/Application/Manual.hpp @@ -6,7 +6,7 @@ namespace Manual { void Setup(Protocol::ManualControl m); -bool MeasurementDone(FPGA::SamplingResult result); +bool MeasurementDone(const FPGA::SamplingResult &result); void Work(); void Stop(); diff --git a/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp b/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp index 48f6527..c5c869a 100644 --- a/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp +++ b/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp @@ -149,7 +149,7 @@ void SA::Setup(Protocol::SpectrumAnalyzerSettings settings) { StartNextSample(); } -bool SA::MeasurementDone(FPGA::SamplingResult result) { +bool SA::MeasurementDone(const FPGA::SamplingResult &result) { if(!active) { return false; } diff --git a/Software/VNA_embedded/Application/SpectrumAnalyzer.hpp b/Software/VNA_embedded/Application/SpectrumAnalyzer.hpp index 9219133..75a7f88 100644 --- a/Software/VNA_embedded/Application/SpectrumAnalyzer.hpp +++ b/Software/VNA_embedded/Application/SpectrumAnalyzer.hpp @@ -14,7 +14,7 @@ enum class Detector { }; void Setup(Protocol::SpectrumAnalyzerSettings settings); -bool MeasurementDone(FPGA::SamplingResult result); +bool MeasurementDone(const FPGA::SamplingResult &result); void Work(); void Stop(); diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp index 8072423..d7010d4 100644 --- a/Software/VNA_embedded/Application/VNA.cpp +++ b/Software/VNA_embedded/Application/VNA.cpp @@ -190,7 +190,7 @@ static void PassOnData() { } } -bool VNA::MeasurementDone(FPGA::SamplingResult result) { +bool VNA::MeasurementDone(const FPGA::SamplingResult &result) { if(!active) { return false; } diff --git a/Software/VNA_embedded/Application/VNA.hpp b/Software/VNA_embedded/Application/VNA.hpp index 9b1ba57..693ba84 100644 --- a/Software/VNA_embedded/Application/VNA.hpp +++ b/Software/VNA_embedded/Application/VNA.hpp @@ -6,10 +6,10 @@ namespace VNA { -using SweepCallback = void(*)(Protocol::Datapoint); +using SweepCallback = void(*)(const Protocol::Datapoint&); bool Setup(Protocol::SweepSettings s, SweepCallback cb); -bool MeasurementDone(FPGA::SamplingResult result); +bool MeasurementDone(const FPGA::SamplingResult &result); void Work(); void SweepHalted(); void Stop();