mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-29 05:49:19 +00:00
74 lines
1.8 KiB
C
74 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):
|
|
|
|
*/
|
|
|
|
//-----------------------------------------------------------------------
|
|
// Includes
|
|
|
|
#ifndef _I2C_
|
|
#define _I2C_
|
|
|
|
#include <QTComponents.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_
|
|
|
|
//-----------------------------------------------------------------------
|