Changeset 15 in flair-src for trunk/lib/FlairCore/src/Unix_I2cPort.h
- Timestamp:
- 04/08/16 15:40:57 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/Unix_I2cPort.h
r2 r15 16 16 #include <I2cPort.h> 17 17 18 namespace flair 19 { 20 namespace core 21 { 22 /*! \class Unix_I2cPort 23 * 24 * \brief Class for unix serial port 25 * 26 */ 27 class Unix_I2cPort: public I2cPort 28 { 18 namespace flair { 19 namespace core { 20 /*! \class Unix_I2cPort 21 * 22 * \brief Class for unix serial port 23 * 24 */ 25 class Unix_I2cPort : public I2cPort { 29 26 30 31 32 33 34 35 36 37 38 39 40 Unix_I2cPort(const Object* parent,std::string port_name,std::string device);27 public: 28 /*! 29 * \brief Constructor 30 * 31 * Construct an unix i2c port 32 * 33 * \param parent parent 34 * \param name name 35 * \param device serial device (ex /dev/i2c-1) 36 */ 37 Unix_I2cPort(const Object *parent, std::string port_name, std::string device); 41 38 42 43 44 45 46 39 /*! 40 * \brief Destructor 41 * 42 */ 43 ~Unix_I2cPort(); 47 44 48 49 50 51 52 53 54 55 45 /*! 46 * \brief Set slave's address 47 * 48 * This method need to be called before any communication. 49 * 50 * \param address slave's address 51 */ 52 int SetSlave(uint16_t address); 56 53 57 58 59 60 61 62 63 64 54 /*! 55 * \brief Set RX timeout 56 * 57 * Timeout for waiting datas. 58 * 59 * \param timeout_ns timeout in nano second 60 */ 61 void SetRxTimeout(Time timeout_ns); 65 62 66 67 68 69 70 71 72 73 63 /*! 64 * \brief Set TX timeout 65 * 66 * Timeout for waiting an ACK from the slave. 67 * 68 * \param timeout_ns timeout in nano second 69 */ 70 void SetTxTimeout(Time timeout_ns); 74 71 75 76 77 78 79 80 81 82 83 ssize_t Write(const void *buf,size_t nbyte);72 /*! 73 * \brief Write datas 74 * 75 * \param buf pointer to datas 76 * \param nbyte length of datas 77 * 78 * \return amount of written datas 79 */ 80 ssize_t Write(const void *buf, size_t nbyte); 84 81 85 86 87 88 89 90 91 92 93 ssize_t Read(void *buf,size_t nbyte);82 /*! 83 * \brief Read datas 84 * 85 * \param buf pointer to datas 86 * \param nbyte length of datas 87 * 88 * \return amount of read datas 89 */ 90 ssize_t Read(void *buf, size_t nbyte); 94 91 95 96 97 92 private: 93 int fd; 94 }; 98 95 } // end namespace core 99 96 } // end namespace flair
Note:
See TracChangeset
for help on using the changeset viewer.