Skip to content

Commit 24437a3

Browse files
committed
cn0511: create package
Signed-off-by: IonutMuthi <Ionut.Muthi@analog.com>
1 parent 72edc10 commit 24437a3

File tree

8 files changed

+670
-0
lines changed

8 files changed

+670
-0
lines changed

packages/cn0511/CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Copyright (c) 2025 Analog Devices Inc.
3+
#
4+
# This file is part of Scopy
5+
# (see https://www.github.com/analogdevicesinc/scopy).
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
cmake_minimum_required(VERSION 3.9)
22+
23+
set(SCOPY_MODULE cn0511)
24+
set(CURRENT_PKG_PATH ${CMAKE_CURRENT_SOURCE_DIR})
25+
set(PACKAGE_NAME ${SCOPY_MODULE})
26+
27+
set(PACKAGE_DISPLAY_NAME "CN0511")
28+
set(PACKAGE_DESCRIPTION "Plugin for CN0511")
29+
30+
project(scopy-package-${SCOPY_MODULE} VERSION 0.1 LANGUAGES CXX)
31+
32+
configure_file(manifest.json.cmakein ${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/MANIFEST.json @ONLY)
33+
message(STATUS "Including plugins for ${SCOPY_MODULE}")
34+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
35+
add_plugins(${CMAKE_CURRENT_SOURCE_DIR}/plugins ${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/plugins)
36+
install_plugins(
37+
${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/plugins
38+
${SCOPY_PACKAGE_INSTALL_PATH}/${SCOPY_MODULE}/plugins "scopy"
39+
)
40+
endif()
41+
install_pkg(${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE} ${SCOPY_PACKAGE_INSTALL_PATH}/${SCOPY_MODULE})
42+
43+
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
44+
set(INSTALLER_DESCRIPTION "${PACKAGE_DISPLAY_NAME} - ${PACKAGE_DESCRIPTION}")
45+
configureinstallersettings(${SCOPY_MODULE} ${INSTALLER_DESCRIPTION} FALSE)
46+
endif()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"id": "cn0511",
3+
"title": "CN0511",
4+
"version": "@PROJECT_VERSION@",
5+
"description": "This package includes a plugin that provides support for CN0511.",
6+
"license": "LGPL",
7+
"author": "Analog Devices Inc.",
8+
"download_link": "",
9+
"zip_checksum": "",
10+
"scopy_compatibility": ["@CMAKE_PROJECT_VERSION@"],
11+
"category": ["iio", "plugin", "base-pkg"]
12+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#
2+
# Copyright (c) 2025 Analog Devices Inc.
3+
#
4+
# This file is part of Scopy
5+
# (see https://www.github.com/analogdevicesinc/scopy).
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
cmake_minimum_required(VERSION 3.9)
22+
23+
set(SCOPY_MODULE cn0511)
24+
25+
project(scopy-${SCOPY_MODULE} VERSION 0.1 LANGUAGES CXX)
26+
27+
set(PLUGIN_NAME Cn0511Plugin)
28+
set(PLUGIN_DISPLAY_NAME CN0511)
29+
set(PLUGIN_DESCRIPTION "This is a plugin for CN0511")
30+
31+
include(GenerateExportHeader)
32+
33+
set(CMAKE_CXX_STANDARD 17)
34+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
35+
36+
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
37+
set(CMAKE_AUTOUIC ON)
38+
set(CMAKE_AUTOMOC ON)
39+
set(CMAKE_AUTORCC ON)
40+
41+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
42+
43+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
44+
set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
45+
46+
file(GLOB SRC_LIST src/*.cpp src/*.cc)
47+
file(GLOB HEADER_LIST include/${SCOPY_MODULE}/*.h include/${SCOPY_MODULE}/*.hpp)
48+
49+
set(PROJECT_SOURCES ${SRC_LIST} ${HEADER_LIST})
50+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS REQUIRED Widgets Core)
51+
52+
find_library(AD9166_LIBRARIES NAMES ad9166 libad9166 REQUIRED)
53+
find_path(AD9166_INCLUDE_DIRS ad9166.h REQUIRED)
54+
55+
add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCES})
56+
57+
generate_export_header(
58+
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
59+
)
60+
61+
configure_file(
62+
include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h.cmakein
63+
${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/scopy-${SCOPY_MODULE}_config.h @ONLY
64+
)
65+
66+
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
67+
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE})
68+
69+
target_include_directories(${PROJECT_NAME} PUBLIC scopy-pluginbase scopy-gui scopy-pkg-manager)
70+
71+
target_link_libraries(
72+
${PROJECT_NAME}
73+
PUBLIC Qt::Widgets
74+
Qt::Core
75+
scopy-pluginbase
76+
scopy-gui
77+
scopy-iioutil
78+
scopy-iio-widgets
79+
scopy-pkg-manager
80+
${AD9166_LIBRARIES}
81+
)
82+
83+
set(CN0511_TARGET_NAME ${PROJECT_NAME} PARENT_SCOPE)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Copyright (c) 2025 Analog Devices Inc.
3+
*
4+
* This file is part of Scopy
5+
* (see https://www.github.com/analogdevicesinc/scopy).
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*
20+
*/
21+
22+
#ifndef CN0511_H
23+
#define CN0511_H
24+
25+
#include "scopy-cn0511_export.h"
26+
#include <QBoxLayout>
27+
#include <QWidget>
28+
#include <QDoubleSpinBox>
29+
#include <QSpinBox>
30+
#include <QPushButton>
31+
#include <tooltemplate.h>
32+
#include <animatedrefreshbtn.h>
33+
#include <iio-widgets/iiowidgetbuilder.h>
34+
35+
struct iio_context;
36+
struct iio_device;
37+
struct iio_channel;
38+
39+
namespace scopy {
40+
class IIOWidgetGroup;
41+
namespace cn0511 {
42+
43+
class SCOPY_CN0511_EXPORT CN0511 : public QWidget
44+
{
45+
Q_OBJECT
46+
public:
47+
CN0511(iio_context *ctx, IIOWidgetGroup *group = nullptr, QWidget *parent = nullptr);
48+
~CN0511();
49+
50+
Q_SIGNALS:
51+
void readRequested();
52+
53+
private Q_SLOTS:
54+
void applyCalibration();
55+
56+
private:
57+
iio_context *m_ctx = nullptr;
58+
IIOWidgetGroup *m_group = nullptr;
59+
ToolTemplate *m_tool = nullptr;
60+
AnimatedRefreshBtn *m_refreshButton = nullptr;
61+
62+
iio_device *m_dac = nullptr;
63+
iio_channel *m_dacCh = nullptr;
64+
65+
QDoubleSpinBox *m_freqSpinBox = nullptr;
66+
QSpinBox *m_ampSpinBox = nullptr;
67+
68+
double m_calibFreq = 4500000000.0;
69+
int m_amplitude = 0;
70+
71+
QWidget *generateSingleToneSection(QWidget *parent);
72+
QWidget *generateDacAmpSection(QWidget *parent);
73+
};
74+
} // namespace cn0511
75+
} // namespace scopy
76+
#endif // CN0511_H
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025 Analog Devices Inc.
3+
*
4+
* This file is part of Scopy
5+
* (see https://www.github.com/analogdevicesinc/scopy).
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*
20+
*/
21+
22+
#ifndef CN0511PLUGIN_H
23+
#define CN0511PLUGIN_H
24+
25+
#define SCOPY_PLUGIN_NAME Cn0511Plugin
26+
27+
#include "scopy-cn0511_export.h"
28+
#include <QObject>
29+
#include <pluginbase/plugin.h>
30+
#include <pluginbase/pluginbase.h>
31+
32+
namespace scopy {
33+
class IIOWidgetGroup;
34+
}
35+
36+
namespace scopy::cn0511 {
37+
38+
class SCOPY_CN0511_EXPORT Cn0511Plugin : public QObject, public PluginBase
39+
{
40+
Q_OBJECT
41+
SCOPY_PLUGIN;
42+
43+
public:
44+
bool compatible(QString m_param, QString category) override;
45+
bool loadPage() override;
46+
bool loadIcon() override;
47+
void loadToolList() override;
48+
void unload() override;
49+
void initMetadata() override;
50+
QString description() override;
51+
QString displayName() override;
52+
53+
public Q_SLOTS:
54+
bool onConnect() override;
55+
bool onDisconnect() override;
56+
57+
private:
58+
IIOWidgetGroup *m_widgetGroup = nullptr;
59+
};
60+
} // namespace scopy::cn0511
61+
#endif // CN0511PLUGIN_H
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef SCOPY_CN0511_CONFIG_H_CMAKEIN
2+
#define SCOPY_CN0511_CONFIG_H_CMAKEIN
3+
4+
#define CN0511_PLUGIN_NAME "@PLUGIN_NAME@"
5+
#define CN0511_PLUGIN_DISPLAY_NAME "@PLUGIN_DISPLAY_NAME@"
6+
#define CN0511_PLUGIN_SCOPY_MODULE "@SCOPY_MODULE@"
7+
#define CN0511_PLUGIN_DESCRIPTION "@PLUGIN_DESCRIPTION@"
8+
9+
#cmakedefine ENABLE_SCOPYJS
10+
11+
#endif // SCOPY_CN0511_CONFIG_H_CMAKEIN

0 commit comments

Comments
 (0)