Flair
Framework Libre Air
I2cPort.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
13 #ifndef I2CPORT_H
14 #define I2CPORT_H
15 
16 #include <Mutex.h>
17 #include <stdint.h>
18 
19 namespace flair {
20 namespace core {
31 class I2cPort : public Mutex {
32 public:
41  I2cPort(const Object *parent, std::string name) : Mutex(parent, name) {}
42 
47  ~I2cPort(){};
48 
56  virtual int SetSlave(uint16_t address) = 0;
57 
66  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
67 
76  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
77 
85  virtual void SetRxTimeout(Time timeout_ns) = 0;
86 
94  virtual void SetTxTimeout(Time timeout_ns) = 0;
95 };
96 } // end namespace core
97 } // end namespace flair
98 
99 #endif // I2CPORT_H
Base class for all Framework's classes.
Definition: Object.h:83
namespace of the flair Framework
Definition: Ahrs.h:19
Class defining a mutex.
Definition: Mutex.h:29
~I2cPort()
Destructor.
Definition: I2cPort.h:47
unsigned long long Time
Time definition, in ns.
Definition: Object.h:55
virtual void SetRxTimeout(Time timeout_ns)=0
Set RX timeout.
virtual int SetSlave(uint16_t address)=0
Set slave's address.
virtual void SetTxTimeout(Time timeout_ns)=0
Set TX timeout.
Class defining a mutex.
Base class for i2c port.
Definition: I2cPort.h:31
virtual ssize_t Read(void *buf, size_t nbyte)=0
Read datas.
virtual ssize_t Write(const void *buf, size_t nbyte)=0
Write datas.
I2cPort(const Object *parent, std::string name)
Constructor.
Definition: I2cPort.h:41