blob: d5c51c7ef12f4288da685617b7422b88a614f3fe (
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("127.0.0.1", hwd::internal::default_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
|