Fix DSP source block initialization and add linux support to hydrasdr_source

pull/1678/head
AlexandreRouma 2025-07-20 20:33:07 +02:00
rodzic a94e2d6712
commit f67fa0c66c
3 zmienionych plików z 39 dodań i 3 usunięć

Wyświetl plik

@ -5,8 +5,6 @@ namespace dsp {
template <class T>
class Source : public block {
public:
Source() {}
Source() { init(); }
virtual ~Source() {}

Wyświetl plik

@ -14,5 +14,16 @@ if (MSVC)
elseif (ANDROID)
# TODO
else (MSVC)
# TODO
find_package(PkgConfig)
pkg_check_modules(LIBHYDRASDR REQUIRED libhydrasdr)
target_include_directories(hydrasdr_source PRIVATE ${LIBHYDRASDR_INCLUDE_DIRS})
target_link_directories(hydrasdr_source PRIVATE ${LIBHYDRASDR_LIBRARY_DIRS})
target_link_libraries(hydrasdr_source PRIVATE ${LIBHYDRASDR_LIBRARIES})
# Include it because for some reason pkgconfig doesn't look here?
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_include_directories(hydrasdr_source PRIVATE "/usr/local/include")
endif()
endif ()

Wyświetl plik

@ -36,6 +36,9 @@ public:
ports.define("rx1", "RX1", RF_PORT_RX1);
ports.define("rx2", "RX2", RF_PORT_RX2);
regStr[0] = 0;
valStr[0] = 0;
sampleRate = 10000000.0;
handler.ctx = this;
@ -567,8 +570,32 @@ private:
config.release(true);
}
}
SmGui::LeftLabel("Reg");
SmGui::FillWidth();
SmGui::InputText(CONCAT("##_badgesdr_reg_", _this->name), _this->regStr, 256);
SmGui::LeftLabel("Value");
SmGui::FillWidth();
SmGui::InputText(CONCAT("##_badgesdr_val_", _this->name), _this->valStr, 256);
SmGui::FillWidth();
if (ImGui::Button(CONCAT("Read##_badgesdr_rd_", _this->name))) {
if (_this->running) {
uint8_t val;
hydrasdr_r82x_read(_this->openDev, std::stoi(_this->regStr, NULL, 16), &val);
sprintf(_this->valStr, "%02X", val);
}
}
SmGui::FillWidth();
if (ImGui::Button(CONCAT("Write##_badgesdr_wr_", _this->name))) {
if (_this->running) {
hydrasdr_r82x_write(_this->openDev, std::stoi(_this->regStr, NULL, 16), std::stoi(_this->valStr, NULL, 16));
}
}
}
char valStr[256];
char regStr[256];
static int callback(hydrasdr_transfer_t* transfer) {
HydraSDRSourceModule* _this = (HydraSDRSourceModule*)transfer->ctx;
memcpy(_this->stream.writeBuf, transfer->samples, transfer->sample_count * sizeof(dsp::complex_t));