bus.hpp
1.14 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2015-2016, Arkadiusz Materek (arekmat@poczta.fm)
*
* Licensed under GNU General Public License 3.0 or later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef XMC_DALI_BUS_HPP_
#define XMC_DALI_BUS_HPP_
#include <dali/dali.hpp>
namespace dali {
namespace xmc {
class Bus: public dali::IBus {
public:
static Bus* getInstance();
dali::Status registerClient(IBusClient* c) override;
dali::Status unregisterClient(IBusClient* c) override;
dali::Status sendAck(uint8_t ack) override;
static void runSlice();
private:
Bus();
Bus(const Bus& other) = delete;
Bus& operator=(const Bus&) = delete;
~Bus();
static void onDataReceived(uint64_t timeMs, uint16_t data);
static void onBusStateChanged(IBusState state);
static void initRx();
static bool checkRxTx(uint64_t time, uint16_t* data);
static void initTx();
static void tx(uint8_t data);
};
} // namespace xmc
} // namespace dali
#endif // XMC_DALI_BUS_HPP_