Code covered by the BSD License  

Highlights from
Matlab LibTiePie 0.4.3 instrument driver for Handyscope HS5

Matlab LibTiePie 0.4.3 instrument driver for Handyscope HS5

by

 

03 Oct 2013 (Updated )

MatlabLibTiePie : TiePie engineering's instrument library for Matlab 7.6 = 2008a and higher.

LibTiePie.I2CHost
% Use LibTiePie.I2CHost for controlling LibTiePie I2C hosts (contained in oscilloscopes).
% Do not create LibTiePie.I2CHost objects directly, but use Library.List.OpenI2CHost().
%
% For more information, see api.tiepie.com and www.tiepie.com/LibTiePie .
%
% (c) 2012-2013 TiePie engineering.

classdef I2CHost < LibTiePie.Device
  properties
    Speed;
  end
  properties ( SetAccess = private )
    SpeedMax;
  end
  methods
    function obj = I2CHost( oLibTiePie , hDevice )
      obj = obj@LibTiePie.Device( oLibTiePie , hDevice );
    end
    function bIsInternalAddress = IsInternalAddress( self , wAddress )
      bIsInternalAddress = calllib( self.sLibrary , 'I2CIsInternalAddress' , self.hDevice , wAddress );
    end

    function [ bSucces , Buffer ] = Read( self , wAddress , Buffer , dwSize , bStop )
      if ( nargin < 5 )
        bStop = true;
      end
      [ bSucces , Buffer ] = calllib( self.sLibrary , 'I2CRead' , self.hDevice , wAddress , Buffer , dwSize , bStop )
    end
    function [ bSucces , byValue ] = ReadByte( self , wAddress )
      [ bSucces , byValue ] = calllib( self.sLibrary , 'I2CReadByte' , self.hDevice , wAddress , 0 );
    end
    function [ bSucces , wValue ] = ReadWord( self , wAddress )
      [ bSucces , wValue ] = calllib( self.sLibrary , 'I2CReadWord' , self.hDevice , wAddress , 0 );
    end

    function bSucces = Write( self , wAddress , pBuffer , dwSize , bStop )
      if ( nargin < 5 )
        bStop = true;
      end
      bSucces = calllib( self.sLibrary , 'I2CWrite' , self.hDevice , wAddress , pBuffer , dwSize , bStop );
    end
    function bSucces = WriteByte( self , wAddress , byValue )
      bSucces = calllib( self.sLibrary , 'I2CWriteByte' , self.hDevice , wAddress , byValue );
    end
    function bSucces = WriteByteByte( self , wAddress , byValue1 , byValue2 )
      bSucces = calllib( self.sLibrary , 'I2CWriteByteByte' , self.hDevice , wAddress , byValue1 , byValue2 );
    end
    function bSucces = WriteByteWord( self , wAddress , byValue1 , wValue2 )
      bSucces = calllib( self.sLibrary , 'I2CWriteByteWord' , self.hDevice , wAddress , byValue1 , wValue2 );
    end
    function bSucces = WriteWord( self , wAddress , wValue )
      bSucces = calllib( self.sLibrary , 'I2CWriteWord' , self.hDevice , wAddress , wValue );
    end
  end
  methods
    function dSpeed = get.Speed( self )
      dSpeed = calllib( self.sLibrary , 'I2CGetSpeed' , self.hDevice );
    end
    function set.Speed( self , dSpeed )
      calllib( self.sLibrary , 'I2CSetSpeed' , self.hDevice , dSpeed );
      self.oLibTiePie.CheckStatus;
    end
  end
  methods
    function dSpeedMax = get.SpeedMax( self )
      dSpeedMax = calllib( self.sLibrary , 'I2CGetSpeedMax' , self.hDevice );
    end
  end
end

Contact us