mirror of
https://github.com/elliotnunn/sys7.1-doc-wip.git
synced 2024-12-13 11:29:15 +00:00
75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
/*
|
|
File: I2C.h
|
|
|
|
Contains: Header file for I2C component routines.
|
|
|
|
Written by: Gary Woodcock
|
|
|
|
Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
|
|
|
|
Change History (most recent first):
|
|
|
|
<1> 10/29/92 DH first checked in
|
|
*/
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Includes
|
|
|
|
#ifndef _I2C_
|
|
#define _I2C_
|
|
|
|
#include <QuickTimeComponents.h>
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Constants
|
|
|
|
// I2C component type
|
|
#define i2cComponentType 'i2c '
|
|
|
|
// I2C component interface version
|
|
enum
|
|
{
|
|
i2cComponentInterfaceVersion = 0x0002
|
|
};
|
|
|
|
// I2C component selectors
|
|
enum
|
|
{
|
|
kI2CReadSelect = 1,
|
|
kI2CWriteSelect,
|
|
kI2CReadWithSubAddrSelect,
|
|
kI2CWriteWithSubAddrSelect
|
|
};
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Types
|
|
|
|
typedef ComponentInstance I2CComponent;
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Prototypes
|
|
|
|
pascal ComponentResult
|
|
I2CRead (I2CComponent i2cInstance, unsigned short slaveAddr, short byteCount, void *dataBuf)
|
|
= ComponentCallNow (kI2CReadSelect, 0x08);
|
|
|
|
pascal ComponentResult
|
|
I2CWrite (I2CComponent i2cInstance, unsigned short slaveAddr, short byteCount, void *dataBuf)
|
|
= ComponentCallNow (kI2CWriteSelect, 0x08);
|
|
|
|
pascal ComponentResult
|
|
I2CReadWithSubAddr (I2CComponent i2cInstance, unsigned short slaveAddr,
|
|
unsigned short subAddr, short byteCount, void *dataBuf)
|
|
= ComponentCallNow (kI2CReadWithSubAddrSelect, 0x0A);
|
|
|
|
pascal ComponentResult
|
|
I2CWriteWithSubAddr (I2CComponent i2cInstance, unsigned short slaveAddr,
|
|
unsigned short subAddr, short byteCount, void *dataBuf)
|
|
= ComponentCallNow (kI2CWriteWithSubAddrSelect, 0x0A);
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
#endif _I2C_
|
|
|
|
//-----------------------------------------------------------------------
|