blob: 18c3cffa40829d6f9d7e6b669fcde37b6d6e1d24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <rpc/client.h>
#include <hwd/internal.h>
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<short>();
}
} // namespace gpio
} // namespace hwd
|