📄 i2c_cam.h
字号:
/*
* ----------------------------------------------------------------------------
* Modification of the I2C Library by Joerg Wunsch for the I2c Bus of the
* Omnivision Camera to read and write in the correct adresses for this camera
* Added functuions:
*
* int read_register(int numResguiter)
* int write_register(int numregister, int value)
*
* By I馻ki Navarro Oiza
* March 2004
* ----------------------------------------------------------------------------
*/
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <joerg@FreeBSD.ORG> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
* ----------------------------------------------------------------------------
*/
/* $Id: twitest.c,v 1.1 2002/12/18 22:35:38 joerg_wunsch Exp $ */
/*
* Simple demo program that talks to a 24Cxx I睠 EEPROM using the
* builtin TWI interface of an ATmega device.
*/
/*
* ---------------------------------------------------------------------------
* The code modified and reorganized by Jaakko Ala-Paavola 2003/08/20
* jap@iki.fi
* ---------------------------------------------------------------------------
*/
#ifndef _EE24XX__
#define _EE24XX_
#include <avr/io.h>
#include <avr/twi.h>
#include <inttypes.h>
#ifndef UCSRB
# ifdef UCSR1A /* ATmega128 */
# define UCSRA UCSR1A
# define UCSRB UCSR1B
# define UBRR UBRR1L
# define UDR UDR1
# else /* ATmega8 */
# define UCSRA USR
# define UCSRB UCR
# endif
#endif
#ifndef UBRR
# define UBRR UBRRL
#endif
#define TWI_SLA_CAM 0xc0 //Cam C0 sensor 90
#define MAX_ITER 200
#define PAGE_SIZE 8 // before 8
void
i2c_init(int clk);
int
i2c_read_bytes(uint16_t eeaddr, int len, uint8_t *buf);
int
i2c_write_page(uint16_t eeaddr, int len, uint8_t *buf);
int
i2c_write_bytes(uint16_t eeaddr, int len, uint8_t *buf);
int
write_register(uint16_t numregister, uint8_t value);
int
read_register(uint16_t numregister);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -