diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/CMakeLists.txt | 1 | ||||
-rw-r--r-- | library/include/hwd.h | 11 | ||||
-rw-r--r-- | library/src/sinewave.cpp | 44 |
3 files changed, 56 insertions, 0 deletions
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 28ccbb1..a454186 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -3,6 +3,7 @@ add_library(${PROJECT_NAME} SHARED src/client.cpp src/gpio.cpp src/memory.cpp + src/sinewave.cpp ) target_link_libraries(${PROJECT_NAME} PUBLIC rpclib::rpc diff --git a/library/include/hwd.h b/library/include/hwd.h index fbd2fef..4ea75fa 100644 --- a/library/include/hwd.h +++ b/library/include/hwd.h @@ -20,4 +20,15 @@ std::vector<char> read(std::size_t len, std::size_t off); bool write(const std::vector<char> data, std::size_t off); } // namespace memory +namespace sinewave +{ + void set_amplitude(double); + void set_frequency(double); + void set_phase(double); + double get_amplitude(); + double get_frequency(); + double get_phase(); + double get_point(); +} // namespace sinewave + } // namespace hwd diff --git a/library/src/sinewave.cpp b/library/src/sinewave.cpp new file mode 100644 index 0000000..3a1d8ec --- /dev/null +++ b/library/src/sinewave.cpp @@ -0,0 +1,44 @@ +#include "hwd.h" + +#include "client.h" + +namespace hwd +{ +namespace sinewave +{ + void set_amplitude(double amplitude) + { + get_client().call("sinewave/set_amplitude", amplitude); + } + + void set_frequency(double frequency) + { + get_client().call("sinewave/set_frequency", frequency); + } + + void set_phase(double phase) + { + get_client().call("sinewave/set_phase", phase); + } + + double get_amplitude() + { + return get_client().call("sinewave/get_amplitude").as<double>(); + } + + double get_frequency() + { + return get_client().call("sinewave/get_frequency").as<double>(); + } + + double get_phase() + { + return get_client().call("sinewave/get_phase").as<double>(); + } + + double get_point() { + return get_client().call("sinewave/get_point").as<double>(); + } + +} // namespace sinewave +} // namespace hwd |