From bc99c3926208af887e4ca9d318f1d4c4744de397 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 21 Oct 2021 21:45:51 +0200 Subject: Added memory interface to the library --- library/include/hwd.h | 12 ++++++++++++ library/src/memory.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 library/src/memory.cpp (limited to 'library') diff --git a/library/include/hwd.h b/library/include/hwd.h index 3bec6be..fbd2fef 100644 --- a/library/include/hwd.h +++ b/library/include/hwd.h @@ -1,11 +1,23 @@ #pragma once +#include +#include + + namespace hwd { + namespace gpio { void set_mode(const unsigned port, const short mode); void write(const unsigned port, const short value); short read(const unsigned port); } // namespace gpio + +namespace memory +{ +std::vector read(std::size_t len, std::size_t off); +bool write(const std::vector data, std::size_t off); +} // namespace memory + } // namespace hwd diff --git a/library/src/memory.cpp b/library/src/memory.cpp new file mode 100644 index 0000000..c3c5b2a --- /dev/null +++ b/library/src/memory.cpp @@ -0,0 +1,25 @@ +#include "hwd.h" + +#include +#include + +#include "client.h" + + +namespace hwd +{ +namespace memory +{ + +std::vector read(std::size_t len, std::size_t off) +{ + return get_client().call("memory/read", len, off).as>(); +} + +bool write(const std::vector data, std::size_t off) +{ + return get_client().call("memory/write", data, off).as(); +} + +} // namespace memory +} // namespace hwd -- cgit v1.1