amiro-os / include / amiro / bus / i2c / I2CDriver.hpp @ 58fe0e0b
History | View | Annotate | Download (835 Bytes)
1 | 58fe0e0b | Thomas Schöpping | /*
|
---|---|---|---|
2 | * AI2CDriver.hpp
|
||
3 | *
|
||
4 | * Created on: Jun 6, 2014
|
||
5 | * Author: Robert ABEL
|
||
6 | */
|
||
7 | |||
8 | #ifndef AI2CDRIVER_HPP_
|
||
9 | #define AI2CDRIVER_HPP_
|
||
10 | |||
11 | #include <ch.hpp> |
||
12 | #include <hal.h> |
||
13 | |||
14 | /**
|
||
15 | * @brief AMiRo
|
||
16 | */
|
||
17 | namespace amiro {
|
||
18 | |||
19 | struct I2CTxParams;
|
||
20 | struct I2CRxParams;
|
||
21 | |||
22 | /**
|
||
23 | * @brief I²C Driver Interface
|
||
24 | */
|
||
25 | class I2CDriver { |
||
26 | |||
27 | public:
|
||
28 | |||
29 | I2CDriver() {}; |
||
30 | virtual ~I2CDriver() {};
|
||
31 | |||
32 | virtual void start(const ::I2CConfig *config) = 0; |
||
33 | virtual void stop() = 0; |
||
34 | virtual i2cflags_t getErrors() = 0; |
||
35 | virtual msg_t masterTransmit(const I2CTxParams *params, systime_t timeout = TIME_INFINITE) = 0; |
||
36 | virtual msg_t masterReceive(const I2CRxParams *params, systime_t timeout = TIME_INFINITE) = 0; |
||
37 | |||
38 | virtual void acquireBus() = 0; |
||
39 | virtual void releaseBus() = 0; |
||
40 | |||
41 | }; |
||
42 | |||
43 | } /* amiro */
|
||
44 | |||
45 | #endif /* AI2CDRIVER_HPP_ */ |