summaryrefslogtreecommitdiff
path: root/daemon/src/Gpio.h
blob: 81e048fa73b8d28a4dd7bedfd9b3d13f33cdc6d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <array>

#include <rpc/server.h>

#include "Assembly.h"


class Gpio
{
public:
	Gpio() noexcept;
	void apply(AssemblyContext ctx);
private:
	static constexpr unsigned SIZE {24};
	std::array<short, SIZE> mode_of;
	std::array<short, SIZE> value_of;

	void set_mode(const unsigned port, const short mode);
	void write(const unsigned port, const short value);
	short read(const unsigned port) const;
};