DHCOM_HAL
Hardware-abstraction library (HAL) for multiple targets, including DHCOM modules
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
I2CSlave.h
Go to the documentation of this file.
1 /*
2  * I2CSlave.h
3  *
4  * Created on: Dec 19, 2012
5  * Author: Peter Kishalov (PK), DH electronics GmbH
6  */
7 
8 
9 #ifndef I2CSLAVE_H_
10 #define I2CSLAVE_H_
11 
12 
13 #include <DHCOM_HAL.h>
14 #include <hal/Types.h>
15 #include <hal/I2CBus.h>
16 
17 
18 namespace dhcom
19 {
20 
21 
23 {
24 public:
25  I2CSlave(I2CBus *bus, uint16_t address);
26 
27  STATUS read(uint8_t *buffer, uint32_t count) const;
28  uint8_t read(STATUS *status = NULL) const;
29  STATUS write(const uint8_t *buffer, uint32_t count);
30  STATUS write(uint8_t byte);
31 
32 private:
33  I2CBus * const bus_;
34  uint16_t address_;
35 };
36 
37 
85 }
86 
87 
88 #endif /* I2CSLAVE_H_ */