diff --git a/Software/PC_Application/Application b/Software/PC_Application/Application new file mode 100755 index 0000000..7eabee1 Binary files /dev/null and b/Software/PC_Application/Application differ diff --git a/Software/VNA_embedded/.cproject b/Software/VNA_embedded/.cproject index d5177c1..af2efed 100644 --- a/Software/VNA_embedded/.cproject +++ b/Software/VNA_embedded/.cproject @@ -1,4 +1,4 @@ - + @@ -7,21 +7,21 @@ - + - + - + - + - + - + - + @@ -29,41 +29,41 @@ - + - - - - + @@ -451,21 +451,21 @@ - + - + - + - + - + - + - + @@ -479,33 +479,33 @@ - - - + @@ -775,51 +775,51 @@ - + - + - + - + - + - + - + - + - + - + diff --git a/Software/VNA_embedded/Application/App.cpp b/Software/VNA_embedded/Application/App.cpp index 352161f..68e761e 100644 --- a/Software/VNA_embedded/Application/App.cpp +++ b/Software/VNA_embedded/Application/App.cpp @@ -40,7 +40,6 @@ extern ADC_HandleTypeDef hadc1; #define FLAG_USB_PACKET 0x01 #define FLAG_DATAPOINT 0x02 -#define FLAG_WORK_REQUIRED 0x04 static void VNACallback(Protocol::Datapoint res) { result = res; @@ -54,11 +53,6 @@ static void USBPacketReceived(Protocol::PacketInfo p) { xTaskNotifyFromISR(handle, FLAG_USB_PACKET, eSetBits, &woken); portYIELD_FROM_ISR(woken); } -static void HardwareWorkRequired() { - BaseType_t woken = false; - xTaskNotifyFromISR(handle, FLAG_WORK_REQUIRED, eSetBits, &woken); - portYIELD_FROM_ISR(woken); -} void App_Start() { STM::Init(); @@ -101,7 +95,7 @@ void App_Start() { EN_6V_GPIO_Port->BSRR = EN_6V_Pin; #endif - if (!HW::Init(HardwareWorkRequired)) { + if (!HW::Init()) { LOG_CRIT("Initialization failed, unable to start"); LED::Error(4); } @@ -119,9 +113,6 @@ void App_Start() { uint32_t notification; if(xTaskNotifyWait(0x00, UINT32_MAX, ¬ification, 100) == pdPASS) { // something happened - if(notification & FLAG_WORK_REQUIRED) { - HW::Work(); - } if(notification & FLAG_DATAPOINT) { Protocol::PacketInfo packet; packet.type = Protocol::PacketType::Datapoint; @@ -217,7 +208,7 @@ void App_Start() { LOG_WARN("Timed out waiting for point, last received point was %d (Status 0x%04x)", result.pointNum, FPGA::GetStatus()); FPGA::AbortSweep(); // restart the current sweep - HW::Init(HardwareWorkRequired); + HW::Init(); HW::Ref::update(); VNA::Setup(settings, VNACallback); sweepActive = true; diff --git a/Software/VNA_embedded/Application/Hardware.cpp b/Software/VNA_embedded/Application/Hardware.cpp index 56937b2..295beec 100644 --- a/Software/VNA_embedded/Application/Hardware.cpp +++ b/Software/VNA_embedded/Application/Hardware.cpp @@ -30,8 +30,6 @@ static void HaltedCallback() { } } -static HW::WorkRequest requestWork; - static void ReadComplete(FPGA::SamplingResult result) { bool needs_work = false; switch(activeMode) { @@ -47,8 +45,8 @@ static void ReadComplete(FPGA::SamplingResult result) { default: break; } - if(needs_work && requestWork) { - STM::DispatchToInterrupt(requestWork); + if(needs_work) { + STM::DispatchToInterrupt(HW::Work); } } @@ -72,8 +70,7 @@ void HW::Work() { } } -bool HW::Init(WorkRequest wr) { - requestWork = wr; +bool HW::Init() { LOG_DEBUG("Initializing..."); activeMode = Mode::Idle; @@ -189,7 +186,7 @@ void HW::SetMode(Mode mode) { } if(mode != Mode::Idle && activeMode != Mode::Idle) { // do a full initialization when switching directly between modes - HW::Init(requestWork); + HW::Init(); } SetIdle(); activeMode = mode; diff --git a/Software/VNA_embedded/Application/Hardware.hpp b/Software/VNA_embedded/Application/Hardware.hpp index 28657ae..ae90e84 100644 --- a/Software/VNA_embedded/Application/Hardware.hpp +++ b/Software/VNA_embedded/Application/Hardware.hpp @@ -33,9 +33,7 @@ enum class Mode { SA, }; -using WorkRequest = void (*)(void); - -bool Init(WorkRequest wr); +bool Init(); void SetMode(Mode mode); void SetIdle(); void Work();