From 439f76609407da15096c1f2835b8eb7034211c88 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 21 Oct 2021 21:26:57 +0200 Subject: Renamed gpio source of library --- library/CMakeLists.txt | 2 +- library/src/gpio.cpp | 34 ++++++++++++++++++++++++++++++++++ library/src/library.cpp | 34 ---------------------------------- 3 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 library/src/gpio.cpp delete mode 100644 library/src/library.cpp (limited to 'library') diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 6eaac8f..a652762 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -1,6 +1,6 @@ project(library CXX) add_library(${PROJECT_NAME} SHARED - src/library.cpp + src/gpio.cpp ) target_link_libraries(${PROJECT_NAME} PUBLIC rpclib::rpc diff --git a/library/src/gpio.cpp b/library/src/gpio.cpp new file mode 100644 index 0000000..18c3cff --- /dev/null +++ b/library/src/gpio.cpp @@ -0,0 +1,34 @@ +#include + +#include + +namespace hwd +{ + +static rpc::client & get_client() +{ + static rpc::client c(hwd::internal::host(), hwd::internal::port()); + return c; +} + +namespace gpio +{ + +void set_mode(const unsigned port, const short mode) +{ + get_client().call("gpio/set_mode", port, mode); +} + +void write(const unsigned port, const short value) +{ + get_client().call("gpio/write", port, value); +} + +short read(const unsigned port) +{ + return get_client().call("gpio/read", port).as(); +} + +} // namespace gpio + +} // namespace hwd diff --git a/library/src/library.cpp b/library/src/library.cpp deleted file mode 100644 index 18c3cff..0000000 --- a/library/src/library.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include - -namespace hwd -{ - -static rpc::client & get_client() -{ - static rpc::client c(hwd::internal::host(), hwd::internal::port()); - return c; -} - -namespace gpio -{ - -void set_mode(const unsigned port, const short mode) -{ - get_client().call("gpio/set_mode", port, mode); -} - -void write(const unsigned port, const short value) -{ - get_client().call("gpio/write", port, value); -} - -short read(const unsigned port) -{ - return get_client().call("gpio/read", port).as(); -} - -} // namespace gpio - -} // namespace hwd -- cgit v1.1