📄 zc030x_i2c.h
字号:
#ifndef h_Zc030x_I2C_h#define h_Zc030x_I2C_h/* This file implement the I2C communication functionnalities *//* This project is under GPL *//* - Driver file - Zc030x - Driver file - */ /* Copyright: Andrew Birkett Cyril Russo--------------------------------------------------------------*//* Include definitions */#include "zc030x_kerneldef.h"#include "zc030x.h"/* Declare I2C structures */#define I2C_InitSequenceSize 6typedef struct{ /* Transfer dir (1: Dev->host 0: host->Dev) */ __u16 Direction[I2C_InitSequenceSize]; /* Address of the register to access */ __u16 Address[I2C_InitSequenceSize]; /* Value to read/write */ __u16 Value[I2C_InitSequenceSize]; /* Expected return size */ __u16 ReturnSize[I2C_InitSequenceSize]; /* Expected return value */ __u16 ReturnValue[I2C_InitSequenceSize]; } I2CInitSequence;/* Declare I2C config */#define I2C_ConfigSize 255typedef struct { /* I2C addresses */ __u8 Addresses[I2C_ConfigSize]; /* I2C values */ __u8 Values[I2C_ConfigSize]; /* Length of this config */ __u16 Length;} SensorConfig;/* Define error codes */#define I2C_Error -1#define I2C_Warning 0#define I2C_OK 1 /* Declare I2C functions *//* Init I2C register access */int zc030x_i2c_init(struct usb_device *udev, const I2CInitSequence * pSequence);/* Try to read an I2C register */int zc030x_i2c_reg_read(struct usb_device *udev, __u16 addr, __u16 size);/* Try to write an I2C register */int zc030x_i2c_reg_write(struct usb_device *udev, __u16 addr, __u16 value);/* Try to detect where the I2C sensor is */int zc030x_i2c_detect(struct usb_device *udev, const I2CInitSequence * pSequence);/* Check a sensor signature */int zc030x_i2c_checksignature(struct usb_device *udev, const signature * pSignature);/* Get a simple register map */int zc030x_i2c_simple_registermap(struct usb_device *udev); /* Init I2C register access */int zc030x_i2c_start(struct usb_device *udev, const I2CInitSequence * pSequence, const __u8 addr);/* Write an I2C config */int zc030x_i2c_writeconfig(struct usb_device *udev, const SensorConfig * pConfig);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -