zc030x_i2c.h
来自「AVR单片机视频采集,主要是为了在自主导航的微型机器人里使用。 获取图像后」· C头文件 代码 · 共 79 行
H
79 行
#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 + =
减小字号Ctrl + -
显示快捷键?