kstmApp/src/drvAsynI2C.h
changeset 3 ec018606c207
equal deleted inserted replaced
2:3b3af1ff2783 3:ec018606c207
       
     1 //******************************************************************************
       
     2 // Copyright (C) 2015 Florian Feldbauer <florian@ep1.ruhr-uni-bochum.de>
       
     3 //                    - University Mainz, Institute for nucular physics
       
     4 //
       
     5 // This file is part of drvAsynI2C
       
     6 //
       
     7 // drvAsynI2C is free software; you can redistribute it and/or modify
       
     8 // it under the terms of the GNU General Public License as published by
       
     9 // the Free Software Foundation; either version 3 of the License, or
       
    10 // (at your option) any later version.
       
    11 //
       
    12 // drvAsynI2C is distributed in the hope that it will be useful,
       
    13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    15 // GNU General Public License for more details.
       
    16 //
       
    17 // You should have received a copy of the GNU General Public License
       
    18 // along with this program; if not, write to the Free Software
       
    19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
       
    20 //
       
    21 // version 1.0.0; Nov. 17, 2015
       
    22 //******************************************************************************
       
    23 
       
    24 #ifndef __ASYN_I2C_H__
       
    25 #define __ASYN_I2C_H__
       
    26 
       
    27 //_____ I N C L U D E S _______________________________________________________
       
    28 
       
    29 // ANSI C includes
       
    30 
       
    31 // EPICS includes
       
    32 //#include <epicsTimer.h>
       
    33 
       
    34 // local includes
       
    35 #include "asynPortDriver.h"
       
    36 
       
    37 //_____ D E F I N I T I O N S __________________________________________________
       
    38 
       
    39 //! @brief   asynPortDriver for I2C
       
    40 //!
       
    41 class drvAsynI2C : public asynPortDriver {
       
    42  public:
       
    43   drvAsynI2C( const char *portName, const char *ttyName );
       
    44 
       
    45   // These are the methods that we override from asynPortDriver
       
    46   virtual asynStatus readOctet( asynUser *pasynUser, char *value, size_t maxChars,
       
    47                                 size_t *nActual, int *eomReason );
       
    48   virtual asynStatus writeOctet( asynUser *pasynUser, char const *value, size_t maxChars,
       
    49                                  size_t *nActual );
       
    50 //  virtual asynStatus readOption( asynUser *pasynUser, char const *key, char *value, int maxChars );
       
    51 //  virtual asynStatus writeOption( asynUser *pasynUser, char const *key, char const *value );
       
    52 
       
    53   virtual asynStatus connect( asynUser *pasynUser );
       
    54   virtual asynStatus disconnect( asynUser *pasynUser );
       
    55 
       
    56   inline void timeout() { _timeout = true; }
       
    57 
       
    58  private:
       
    59 
       
    60   // Our data
       
    61   char* _deviceName;
       
    62   int   _fd;
       
    63   bool  _timeout;
       
    64   unsigned long  _i2cfuncs;
       
    65   int   _slaveAddress;
       
    66 //  epicsTimerId       _timer;
       
    67 //  epicsTimerQueueId  _timerQueue;
       
    68     
       
    69 };
       
    70 
       
    71 
       
    72 #endif
       
    73