00001 /* -*-C++-*- 00002 ******************************************************************************* 00003 * 00004 * File: i2cio.h 00005 * Description: 00006 * 00007 ******************************************************************************* 00008 */ 00009 00010 /* 00011 * Copyright 2001 Free Software Foundation, Inc. 00012 * 00013 * This file is part of GNU Radio 00014 * 00015 * GNU Radio is free software; you can redistribute it and/or modify 00016 * it under the terms of the GNU General Public License as published by 00017 * the Free Software Foundation; either version 2, or (at your option) 00018 * any later version. 00019 * 00020 * GNU Radio is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with GNU Radio; see the file COPYING. If not, write to 00027 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00028 * Boston, MA 02111-1307, USA. 00029 */ 00030 00031 #ifndef _I2CIO_H_ 00032 #define _I2CIO_H_ 00033 00037 class i2cio { 00038 public: 00039 00040 i2cio () : 00041 udelay_scl_lo(0), udelay_scl_hi(0), 00042 udelay_sda_lo(0), udelay_sda_hi(0) {}; 00043 00044 virtual ~i2cio (); 00045 00046 virtual void set_scl (bool state) = 0; 00047 virtual void set_sda (bool state) = 0; 00048 virtual bool get_sda () = 0; 00049 00050 void set_udelay_scl_lo (int usecs) { udelay_scl_lo = usecs; } 00051 void set_udelay_scl_hi (int usecs) { udelay_scl_hi = usecs; } 00052 void set_udelay_sda_lo (int usecs) { udelay_sda_lo = usecs; } 00053 void set_udelay_sda_hi (int usecs) { udelay_sda_hi = usecs; } 00054 00055 int get_udelay_scl_lo () { return udelay_scl_lo; } 00056 int get_udelay_scl_hi () { return udelay_scl_hi; } 00057 int get_udelay_sda_lo () { return udelay_sda_lo; } 00058 int get_udelay_sda_hi () { return udelay_sda_hi; } 00059 00060 virtual void lock () = 0; 00061 virtual void unlock () = 0; 00062 00063 private: 00064 int udelay_scl_lo; 00065 int udelay_scl_hi; 00066 int udelay_sda_lo; 00067 int udelay_sda_hi; 00068 }; 00069 00070 00071 #endif /* _I2CIO_H_ */