Changeset 15 in flair-src for trunk/lib/FlairCore/src/I2cPort.h


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/I2cPort.h

    r2 r15  
    1717#include <stdint.h>
    1818
    19 namespace flair
    20 {
    21 namespace core
    22 {
    23     /*! \class I2cPort
    24     *
    25     * \brief Base class for i2c port
    26     *
    27     * This class has a Mutex which must be used to protect access to the port in case
    28     * that more than one Thread is using it. Lock the Mutex before any communication (including SetSlave)
    29     * and release it after communication.
    30     */
    31     class I2cPort: public Mutex
    32     {
    33         public:
    34             /*!
    35             * \brief Constructor
    36             *
    37             * Construct an i2c port.
    38             *
    39             * \param parent parent
    40             * \param name name
    41             */
    42             I2cPort(const Object* parent,std::string name): Mutex(parent,name)
    43             {}
     19namespace flair {
     20namespace core {
     21/*! \class I2cPort
     22*
     23* \brief Base class for i2c port
     24*
     25* This class has a Mutex which must be used to protect access to the port in
     26*case
     27* that more than one Thread is using it. Lock the Mutex before any communication
     28*(including SetSlave)
     29* and release it after communication.
     30*/
     31class I2cPort : public Mutex {
     32public:
     33  /*!
     34  * \brief Constructor
     35  *
     36  * Construct an i2c port.
     37  *
     38  * \param parent parent
     39  * \param name name
     40  */
     41  I2cPort(const Object *parent, std::string name) : Mutex(parent, name) {}
    4442
    45             /*!
    46             * \brief Destructor
    47             *
    48             */
    49             ~I2cPort(){};
     43  /*!
     44  * \brief Destructor
     45  *
     46  */
     47  ~I2cPort(){};
    5048
    51             /*!
    52             * \brief Set slave's address
    53             *
    54             * This function need to be called before any communication.
    55             *
    56             * \param address slave's address
    57             */
    58             virtual int SetSlave(uint16_t address)=0;
     49  /*!
     50  * \brief Set slave's address
     51  *
     52  * This function need to be called before any communication.
     53  *
     54  * \param address slave's address
     55  */
     56  virtual int SetSlave(uint16_t address) = 0;
    5957
    60             /*!
    61             * \brief Write datas
    62             *
    63             * \param buf pointer to datas
    64             * \param nbyte length of datas
    65             *
    66             * \return amount of written datas
    67             */
    68             virtual ssize_t Write(const void *buf,size_t nbyte)=0;
     58  /*!
     59  * \brief Write datas
     60  *
     61  * \param buf pointer to datas
     62  * \param nbyte length of datas
     63  *
     64  * \return amount of written datas
     65  */
     66  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
    6967
    70             /*!
    71             * \brief Read datas
    72             *
    73             * \param buf pointer to datas
    74             * \param nbyte length of datas
    75             *
    76             * \return amount of read datas
    77             */
    78             virtual ssize_t Read(void *buf,size_t nbyte)=0;
     68  /*!
     69  * \brief Read datas
     70  *
     71  * \param buf pointer to datas
     72  * \param nbyte length of datas
     73  *
     74  * \return amount of read datas
     75  */
     76  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
    7977
    80             /*!
    81             * \brief Set RX timeout
    82             *
    83             * Timeout for waiting an ACK from the slave.
    84             *
    85             * \param timeout_ns timeout in nano second
    86             */
    87             virtual void SetRxTimeout(Time timeout_ns)=0;
     78  /*!
     79  * \brief Set RX timeout
     80  *
     81  * Timeout for waiting an ACK from the slave.
     82  *
     83  * \param timeout_ns timeout in nano second
     84  */
     85  virtual void SetRxTimeout(Time timeout_ns) = 0;
    8886
    89             /*!
    90             * \brief Set TX timeout
    91             *
    92             * Timeout for waiting an ACK from the slave.
    93             *
    94             * \param timeout_ns timeout in nano second
    95             */
    96             virtual void SetTxTimeout(Time timeout_ns)=0;
    97 
    98     };
     87  /*!
     88  * \brief Set TX timeout
     89  *
     90  * Timeout for waiting an ACK from the slave.
     91  *
     92  * \param timeout_ns timeout in nano second
     93  */
     94  virtual void SetTxTimeout(Time timeout_ns) = 0;
     95};
    9996} // end namespace core
    10097} // end namespace framework
Note: See TracChangeset for help on using the changeset viewer.