diff --git a/Motorized_Focus_Camera/C/Makefile b/Motorized_Focus_Camera/C/Makefile deleted file mode 100644 index 1d060b6..0000000 --- a/Motorized_Focus_Camera/C/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -Target = manualFocus -CXX = gcc -OLIB := lib -LIBS = -Wall -larducam_vcm -lpthread -ODIR = obj -SRC =$(wildcard *.c) -DIR =$(notdir $(SRC)) -OBJ = $(patsubst %.c, %.o, $(DIR)) -$(Target): $(OBJ) - $(CXX) $^ -o $@ $(CXXFLAGS) $(LIBS) -.PHONY:clean -clean: - rm -rf *.o - rm -rf $(Target) -.PHONY:install -install: - sudo install -m 644 $(OLIB)/libarducam_vcm.so /usr/lib/ - diff --git a/Motorized_Focus_Camera/C/README.md b/Motorized_Focus_Camera/C/README.md deleted file mode 100644 index 80cc6cd..0000000 --- a/Motorized_Focus_Camera/C/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Motorized_Focus_Camera -# Usage -```bash -cd RaspberryPi/Motorized_Focus_Camera/C -``` -```bash -make install -``` -```bash -make -``` -```bash -./manualFocus -``` - - - - - diff --git a/Motorized_Focus_Camera/C/arducam_vcm.h b/Motorized_Focus_Camera/C/arducam_vcm.h deleted file mode 100644 index 24b8fa8..0000000 --- a/Motorized_Focus_Camera/C/arducam_vcm.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _SCCB_BUS_H_ -#define _SCCB_BUS_H_ - -unsigned char vcm_write(unsigned int focus_val); -unsigned char vcm_init(void); -#endif /* _SCCB_BUS_H_ */ - -/******************* (C) COPYRIGHT 2015 WangBao *****END OF FILE****/ diff --git a/Motorized_Focus_Camera/C/lib/libarducam_vcm.so b/Motorized_Focus_Camera/C/lib/libarducam_vcm.so deleted file mode 100755 index 3b92e3b..0000000 Binary files a/Motorized_Focus_Camera/C/lib/libarducam_vcm.so and /dev/null differ diff --git a/Motorized_Focus_Camera/C/manualFocusPreview.c b/Motorized_Focus_Camera/C/manualFocusPreview.c deleted file mode 100644 index 1e4ba6b..0000000 --- a/Motorized_Focus_Camera/C/manualFocusPreview.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "arducam_vcm.h" -pthread_t manualFocusPthreadID; -unsigned char flag = 1; -int get_key_board_from_termios() -{ - int key_value; - struct termios new_config; - struct termios old_config; - - tcgetattr(0, &old_config); - new_config = old_config; - new_config.c_lflag &= ~(ICANON | ECHO); - tcsetattr(0, TCSANOW, &new_config); - key_value = getchar(); - tcsetattr(0, TCSANOW, &old_config); - return key_value; -} -void setFocus(int val){ - vcm_write(val); -} -void manualFocusThread(){ - int focusVal = 0; - printf("Please press up and down key\r\n"); - while(flag){ - - usleep(100); - int KeyVal = 0; - KeyVal = get_key_board_from_termios(); - if(KeyVal == 27){ - KeyVal = get_key_board_from_termios(); - if(KeyVal == 91){ - KeyVal = get_key_board_from_termios(); - switch (KeyVal) - { - case 65/* up */: - focusVal += 10; - if(focusVal >= 1024){ - focusVal = 1024; - } - setFocus(focusVal); - printf("UP\r\n"); - break; - case 66/* down */: - focusVal -= 10; - if(focusVal <= 0){ - focusVal = 0; - } - setFocus(focusVal); - printf("DOWN\r\n"); - break; - default: - break; - } - } - } - } -} - -int main( void ){ - int ret = 0; - vcm_init(); - ret = pthread_create(&manualFocusPthreadID, NULL, (void *)manualFocusThread,NULL); - - if(ret){ - printf("pthread create failed"); - return 1; - } - char* runCameraCmd = "raspistill -t 0"; - system(runCameraCmd); - flag = 0; - pthread_join(manualFocusPthreadID,NULL); -} - - - diff --git a/Motorized_Focus_Camera/README.md b/Motorized_Focus_Camera/README.md deleted file mode 100644 index 1915199..0000000 --- a/Motorized_Focus_Camera/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Motorized_Focus_Camera -## Preparation -## Demos Function - Arducam has release three demos Motorized_Focus_Camera_Preview.py, Motorized_Focus_Camera_Snapshot.py and Autofocus.py - - Before running this demo, you have to install Python Dependency libraries. - ```Bash - sudo apt-get install python-opencv - ``` -```bash -sudo chmod +x enable_i2c_vc.sh -``` -```bash -./enable_i2c_vc.sh -``` -Press Y to reboot - -```Bash -git clone https://github.com/ArduCAM/RaspberryPi.git -``` - -Then click 'y' to allow it reboot. -### Motorized_Focus_Camera_Preview.py - - This demo supports focusing in preview mode, You can see the focus visually - - Single focus by keyboard up and down - - Run this demo is very easy , just input the "sudo python Motorized_Focus_Camera_Preview.py" in the terminal. -### Autofocus.py - - This demo supports auto focusing in preview mode, You can see the focus visually - - Run the demo by inputing the "sudo python Autofocus.py" in the terminal. - -### Usage: - -## Python demo -```bash -cd RaspberryPi/Motorized_Focus_Camera/python/ -``` -```bash -python xxx.py -``` -## C demo - -```bash -cd RaspberryPi/Motorized_Focus_Camera/C/ -``` -```bash -make install -``` -```bash -make -``` -```bash -./manualFocus -``` diff --git a/Motorized_Focus_Camera/enable_i2c_vc.sh b/Motorized_Focus_Camera/enable_i2c_vc.sh deleted file mode 100644 index 022300c..0000000 --- a/Motorized_Focus_Camera/enable_i2c_vc.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# load i2c-dev moudle -sudo modprobe i2c-dev -# add dtparam=i2c_vc=on to /boot/config.txt -awk 'BEGIN{ count=0 } \ -{ \ - if($1 == "dtparam=i2c_vc=on"){ \ - count++; \ - } \ -}END{ \ - if(count <= 0){ \ - system("sudo sh -c '\''echo dtparam=i2c_vc=on >> /boot/config.txt'\''"); \ - } \ -}' /boot/config.txt - -echo "reboot now?(y/n):" -read USER_INPUT -case $USER_INPUT in -'y'|'Y') - echo "reboot" - sudo reboot -;; -*) - echo "cancel" -;; -esac - - diff --git a/Motorized_Focus_Camera/python/Autofocus.py b/Motorized_Focus_Camera/python/Autofocus.py deleted file mode 100644 index 017c34a..0000000 --- a/Motorized_Focus_Camera/python/Autofocus.py +++ /dev/null @@ -1,99 +0,0 @@ -import cv2 #sudo apt-get install python-opencv -import numpy as py -import os -import time -from ctypes import * -#load arducam shared object file -arducam_vcm= CDLL('./lib/libarducam_vcm.so') -try: - import picamera - from picamera.array import PiRGBArray -except: - sys.exit(0) - -def focusing(val): - arducam_vcm.vcm_write(val) - #print("focus value: {}".format(val)) - -def sobel(img): - img_gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) - img_sobel = cv2.Sobel(img_gray,cv2.CV_16U,1,1) - return cv2.mean(img_sobel)[0] - -def laplacian(img): - img_gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) - img_sobel = cv2.Laplacian(img_gray,cv2.CV_16U) - return cv2.mean(img_sobel)[0] - - -def calculation(camera): - rawCapture = PiRGBArray(camera) - camera.capture(rawCapture,format="bgr", use_video_port=True) - image = rawCapture.array - rawCapture.truncate(0) - return laplacian(image) - - -if __name__ == "__main__": - #vcm init - arducam_vcm.vcm_init() - #open camera - camera = picamera.PiCamera() - - #open camera preview - camera.start_preview() - #set camera resolution to 640x480(Small resolution for faster speeds.) - camera.resolution = (640, 480) - time.sleep(0.1) - camera.shutter_speed=30000 - print("Start focusing") - - max_index = 10 - max_value = 0.0 - last_value = 0.0 - dec_count = 0 - focal_distance = 10 - - - - - while True: - #Adjust focus - focusing(focal_distance) - #Take image and calculate image clarity - val = calculation(camera) - #Find the maximum image clarity - if val > max_value: - max_index = focal_distance - max_value = val - - #If the image clarity starts to decrease - if val < last_value: - dec_count += 1 - else: - dec_count = 0 - #Image clarity is reduced by six consecutive frames - if dec_count > 6: - break - last_value = val - - #Increase the focal distance - focal_distance += 15 - if focal_distance > 1000: - break - - #Adjust focus to the best - focusing(max_index) - time.sleep(1) - #set camera resolution to 2592x1944 - camera.resolution = (1920,1080) - #save image to file. - camera.capture("test.jpg") - print("max index = %d,max value = %lf" % (max_index,max_value)) - #while True: - # time.sleep(1) - - camera.stop_preview() - camera.close() - - diff --git a/Motorized_Focus_Camera/python/Motorized_Focus_Camera_Preview.py b/Motorized_Focus_Camera/python/Motorized_Focus_Camera_Preview.py deleted file mode 100644 index 6122e4f..0000000 --- a/Motorized_Focus_Camera/python/Motorized_Focus_Camera_Preview.py +++ /dev/null @@ -1,44 +0,0 @@ - -import os -import time -import sys -import thread -from ctypes import * -keyboard = CDLL('./lib/libarducam_keyboard.so') -arducam_vcm =CDLL('./lib/libarducam_vcm.so') -UP = 1 -DOWN = 2 -SAVE = 115 -focus_val = 512; -step = 10 -def run_camera(name): - os.system("raspistill -t 0") -if __name__ == "__main__": - thread.start_new_thread(run_camera, ("run_camera",)) - #vcm init - arducam_vcm.vcm_init() - # camera = picamera.PiCamera() - # camera.preview_fullscreen=False - # preview=camera.start_preview() - #set windows size - # preview.window=(0,0,800,600) - print("Please press up and down to adjust focus.") - while True: - keyVal = keyboard.processKeyEvent() - time.sleep(0.01) - if keyVal == UP: - print("UP") - focus_val = focus_val+step - if focus_val > 1023: - focus_val = 1023 - print(focus_val) - arducam_vcm.vcm_write(focus_val) - if keyVal == DOWN: - print("DOWN") - focus_val = focus_val-step - if focus_val < 0: - focus_val = 0 - print(focus_val) - arducam_vcm.vcm_write(focus_val) - - diff --git a/Motorized_Focus_Camera/python/lib/arducam_key_detect.c b/Motorized_Focus_Camera/python/lib/arducam_key_detect.c deleted file mode 100644 index 11965aa..0000000 --- a/Motorized_Focus_Camera/python/lib/arducam_key_detect.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include -int arducam_get_key() -{ - int key_value; - struct termios new_config; - struct termios old_config; - - tcgetattr(0, &old_config); - new_config = old_config; - new_config.c_lflag &= ~(ICANON | ECHO); - tcsetattr(0, TCSANOW, &new_config); - key_value = getchar(); - tcsetattr(0, TCSANOW, &old_config); - return key_value; -} -int processKeyEvent(void){ - int keyVal = 0; - keyVal = arducam_get_key(); - if(keyVal == 27){ - keyVal = arducam_get_key(); - if(keyVal == 91){ - keyVal = arducam_get_key(); - if(keyVal == 65){ - return 1; - } - if(keyVal == 66){ - return 2; - } - } - } - else{ - return keyVal; - } - -} -//test -int main(int argc, char** argv){ - int val = processKeyEvent(); - printf("val = %d\r\n",val); -} diff --git a/Motorized_Focus_Camera/python/lib/libarducam_keyboard.so b/Motorized_Focus_Camera/python/lib/libarducam_keyboard.so deleted file mode 100755 index 0f85ba3..0000000 Binary files a/Motorized_Focus_Camera/python/lib/libarducam_keyboard.so and /dev/null differ diff --git a/Motorized_Focus_Camera/python/lib/libarducam_vcm.so b/Motorized_Focus_Camera/python/lib/libarducam_vcm.so deleted file mode 100755 index 11d7428..0000000 Binary files a/Motorized_Focus_Camera/python/lib/libarducam_vcm.so and /dev/null differ diff --git a/Motorized_Focus_Camera/python/multi_cameras_auto_focus.py b/Motorized_Focus_Camera/python/multi_cameras_auto_focus.py deleted file mode 100644 index 748974c..0000000 --- a/Motorized_Focus_Camera/python/multi_cameras_auto_focus.py +++ /dev/null @@ -1,133 +0,0 @@ -import cv2 #sudo apt-get install python-opencv -import numpy as py -import os -import time -from ctypes import * -cameraNum = 2 -#load arducam shared object file -arducam_vcm= CDLL('./lib/libarducam_vcm.so') -try: - import picamera - from picamera.array import PiRGBArray -except: - sys.exit(0) - -def focusing(val): - arducam_vcm.vcm_write(val) - #print("focus value: {}".format(val)) - -def sobel(img): - img_gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) - img_sobel = cv2.Sobel(img_gray,cv2.CV_16U,1,1) - return cv2.mean(img_sobel)[0] - -def laplacian(img): - img_gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) - img_sobel = cv2.Laplacian(img_gray,cv2.CV_16U) - return cv2.mean(img_sobel)[0] - - -def calculation(camera): - rawCapture = PiRGBArray(camera) - camera.capture(rawCapture,format="bgr", use_video_port=True) - image = rawCapture.array - rawCapture.truncate(0) - return laplacian(image) - - -if __name__ == "__main__": - #vcm init - arducam_vcm.vcm_init() - #open camera - camera = picamera.PiCamera() - - #open camera preview - camera.start_preview() - #set camera resolution to 640x480(Small resolution for faster speeds.) - camera.resolution = (640, 480) - time.sleep(0.1) - print("Start focusing 1") - max_index = 10 - max_value = 0.0 - last_value = 0.0 - dec_count = 0 - focal_distance = 10 - #choose cmaera A - arducam_vcm.choose_channel(0) - while True: - #Adjust focus - focusing(focal_distance) - #Take image and calculate image clarity - val = calculation(camera) - #Find the maximum image clarity - if val > max_value: - max_index = focal_distance - max_value = val - #If the image clarity starts to decrease - if val < last_value: - dec_count += 1 - else: - dec_count = 0 - #Image clarity is reduced by six consecutive frames - if dec_count > 6: - break - last_value = val - #Increase the focal distance - focal_distance += 15 - if focal_distance > 1000: - break - #Adjust focus to the best - focusing(max_index) - time.sleep(1) - #set camera resolution to 2592x1944 - camera.resolution = (1920,1080) - #save image to file. - camera.capture("test.jpg") - print("max index = %d,max value = %lf" % (max_index,max_value)) - print("Start focusing 2") - max_index = 10 - max_value = 0.0 - last_value = 0.0 - dec_count = 0 - focal_distance = 10 - camera.resolution = (640, 480) - #choose cmaera A - arducam_vcm.choose_channel(1) - while True: - #Adjust focus - focusing(focal_distance) - #Take image and calculate image clarity - val = calculation(camera) - #Find the maximum image clarity - if val > max_value: - max_index = focal_distance - max_value = val - #If the image clarity starts to decrease - if val < last_value: - dec_count += 1 - else: - dec_count = 0 - #Image clarity is reduced by six consecutive frames - if dec_count > 6: - break - last_value = val - #Increase the focal distance - focal_distance += 15 - if focal_distance > 1000: - break - #Adjust focus to the best - focusing(max_index) - time.sleep(1) - #set camera resolution to 2592x1944 - camera.resolution = (1920,1080) - #save image to file. - camera.capture("test.jpg") - print("max index = %d,max value = %lf" % (max_index,max_value)) - - - #while True: - # time.sleep(1) - camera.stop_preview() - camera.close() - - diff --git a/Motorized_Focus_Camera/python/test.jpg b/Motorized_Focus_Camera/python/test.jpg deleted file mode 100644 index 54c33ce..0000000 Binary files a/Motorized_Focus_Camera/python/test.jpg and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/Makefile b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/Makefile deleted file mode 100644 index 20ae7b8..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CXX = g++ -CXXFLAGS = `pkg-config --cflags --libs opencv` #sudo apt-get install libopencv-dev -LIBS = -lwiringPi -ODIR = obj -_OBJ = pi_cam.o -OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) - -$(ODIR)/%.o: %.cpp - @mkdir -p $(@D) - $(CXX) -c -o $@ $< $(CXXFLAGS) - - -pi_zero_cam: $(OBJ) - $(CXX) $^ -o $@ $(CXXFLAGS) $(LIBS) - -.PHONY:clean - -clean: - rm -rf $(ODIR)/* diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/obj/pi_zero_cam.o b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/obj/pi_zero_cam.o deleted file mode 100644 index dc61c0f..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/obj/pi_zero_cam.o and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam deleted file mode 100644 index c82ea24..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam.cpp b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam.cpp deleted file mode 100644 index f1f0661..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/pi_cam.cpp +++ /dev/null @@ -1,332 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define RPI_FIRMWARE_DEV "/dev/vcio" -#define IOCTL_RPI_FIRMWARE_PROPERTY _IOWR(100, 0, char*) -#define RPI_FIRMWARE_STATUS_REQUEST 0 -#define RPI_FIRMWARE_STATUS_SUCCESS 0x80000000 -#define RPI_FIRMWARE_STATUS_ERROR 0x80000001 -#define RPI_FIRMWARE_PROPERTY_END 0 -#define RPI_FIRMWARE_SET_GPIO_STATE 0x00038041 - - -// define the support board version - -using namespace cv; -using namespace std; - -#define PI_ZERO 0 -#define PI_ZERO_W 1 -#define PI_3B_3B_PLUS 2 - - -int boardVersion = PI_ZERO_W; -typedef struct timeval TIME; -#define GPIO_NUM 3 -int digitalNum[GPIO_NUM]; -int status[GPIO_NUM]; -int lastStatus[GPIO_NUM]; -int write_virtual_gpio(int gpio,int value){ - int fd; - - fd = open(RPI_FIRMWARE_DEV, O_NONBLOCK); - if (fd == -1) { - //log_error("open firware dev fail.\n"); - return -1; - } - - uint32_t buf[] = { - 8 * sizeof(uint32_t), - RPI_FIRMWARE_STATUS_REQUEST, - RPI_FIRMWARE_SET_GPIO_STATE, - 2 * sizeof(int), - 0, - gpio, - value ? 1 : 0, - RPI_FIRMWARE_PROPERTY_END - }; - int ret = ioctl(fd, IOCTL_RPI_FIRMWARE_PROPERTY, buf); - if(ret == -1){ - //log_error("ioctl fail\n"); - return -1; - } - if(buf[1] != RPI_FIRMWARE_STATUS_SUCCESS){ - // log_error("NOT RPI_FIRMWARE_STATUS_SUCCESS\n"); - return -1; - } - return 0; -} - - -//Remove the header spack -char *rtrim(char *str) -{ - if (str == NULL || *str == '\0') - { - return str; - } - - int len = strlen(str); - char *p = str + len - 1; - while (p >= str && isspace(*p)) - { - *p = '\0'; - --p; - } - - return str; -} - -//Remove the end space -char *ltrim(char *str) -{ - if (str == NULL || *str == '\0') - { - return str; - } - - int len = 0; - char *p = str; - while (*p != '\0' && isspace(*p)) - { - ++p; - ++len; - } - - memmove(str, p, strlen(str) - len + 1); - - return str; -} - -//Remove the header and end space -char *trim(char *str) -{ - str = rtrim(str); - str = ltrim(str); - - return str; -} -int Judge_version(){ - FILE *fstream=NULL; - char buff[1024]; - memset(buff,0,sizeof(buff)); - if(NULL==(fstream=popen("cat /proc/cpuinfo | grep Revision | awk '{print substr($NF,length($NF)-5,6)}'","r"))) - { - // log_error("execute command failed: %s",strerror(errno)); - return -1; - } - if (NULL != fgets(buff, sizeof(buff), fstream)) - { - if(strlen(buff) <= 0) - return -1; - char *temp = trim(buff); - cout << temp<= 1){ - printf("fps %d\n",totalFrame); - totalFrame = 0; - begin_time = time(NULL); - } - // check if we succeeded - if (frame.empty()) - { - cerr << "ERROR! blank frame grabbed\n"; - break; - } - char name[20]; - sprintf(name,"%c",flag + 64); - putText(frame,name,Point(0,15),FONT_HERSHEY_SIMPLEX ,0.5,Scalar(0,0,0xFF),2); - mergeImage(surface,frame,flag - 1); - imshow("Arducam Multi-Camera DEMO",surface); - if ((signed char)(waitKey(1)) >= 0) - break; - - ++flag; - if(flag == 3){ - flag = 1; - } - - } - // the camera will be deinitialized automatically in VideoCapture destructor - return 0; -} diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/HardwareConnection.png b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/HardwareConnection.png deleted file mode 100644 index 4079c10..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/HardwareConnection.png and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/demo.png b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/demo.png deleted file mode 100644 index 2ea2155..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/demo.png and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/download_code.png b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/download_code.png deleted file mode 100644 index c19909e..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/download_code.png and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/shell_demo.png b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/shell_demo.png deleted file mode 100644 index a34874d..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/shell_demo.png and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/readme.md b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/readme.md deleted file mode 100644 index d582f12..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/readme.md +++ /dev/null @@ -1,62 +0,0 @@ -# Introudction -This multi-camera adapter board is designed for Raspberry pi ZERO and let your connect two 5MP cameras to Pi Zero. -Only one of the two cameras can be activated at a time, the are working in alternate ways. - -It can not run two cameras at the same time, but we build a simple software which can run two cameras and make it looks working as the same time. -But the drawback is the frame rate and resolution will be fairly low, may be useful for surveillance. - -Note that this version doesn't support 8MP Pi camera borad. And it also can be used for other Raspberry pi boards with minor software modifications. - -# Prerequisites -Because the camera switching is done through the camera led pin. -You have to disable the automatic management of camera led in `/boot/config.txt`. The following command help you disable the led control from the GPU firmware. -```bash -$ sudo sh -c 'echo "disable_camera_led=1" >> /boot/config.txt' -$ sudo reboot -``` -# Hardware Connection -Connect the multi-camera adapter board to Pi ZERO through 15-22pin flex cable. And connect two 5MP pi cameras to the Camera A and Camera B ports as the following photo shows. -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/HardwareConnection.png) -# Quickly start -## Download the Raspberrypi library -```bash -git clone https://github.com/ArduCAM/RaspberryPi.git -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/download_code.png) - -## Shell version - -This shell script demonstrates how to take two still images from two cameras in turn. -* Run the script -```bash -cd RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell - -sudo chmod +x pi_cam.sh - -sudo ./pi_cam.sh -``` -* Running Demo -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/shell_demo.png) - -## C++ version code - -This example demonstrates to run two cameras and make them looks at the same time - -* Install the opencv library -```Bash -sudo apt-get install libopencv-dev -``` -* Compile and run -```Bash -cd RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/c++/ - -sudo make -* For the use of remote control terminals, first specify the location of the image display -```Bash -export DISPLAY=:0 -``` - -sudo ./pi_cam -``` -* Runing Demo -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/demo.png) diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/pi_cam.sh b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/pi_cam.sh deleted file mode 100644 index ef6b4c9..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/pi_cam.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# Setup GPIO for Arducam Multi Adapter Board Pi zero -# Disable the camera_led -awk 'BEGIN{ count=0 } \ -{ \ - if($1 == "disable_camera_led=1"){ \ - count++; \ - } \ -}END{ \ - if(count <= 0){ \ - system("sudo sh -c '\''echo disable_camera_led=1 >> /boot/config.txt'\''"); \ - } \ -}' /boot/config.txt -rev=`cat /proc/cpuinfo | grep Revision | awk '{print substr($NF,length($NF)-5,6)}'` -#echo "Detected the board revsion: $rev" -case $rev in -'9000c1') -echo "The board is PiZero W." -gpio -g write 40 1 #set the gpio40 high -echo "Choose camera A" -raspistill -o camera1.jpg -gpio -g write 40 0 #set the gpio40 low -echo "Choose Camera B" -raspistill -o camera2.jpg -echo "Test OK" -;; -'a02082'|'a22082'|'a020d3') -echo "The board is Pi 3B/B+." -./rpi3-gpiovirtbuf s 134 1 #set the gpio134 high -echo "Choose camera A" -raspistill -o camera1.jpg -./rpi3-gpiovirtbuf s 134 0 #set the gpio134 low -echo "Choose Camera B" -raspistill -o camera2.jpg -echo "Test OK" -;; -'0010'|'0012'|'0013'|'1041'|'a01041'|'a21041'|'a02042'|'900093'|'920093') -echo "The board is PiZero." -gpio -g write 32 1 #set the gpio32 high -echo "Choose camera A" -raspistill -o camera1.jpg -gpio -g write 32 0 #set the gpio32 low -echo "Choose Camera B" -raspistill -o camera2.jpg -echo "Test OK" - -;; -*) -esac diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/rpi3-gpiovirtbuf b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/rpi3-gpiovirtbuf deleted file mode 100644 index 198b87b..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/shell/rpi3-gpiovirtbuf and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/Makefile b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/Makefile deleted file mode 100644 index 9b9d580..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CXX = g++ -CXXFLAGS = `pkg-config --cflags --libs opencv` #sudo apt-get install libopencv-dev -LIBS = -lwiringPi -ODIR = obj -_OBJ = arducam_multi_adapter_uc444.o -OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) - -$(ODIR)/%.o: %.cpp - @mkdir -p $(@D) - $(CXX) -c -o $@ $< $(CXXFLAGS) - - -arducam_multi_adapter_uc444: $(OBJ) - $(CXX) $^ -o $@ $(CXXFLAGS) $(LIBS) - -.PHONY:clean - -clean: - rm -rf $(ODIR)/* diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/arducam_multi_adapter_uc444.cpp b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/arducam_multi_adapter_uc444.cpp deleted file mode 100644 index b1567e6..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/arducam_multi_adapter_uc444.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// #include -// #include -// #include -#include -#include -#include -//#include -#include -#include -#include -#include -using namespace cv; -using namespace std; - -typedef struct timeval TIME; -#define GPIO_NUM 2 -int digitalNum[GPIO_NUM]; -int status[GPIO_NUM]; -int lastStatus[GPIO_NUM]; -void init(){ - digitalNum[0] = 7; - digitalNum[1] = 11; - wiringPiSetup() ; - for(int i = 0 ; i < GPIO_NUM ; ++i){ - pinMode (digitalNum[i], OUTPUT) ; - } -} -int width = 320; -int height = 240; -void mergeImage(Mat &dst,Mat &src,int index){ - int offset = 10; - int cols = width; - int rows = height; - - if(dst.empty()){ - dst.create(rows * 1 + offset * 3,cols * 2 + offset * 3,CV_8UC3); - dst.setTo(Scalar(0xE5,0xE5,0xE5)); - } - // resize(src, src, Size(cols, rows)); -#ifdef DEBUG_OUTPUT - cout << "dst Width: " << dst.cols << endl; - cout << "dst Height: " << dst.rows << endl; - cout << "src Width: " << src.cols << endl; - cout << "src Height: " << src.rows << endl; - cout << "index: " << index << endl; - printf("args: %d %d %d %d\n",(index % 2) * cols,(index / 2)*rows,width,height); -#endif - // src.copyTo(dst(Rect((index % 2) * cols + (index % 2) * offset, (index / 2) * rows + (index / 2) * offset, width, height))); - src.copyTo(dst(Rect((index % 2) * cols + (index % 2 + 1) * offset, (index / 2) * rows + (index / 2 + 1) * offset, width, height))); -} - -TIME currentTimeMillis(){ - struct timeval start; - gettimeofday( &start, NULL ); - return start; -} - -int brightness = 50; // min=0 max=100 step=1 -int contrast = 0; // min=-100 max=100 step=1 -int saturation = 0; // min=-100 max=100 step=1 -int _rotate = 0; // min=0 max=360 step=90 -int auto_exposure = 0; // min=0 max=3 -int exposure_time_absolute = 1000; // min = 1 max=10000 step=1 - -void sendCommand(){ - char command[100]; - sprintf(command,"v4l2-ctl -d 0 -c brightness=%d",brightness); - system(command); - - sprintf(command,"v4l2-ctl -d 0 -c contrast=%d",contrast); - system(command); - - sprintf(command,"v4l2-ctl -d 0 -c saturation=%d",saturation); - system(command); - - sprintf(command,"v4l2-ctl -d 0 -c rotate=%d",_rotate); - system(command); - - sprintf(command,"v4l2-ctl -d 0 -c auto_exposure=%d",auto_exposure); - system(command); - - sprintf(command,"v4l2-ctl -d 0 -c exposure_time_absolute=%d",exposure_time_absolute); - system(command); -} -int initCamera(VideoCapture &cap){ - if(access("/dev/video0",0)){ - printf("Please check your camera connection,then try again.\n"); - exit(0); - } - char *i2c = "i2cset -y 1 0x70 0x00 0x01"; - system(i2c); - digitalWrite(7,0); - digitalWrite(11,0); - - // open the default camera using default API - cap.open(0); - // OR advance usage: select any API backend - int deviceID = 0; // 0 = open default camera - int apiID = 0; - // int apiID = cv::CAP_ANY; // 0 = autodetect default API - // open selected camera using selected API - cap.open(deviceID + apiID); - // check if we succeeded - if (!cap.isOpened()) - { - cerr << "ERROR! Unable to open camera\n"; - return -1; - } - sendCommand(); - cap.grab(); - i2c = "i2cset -y 1 0x70 0x00 0x02"; - system(i2c); - digitalWrite(7,1); - digitalWrite(11,0); - sendCommand(); - cap.grab(); - sleep(1); -} - -int main(int, char **) -{ - Mat surface; - init(); - Mat frame; - //--- INITIALIZE VIDEOCAPTURE - VideoCapture cap; - initCamera(cap); - - cap.set(CV_CAP_PROP_FRAME_WIDTH,320); - cap.set(CV_CAP_PROP_FRAME_HEIGHT,240); - // cap.set(CV_CAP_PROP_FPS,30); - //--- GRAB AND WRITE LOOP - cout << "Start grabbing" << endl - << "Press any key to terminate" << endl; - - long begin_time = time(NULL); - int totalFrame = 0; - int flag = 2; - for (;;) - { - // wait for a new frame from camera and store it into 'frame' - cap.grab(); - cap.read(frame); - TIME start,end; - clock_t s1,e1; - - switch(flag){ - case 1: //camera b - digitalWrite(7,1) ; - break; - case 2: //camera a - digitalWrite(7,0) ; - break; - } - - ++totalFrame; - if(time(NULL) - begin_time >= 1){ - printf("fps %d\n",totalFrame); - totalFrame = 0; - begin_time = time(NULL); - } - // check if we succeeded - if (frame.empty()) - { - cerr << "ERROR! blank frame grabbed\n"; - break; - } - char name[20]; - sprintf(name,"%c",flag + 64); - putText(frame,name,Point(0,15),FONT_HERSHEY_SIMPLEX ,0.5,Scalar(0,0,0xFF),2); - mergeImage(surface,frame,flag - 1); - imshow("Arducam Multi-Camera DEMO",surface); - if ((signed char)(waitKey(1)) >= 0) - break; - - ++flag; - if(flag == 3){ - flag = 1; - } - - } - // the camera will be deinitialized automatically in VideoCapture destructor - return 0; -} diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/readme.md b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/readme.md deleted file mode 100644 index 5e72f9b..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/readme.md +++ /dev/null @@ -1,93 +0,0 @@ -## Introudction -This multi-camera adapter board is designed for Raspberry pi ZERO and let your connect two 8MP cameras to Pi Zero. -Only one of the two cameras can be activated at a time, the are working in alternate ways. -It can not run two cameras at the same time, but we build a simple software which can run two cameras and make it looks working as the same time. -But the drawback is the frame rate and resolution will be fairly low, may be useful for surveillance. -## Prerequisites. -Before using this board, you should enable the i2c1 firstly. -![hardware](../../data/cfg_i2c1_1.png) -![hardware](../../data/cfg_i2c1_2.png) -## Hardware pin definition - -| Pi Zero| Adapter Board | -| :--- | :---: | -| SDA1 | SDA | -| SCL1 | SCL | -| 7 | SEL | -| 11 | OE | -| 3.3V | 3V3 | -| GND | GND | -- User should choose the channel through the i2c bus. -* Choose the cameraA -```Bash - sudo i2cset -y 1 0x70 0x00 0x01 -``` -* CHoose the cameraB -```Bash - sudo i2cset -y 1 0x70 0x00 0x02 -``` -- User should set the 11 (OE signal) to low to enabe the mipi data output. -- User should set the 7 (SEL) high and low to choose cut the cameraA and cameraB - -## Hardware Connection -![hardware](../../data/uc444_0.jpg) -![hardware](../../data/uc444_1.jpg) - -## Quickly start -- Download the Raspberrypi library -```bash -git clone https://github.com/ArduCAM/RaspberryPi.git -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel/data/download_code.png) -- This example demonstrates to run two cameras and make them looks at the same time -## Add support for Pi4 B -- Just a quick post to let you know that you’ll need a new wiringPi for the Raspberry Pi 4B. -- To upgrade: -```bash -cd /tmp -``` -```bash -wget https://project-downloads.drogon.net/wiringpi-latest.deb -``` -```bash -sudo dpkg -i wiringpi-latest.deb -``` -### Shell version -- This shell script demonstrates how to take two still images from two cameras in turn. Each camera will preview for 5 seconds -- take a photo saved to the local file system. Users can directly see the tested pictures. -- Run the script -```bash -cd RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/shell -``` -```bash -sudo chmod +x pi_cam_uc444.sh -``` -```bash -sudo ./pi_cam_uc444.sh -``` - -### C++ version -* Install the opencv library -```Bash -sudo apt-get install libopencv-dev -``` -* Compile and run -```Bash -cd RaspberryPi/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 -``` -```Bash -make -``` -* For the use of remote control terminals, first specify the location of the image display -```Bash -export DISPLAY=:0 -``` -```Bash -sudo ./arducam_multi_adapter_uc444 -``` -* For users who directly operate locally -```Bash -sudo ./arducam_multi_adapter_uc444 -``` - -![test](../../data/demo.png) diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/shell/pi_cam_uc444.sh b/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/shell/pi_cam_uc444.sh deleted file mode 100644 index d253842..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444/shell/pi_cam_uc444.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -i2cset -y 1 0x70 0x00 0x01 -gpio -g mode 17 out -gpio -g mode 4 out -gpio -g write 17 0 #set the gpio17 low -gpio -g write 4 0 #set the gpio4 low -echo "Choose camera A" -raspistill -o camera1.jpg -i2cset -y 1 0x70 0x00 0x02 -gpio -g write 4 1 #set the gpio4 high -echo "Choose Camera B" -raspistill -o camera2.jpg -echo "Test OK" diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/AdapterTestDemo.py b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/AdapterTestDemo.py deleted file mode 100644 index 335f098..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/AdapterTestDemo.py +++ /dev/null @@ -1,62 +0,0 @@ -import RPi.GPIO as gp -import os - -gp.setwarnings(False) -gp.setmode(gp.BOARD) - -gp.setup(7, gp.OUT) -gp.setup(11, gp.OUT) -gp.setup(12, gp.OUT) - -gp.setup(15, gp.OUT) -gp.setup(16, gp.OUT) -gp.setup(21, gp.OUT) -gp.setup(22, gp.OUT) - -gp.output(11, True) -gp.output(12, True) -gp.output(15, True) -gp.output(16, True) -gp.output(21, True) -gp.output(22, True) - -def main(): - print"Start testing the camera A" - i2c = "i2cset -y 1 0x70 0x00 0x04" - os.system(i2c) - gp.output(7, False) - gp.output(11, False) - gp.output(12, True) - capture(1) - print"Start testing the camera B" - i2c = "i2cset -y 1 0x70 0x00 0x05" - os.system(i2c) - gp.output(7, True) - gp.output(11, False) - gp.output(12, True) - capture(2) - print"Start testing the camera C" - i2c = "i2cset -y 1 0x70 0x00 0x06" - os.system(i2c) - gp.output(7, False) - gp.output(11, True) - gp.output(12, False) - capture(3) - print"Start testing the camera D" - i2c = "i2cset -y 1 0x70 0x00 0x07" - os.system(i2c) - gp.output(7, True) - gp.output(11, True) - gp.output(12, False) - capture(4) - -def capture(cam): - cmd = "raspistill -o capture_%d.jpg" % cam - os.system(cmd) - -if __name__ == "__main__": - main() - - gp.output(7, False) - gp.output(11, False) - gp.output(12, True) diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/Makefile b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/Makefile deleted file mode 100644 index add40f4..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CXX = g++ -CXXFLAGS = `pkg-config --cflags --libs opencv` #sudo apt-get install libopencv-dev -LIBS = -lwiringPi -ODIR = obj -_OBJ = mutiCamOpenCV.o -OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) - -$(ODIR)/%.o: %.cpp - @mkdir -p $(@D) - $(CXX) -c -o $@ $< $(CXXFLAGS) - - -previewOpencv: $(OBJ) - $(CXX) $^ -o $@ $(CXXFLAGS) $(LIBS) - -.PHONY:clean - -clean: - rm -rf $(ODIR)/* diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/init_camera.sh b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/init_camera.sh deleted file mode 100755 index 7dc8be3..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/init_camera.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -echo "----Test i2c1" -i2cdetect -y 1 -i2cset -y 1 0x70 0x00 0x04 -echo "----Detecting the /dev/video0 device" -if [ -c "/dev/video0" ]; then -echo "video0 detected!" -echo "---Start testing each camera" -echo "if all of them are normal, after it finished,you will see four image in the current path." -sleep 2 -sudo python AdapterTestDemo.py -else -echo "Can't find video0 device, please check the hardware connection! " -fi diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/mutiCamOpenCV.cpp b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/mutiCamOpenCV.cpp deleted file mode 100644 index 2eb6129..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_C++/mutiCamOpenCV.cpp +++ /dev/null @@ -1,318 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace cv; -using namespace std; - -typedef signed char int8_t; -typedef unsigned char uint8_t; - -typedef signed short int16_t; -typedef unsigned short uint16_t; - -typedef struct timeval TIME; -typedef struct{ - int device_handle; - uint16_t chip_address; - uint16_t register_address; - uint16_t register_value; -}I2C_RW_STATE; - -typedef struct{ - int slave_id; - uint16_t sensor_id_addr; - uint16_t sensor_id_val; - char* sensor_name; -}SENSOR_TYPE; -typedef struct{ - int gpio; - int value; -}GPIO_TYPE; -typedef struct{ - bool camera_exist; - char channel_id; - char *camera_id; - char *i2c_command; - GPIO_TYPE gpios[3]; -}MULTI_ADAPTER_T; - -I2C_RW_STATE i2c_state; - -MULTI_ADAPTER_T arducam_adapter_board[]={ - { - .channel_id = 0, - .camera_id = "A", - .i2c_command = "i2cset -y 1 0x70 0x00 0x04", - .gpios = { - { .gpio = 7, - .value = 0, - }, - { .gpio = 0, - .value = 0, - }, - { .gpio = 1, - .value = 1, - } - } - }, - { - .channel_id = 1, - .camera_id = "B", - .i2c_command = "i2cset -y 1 0x70 0x00 0x05", - .gpios = { - { .gpio = 7, - .value = 1, - }, - { .gpio = 0, - .value = 0, - }, - { .gpio = 1, - .value = 1, - } - } - }, - { - .channel_id = 2, - .camera_id = "C", - .i2c_command = "i2cset -y 1 0x70 0x00 0x06", - .gpios = { - { .gpio = 7, - .value = 0, - }, - { .gpio = 0, - .value = 1, - }, - { .gpio = 1, - .value = 0, - } - } - }, - { - .channel_id = 3, - .camera_id = "D", - .i2c_command = "i2cset -y 1 0x70 0x00 0x07", - .gpios = { - { .gpio = 7, - .value = 1, - }, - { .gpio = 0, - .value = 1, - }, - { .gpio = 1, - .value = 0, - } - } - }, -}; - -const SENSOR_TYPE arducam_sensor_list[] = { - { .slave_id = 0x10, - .sensor_id_addr = 0x0000, - .sensor_id_val = 0x0219, - .sensor_name ="imx219" - }, - { - .slave_id = 0x36, - .sensor_id_addr = 0x300A, - .sensor_id_val = 0x5647, - .sensor_name ="ov5647" - }, - { - .slave_id = 0x1A, - .sensor_id_addr = 0x0016, - .sensor_id_val = 0x0477, - .sensor_name ="imx477" - } -}; - -int i2c_read_reg(I2C_RW_STATE *state) -{ - uint16_t val = 0; - int err; - uint8_t buf[2]; - uint8_t data[1]; - if (ioctl(state->device_handle, I2C_SLAVE_FORCE, state->chip_address) < 0) - { - printf("Failed to set I2C address\n"); - return -1; - } - buf[0] = state->register_address >> 8; - buf[1] = state->register_address; - struct i2c_rdwr_ioctl_data msgset; - struct i2c_msg msgs[2] = { - { - .addr = state->chip_address, - .flags = 0, - .len = 2, - .buf = buf, - }, - { - .addr = state->chip_address, - .flags = I2C_M_RD, - .len = 1, - .buf = data, - }, - }; - msgset.msgs = msgs; - msgset.nmsgs = 2; - err = ioctl(state->device_handle, I2C_RDWR, &msgset); - if (err != (int)msgset.nmsgs){ - return -1; - } - state->register_value = data[0]; - return 0; -} - -int camera_detect(){ - int i = 0; - uint16_t sensorID = 0; - for(i = 0; i< sizeof(arducam_sensor_list)/sizeof(arducam_sensor_list[0]); i++){ - sensorID = 0; - i2c_state.chip_address =arducam_sensor_list[i]. slave_id; - i2c_state.register_address =arducam_sensor_list[i].sensor_id_addr; //read hight id - i2c_read_reg(&i2c_state); sensorID = i2c_state.register_value; - i2c_state.register_address =arducam_sensor_list[i].sensor_id_addr+1; //read low id - i2c_read_reg(&i2c_state); sensorID = sensorID<<8 | i2c_state.register_value; - if(sensorID == arducam_sensor_list[i].sensor_id_val){ - return sensorID; - } - } - return 0; -} - -void initGPIO(){ - wiringPiSetup() ; - for(int i = 0 ; i < sizeof(arducam_adapter_board[0].gpios)/sizeof(arducam_adapter_board[0].gpios[0]) ; i++){ - pinMode (arducam_adapter_board[0].gpios[i].gpio, OUTPUT); - } -} -int init_camera(VideoCapture &cap){ - int access(const char *filename, int mode); - char *i2c; - int ret = 0; - system("sudo modprobe bcm2835_v4l2"); - if(access("/dev/video0",0)){ - printf("Please check your camera connection,then try again.\r\n"); - exit(0); - } - sleep(0.1); - for(char ch_id = 0; ch_id < sizeof(arducam_adapter_board)/sizeof(arducam_adapter_board[0]);ch_id++){ - i2c = arducam_adapter_board[ch_id].i2c_command; - system(i2c); - for(int i = 0; i< sizeof(arducam_adapter_board[ch_id].gpios)/sizeof(arducam_adapter_board[ch_id].gpios[0]);i++ ){ - digitalWrite(arducam_adapter_board[ch_id].gpios[i].gpio,arducam_adapter_board[ch_id].gpios[i].value); - } - if(camera_detect()){ - printf("Detected camera on channal:%s\r\n",arducam_adapter_board[ch_id].camera_id); - cap.open(0); - if (!cap.isOpened()) - { - printf("ERROR! Unable to open camera\r\n") ; - return -1; - } - - cap.set(CV_CAP_PROP_FRAME_WIDTH,320); - cap.set(CV_CAP_PROP_FRAME_HEIGHT,240); - cap.grab(); - system("v4l2-ctl -c exposure_time_absolute=500"); - arducam_adapter_board[ch_id].camera_exist = 1; - ret ++; - sleep(1); - - } else{ - arducam_adapter_board[ch_id].camera_exist = 0; - printf("Camera is missing on channal:%s\r\n",arducam_adapter_board[ch_id].camera_id); - } - - } - printf("Start preview...\r\n"); - return ret; -} - -void choose_channal(int ch_id){ - for(int i = 0; i< sizeof(arducam_adapter_board[ch_id].gpios)/sizeof(arducam_adapter_board[ch_id].gpios[0]); i++ ){ - digitalWrite(arducam_adapter_board[ch_id].gpios[i].gpio,arducam_adapter_board[ch_id].gpios[i].value); - } -} -int width = 320; -int height = 240; -void mergeImage(Mat &dst,Mat &src,int index){ - int offset = 10; - int cols = width; - int rows = height; - if(dst.empty()){ - dst.create(rows * 2 + offset * 3,cols * 2 + offset * 3,CV_8UC3); - dst.setTo(Scalar(0xE5,0xE5,0xE5)); - // #6495ED - } - src.copyTo(dst(Rect((index % 2) * cols + (index % 2 + 1) * offset, (index / 2) * rows + (index / 2 + 1) * offset, width, height))); -} - -TIME currentTimeMillis(){ - struct timeval start; - gettimeofday( &start, NULL ); - return start; -} -int main(int, char **) -{ - Mat surface; - Mat frame; - VideoCapture cap; - - int fd = open ("/dev/i2c-1",O_RDWR); - if(!fd){ - printf("Couldn't open i2c device, please enable the i2c1 firstly\r\n"); - return -1; - } - i2c_state.device_handle = fd; - initGPIO(); - if(init_camera(cap) == 0){ - printf("Can't find any canera\r\n"); - exit(0); - } - long begin_time = time(NULL); - int totalFrame = 0; - int flag = 0; - - for (;;) - { - // wait for a new frame from camera and store it into 'frame' - if(arducam_adapter_board[flag].camera_exist){ - choose_channal(flag); - cap.grab(); - cap.grab(); - cap.read(frame); - TIME start,end; - clock_t s1,e1; - ++totalFrame; - if(time(NULL) - begin_time >= 1){ - printf("fps %d\n",totalFrame); - totalFrame = 0; - begin_time = time(NULL); - } - if (frame.empty()) - { - cerr << "ERROR! blank frame grabbed\n"; - break; - } - char name[20]; - sprintf(name,"%c",flag+1 + 64); - putText(frame,name,Point(0,15),FONT_HERSHEY_SIMPLEX ,0.5,Scalar(0,0,0xFF),2); - mergeImage(surface,frame,flag); - imshow("Arducam Multi-Camera DEMO",surface); - if (waitKey(1) < 0) - break; - } - flag = (1+flag)%4; - - } - return 0; -} diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/.vscode/settings.json b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/.vscode/settings.json deleted file mode 100644 index fba6e43..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "D:\\python\\python.exe" -} \ No newline at end of file diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterBoard.py b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterBoard.py deleted file mode 100644 index 4cd9706..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterBoard.py +++ /dev/null @@ -1,107 +0,0 @@ -import RPi.GPIO as gp -import os -import cv2 as cv -import numpy as np -import time -class MultiAdapter: - adapter_info = { "A":{ "i2c_cmd":"i2cset -y 0 0x70 0x00 0x04", - "gpio_sta":[0,0,1], - }, - "B":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x05", - "gpio_sta":[1,0,1], - }, - "C":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x06", - "gpio_sta":[0,1,0], - }, - "D":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x07", - "gpio_sta":[1,1,0], - }, - } - camera = cv.VideoCapture(0) - width = 320 - height = 240 - def __init__(self): - gp.setwarnings(False) - gp.setmode(gp.BOARD) - gp.setup(7, gp.OUT) - gp.setup(11,gp.OUT) - gp.setup(12,gp.OUT) - - def choose_channel(self,index): - channel_info = self.adapter_info.get(index) - if channel_info == None: - print("Can't get this info") - os.system(channel_info["i2c_cmd"]) # i2c write - gpio_sta = channel_info["gpio_sta"] # gpio write - gp.output(7, gpio_sta[0]) - gp.output(11, gpio_sta[1]) - gp.output(12, gpio_sta[2]) - def select_channel(self,index): - channel_info = self.adapter_info.get(index) - if channel_info == None: - print("Can't get this info") - gpio_sta = channel_info["gpio_sta"] # gpio write - gp.output(7, gpio_sta[0]) - gp.output(11, gpio_sta[1]) - gp.output(12, gpio_sta[2]) - - def init(self,width,height): - for i in range(4): - self.height = height - self.width = width - self.choose_channel(chr(65+i)) - self.camera.set(3, self.width) - self.camera.set(4, self.height) - ret, frame = self.camera.read() - if ret == True: - print("camera %s init OK" %(chr(65+i))) - pname = "image_"+ chr(65+i)+".jpg" - cv.imwrite(pname,frame) - time.sleep(1) - def preview(self): - font = cv.FONT_HERSHEY_PLAIN - fontScale = 1 - fontColor = (255,255,255) - lineType = 1 - factor = 20 - black = np.zeros(((self.height+factor)*2, self.width*2, 3), dtype= np.uint8) - i = 0 - while True: - self.select_channel(chr(65+i)) - ret, frame = self.camera.read() - ret, frame = self.camera.read() - ret, frame = self.camera.read() - frame.dtype=np.uint8 - if i == 0: - black[factor:factor+self.height, 0:self.width, :] = frame - bottomLeftCornerOfText = (factor,factor) - index = chr(65+i) - elif i == 1: - black[factor:factor+self.height, self.width:self.width*2,:] = frame - bottomLeftCornerOfText = (factor+self.width, factor) - index = chr(65+i) - elif i == 2: - black[factor*2+self.height:factor*2+self.height*2, 0:self.width,:] = frame - bottomLeftCornerOfText = (factor, factor*2+self.height) - index = chr(65+i) - elif i == 3: - black[factor*2+self.height:factor*2+self.height*2, self.width:self.width*2,:] = frame - bottomLeftCornerOfText = (factor+self.width, factor*2+self.height) - index = chr(65+i) - i = i+1 - if i==4: - i = 0 - cv.putText(black,'CAM '+index, bottomLeftCornerOfText, font, fontScale,fontColor,lineType) - cv.imshow("Arducam Multi Camera Demo",black) - if cv.waitKey(1) & 0xFF == ord('q'): - del frame - self.camera.release() - cv.destroyAllWindows() - break - - - - diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterTestDemo.py b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterTestDemo.py deleted file mode 100644 index 335f098..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/AdapterTestDemo.py +++ /dev/null @@ -1,62 +0,0 @@ -import RPi.GPIO as gp -import os - -gp.setwarnings(False) -gp.setmode(gp.BOARD) - -gp.setup(7, gp.OUT) -gp.setup(11, gp.OUT) -gp.setup(12, gp.OUT) - -gp.setup(15, gp.OUT) -gp.setup(16, gp.OUT) -gp.setup(21, gp.OUT) -gp.setup(22, gp.OUT) - -gp.output(11, True) -gp.output(12, True) -gp.output(15, True) -gp.output(16, True) -gp.output(21, True) -gp.output(22, True) - -def main(): - print"Start testing the camera A" - i2c = "i2cset -y 1 0x70 0x00 0x04" - os.system(i2c) - gp.output(7, False) - gp.output(11, False) - gp.output(12, True) - capture(1) - print"Start testing the camera B" - i2c = "i2cset -y 1 0x70 0x00 0x05" - os.system(i2c) - gp.output(7, True) - gp.output(11, False) - gp.output(12, True) - capture(2) - print"Start testing the camera C" - i2c = "i2cset -y 1 0x70 0x00 0x06" - os.system(i2c) - gp.output(7, False) - gp.output(11, True) - gp.output(12, False) - capture(3) - print"Start testing the camera D" - i2c = "i2cset -y 1 0x70 0x00 0x07" - os.system(i2c) - gp.output(7, True) - gp.output(11, True) - gp.output(12, False) - capture(4) - -def capture(cam): - cmd = "raspistill -o capture_%d.jpg" % cam - os.system(cmd) - -if __name__ == "__main__": - main() - - gp.output(7, False) - gp.output(11, False) - gp.output(12, True) diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-36.pyc b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-36.pyc deleted file mode 100644 index f0f3e55..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-36.pyc and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-37.pyc b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-37.pyc deleted file mode 100644 index b04c1f7..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-37.pyc and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-38.pyc b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-38.pyc deleted file mode 100644 index 1d061a3..0000000 Binary files a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/__pycache__/AdapterBoard.cpython-38.pyc and /dev/null differ diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/init_camera.sh b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/init_camera.sh deleted file mode 100644 index 7dc8be3..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/init_camera.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -echo "----Test i2c1" -i2cdetect -y 1 -i2cset -y 1 0x70 0x00 0x04 -echo "----Detecting the /dev/video0 device" -if [ -c "/dev/video0" ]; then -echo "video0 detected!" -echo "---Start testing each camera" -echo "if all of them are normal, after it finished,you will see four image in the current path." -sleep 2 -sudo python AdapterTestDemo.py -else -echo "Can't find video0 device, please check the hardware connection! " -fi diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/previewOpencv.py b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/previewOpencv.py deleted file mode 100644 index 83e1c0b..0000000 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.1_python/previewOpencv.py +++ /dev/null @@ -1,10 +0,0 @@ -import AdapterBoard -import cv2 as cv -import numpy as np - -Arducam_adapter_board = AdapterBoard.MultiAdapter() -if __name__ == "__main__": - Arducam_adapter_board.init(320,240) - Arducam_adapter_board.preview() - - \ No newline at end of file diff --git a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterBoard.py b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterBoard.py index 0a7caaa..a5b7376 100644 --- a/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterBoard.py +++ b/Multi_Camera_Adapter/Multi_Adapter_Board_4Channel/Multi_Camera_Adapter_V2.2_python/AdapterBoard.py @@ -5,19 +5,19 @@ import time class MultiAdapter: camNum = 4 - adapter_info = { "A":{ "i2c_cmd":"i2cset -y 0 0x70 0x00 0x04", + adapter_info = { "A":{ "i2c_cmd":"i2cset -y 1 0x70 0x00 0x04", "gpio_sta":[0,0,1], }, "B":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x05", + "i2c_cmd":"i2cset -y 1 0x70 0x00 0x05", "gpio_sta":[1,0,1], }, "C":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x06", + "i2c_cmd":"i2cset -y 1 0x70 0x00 0x06", "gpio_sta":[0,1,0], }, "D":{ - "i2c_cmd":"i2cset -y 0 0x70 0x00 0x07", + "i2c_cmd":"i2cset -y 1 0x70 0x00 0x07", "gpio_sta":[1,1,0], }, } diff --git a/Multi_Camera_Adapter_SPI_Camera/README.md b/Multi_Camera_Adapter_SPI_Camera/README.md deleted file mode 100644 index 4c8fb50..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# RaspberryPi -## Arducam releases new Arducam Mini cameras drivers for Raspberry Pi platform. -- Optimized the speed of SPI and Improved image transmission speed -- Support for Arducam Mini 2MP/2MP Plus 5MP plus (the default is 2mp/2mp plus) -- Support for 4 cameras work together -- Support image preview through hdmi monitor. -## Hardware Setup -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_1.jpg) - -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_2.jpg) -## Pins definition (BCM) -```Bash -//ArduCAM CS pins -#define CAM_CS1 17 -#define CAM_CS2 23 -#define CAM_CS3 22 -#define CAM_CS4 24 -``` -```Bash -//I2c pins -#define sda_port 2 -#define scl_port 3 -``` -```Bash -//SPI pins -//set 9 (MISO), 10 (MOSI), 11 (SCLK) alt fxn 0 (SPI0) -``` - -## Platform configuration (bcm283x_board_driver.h) -- These #define values are specific to the BCM2835, taken from "BCM2835 ARM Peripherals" -```Bash -#define BCM2835_PERI_BASE 0x20000000 -``` -- Updated to BCM2836 for Raspberry Pi 2.0 -```Bash -#define BCM2835_PERI_BASE 0x3F000000 -``` - -## Quickly start -- Install the open cv library -```bash -sudo apt-get install libopencv-dev -``` -- Install the RaspberryPi library -```bash -sudo git clone https://github.com/ArduCAM/RaspberryPi.git -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter_SPI_Camera/data/git_clone.png) - -- Compile and run the test demo -- [Notice: Before running the test demo, you should connect your hdmi monitor, if not, the opencv will can't find the display device.] -```bash -cd RaspberryPi/Multi_Camera_Adapter_SPI_Camera -``` -```bash -sudo make -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter_SPI_Camera/data/Compile.png) - -```bash -sudo ./run_Arducam_Demo -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/Multi_Camera_Adapter_SPI_Camera/data/rundemo.png) - - - - - - - - - - diff --git a/Multi_Camera_Adapter_SPI_Camera/data/Compile.png b/Multi_Camera_Adapter_SPI_Camera/data/Compile.png deleted file mode 100644 index fbd6b14..0000000 Binary files a/Multi_Camera_Adapter_SPI_Camera/data/Compile.png and /dev/null differ diff --git a/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_1.jpg b/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_1.jpg deleted file mode 100644 index ccbb816..0000000 Binary files a/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_1.jpg and /dev/null differ diff --git a/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_2.jpg b/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_2.jpg deleted file mode 100644 index 2ba70f8..0000000 Binary files a/Multi_Camera_Adapter_SPI_Camera/data/RPI_SPI_2.jpg and /dev/null differ diff --git a/Multi_Camera_Adapter_SPI_Camera/data/git_clone.png b/Multi_Camera_Adapter_SPI_Camera/data/git_clone.png deleted file mode 100644 index 727b2e3..0000000 Binary files a/Multi_Camera_Adapter_SPI_Camera/data/git_clone.png and /dev/null differ diff --git a/Multi_Camera_Adapter_SPI_Camera/data/rundemo.png b/Multi_Camera_Adapter_SPI_Camera/data/rundemo.png deleted file mode 100644 index cf70b4e..0000000 Binary files a/Multi_Camera_Adapter_SPI_Camera/data/rundemo.png and /dev/null differ diff --git a/Multi_Camera_Adapter_SPI_Camera/makefile b/Multi_Camera_Adapter_SPI_Camera/makefile deleted file mode 100644 index aa4643f..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/makefile +++ /dev/null @@ -1,30 +0,0 @@ -NAME=run_Arducam_Demo -CC=g++ -CFLAGS=-Wall -pthread `pkg-config --cflags --libs opencv` - -ODIR=obj -SDIR=src - -_DEPS=ArduCAM.h bcm283x_board_driver.h sccb_bus.h ov2640_regs.h ov5640_regs.h ov5642_regs.h -DEPS=$(patsubst %,$(SDIR)/%,$(_DEPS)) - -_OBJ=ArducamDemo.o ArduCAM.o bcm283x_board_driver.o sccb_bus.o -OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ)) - -$(ODIR)/%.o: src/%.cpp $(DEPS) - @mkdir -p $(@D) - $(CC) -c -o $@ $< $(CFLAGS) -$(ODIR)/%.o: src/%.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) - -$(NAME): $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) - -.PHONY: run - -run: $(NAME) - sudo ./$(NAME) - -.PHONY: clean -clean: - rm -f $(NAME) $(ODIR)/*.o diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.cpp b/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.cpp deleted file mode 100644 index ab8b54a..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.cpp +++ /dev/null @@ -1,641 +0,0 @@ -#include "ArduCAM.h" -#include "sccb_bus.h" -#include "ov2640_regs.h" -#include "ov5642_regs.h" -#include "ov5640_regs.h" -unsigned char sensor_model = 0; -unsigned char sensor_addr = 0; -unsigned char m_fmt = JPEG; -unsigned int length = 0; -unsigned char readbuf[JPEG_BUF_SIZE]; - -ArduCAM::ArduCAM(){ - sensor_model = OV7670; - sensor_addr = 0x42; -} - -ArduCAM :: ArduCAM(byte mode, int CS){ - if(CS >= 0){ - B_CS = CS; - } - sensor_model = mode; - switch (sensor_model) - { - case OV2640: - sensor_addr =0x60; - break; - case OV5642: - sensor_addr = 0x78; - break; - } -} -void ArduCAM::Arducam_CS_Init(void){ - pinMode(B_CS, OUTPUT); - digitalWrite(B_CS, HIGH); -} - - -void ArduCAM::InitCAM() -{ - switch (sensor_model) - { - case OV2640: - { - wrSensorReg8_8(0xff, 0x01); - wrSensorReg8_8(0x12, 0x80); - if(m_fmt == JPEG) - { - wrSensorRegs8_8(OV2640_JPEG_INIT); - wrSensorRegs8_8(OV2640_YUV422); - wrSensorRegs8_8(OV2640_JPEG); - wrSensorReg8_8(0xff, 0x01); - wrSensorReg8_8(0x15, 0x00); - wrSensorRegs8_8(OV2640_320x240_JPEG); - } - else - { - wrSensorRegs8_8(OV2640_QVGA); - } - break; - } - case OV5642: - { - wrSensorReg16_8(0x3008, 0x80); - wrSensorRegs16_8(OV5642_QVGA_Preview); - - if (m_fmt == JPEG) - { - printf("the format is JPEG\r\n"); - wrSensorRegs16_8(OV5642_JPEG_Capture_QSXGA); - wrSensorRegs16_8(ov5642_320x240); - wrSensorReg16_8(0x3818, 0xa8); - wrSensorReg16_8(0x3621, 0x10); - wrSensorReg16_8(0x3801, 0xb0); - wrSensorReg16_8(0x4407, 0x04); - - - } - else - { - unsigned char reg_val; - wrSensorReg16_8(0x4740, 0x21); - wrSensorReg16_8(0x501e, 0x2a); - wrSensorReg16_8(0x5002, 0xf8); - wrSensorReg16_8(0x501f, 0x01); - wrSensorReg16_8(0x4300, 0x61); - rdSensorReg16_8(0x3818, ®_val); - wrSensorReg16_8(0x3818, (reg_val | 0x60) & 0xff); - rdSensorReg16_8(0x3621, ®_val); - wrSensorReg16_8(0x3621, reg_val & 0xdf); - } - break; - } - default: - break; - } -} - -void ArduCAM:: CS_HIGH() -{ - delay_us(1); - digitalWrite(B_CS, HIGH); -} - -void ArduCAM:: CS_LOW() -{ - delay_us(1); - digitalWrite(B_CS, LOW); -} - -void ArduCAM:: set_format(unsigned char fmt) -{ - if (fmt == BMP) - m_fmt = BMP; - else if(fmt == RAW) - m_fmt = RAW; - else - m_fmt = JPEG; -} - -unsigned char ArduCAM:: bus_read(int address) -{ - unsigned char value; - CS_LOW(); - spiSendReceive(address); - value = spiSendReceive(0x00); - CS_HIGH(); - return value; -} - -unsigned char ArduCAM:: bus_write(int address,int value) -{ - CS_LOW(); - spiSendReceive(address); - spiSendReceive(value); - CS_HIGH(); - return 1; -} - -unsigned char ArduCAM:: read_reg(unsigned char addr) -{ - unsigned char readData; - readData = bus_read(addr & 0x7F); - return readData; -} -void ArduCAM:: write_reg(unsigned char addr, unsigned char data) -{ - bus_write(addr | 0x80, data); -} - -unsigned char ArduCAM:: read_fifo() -{ - unsigned char data; - data = bus_read(SINGLE_FIFO_READ); - return data; -} -void ArduCAM:: set_fifo_burst() -{ - spiSendReceive(BURST_FIFO_READ); -} - - -void ArduCAM:: flush_fifo() -{ - write_reg(ARDUCHIP_FIFO, FIFO_CLEAR_MASK); -} - -void ArduCAM:: start_capture() -{ - write_reg(ARDUCHIP_FIFO, FIFO_START_MASK); -} - -void ArduCAM:: clear_fifo_flag( ) -{ - write_reg(ARDUCHIP_FIFO, FIFO_CLEAR_MASK); -} - -unsigned int ArduCAM:: read_fifo_length() -{ - unsigned int len1,len2,len3,len=0; - len1 = read_reg(FIFO_SIZE1); - len2 = read_reg(FIFO_SIZE2); - len3 = read_reg(FIFO_SIZE3) & 0x7f; - len = ((len3 << 16) | (len2 << 8) | len1) & 0x07fffff; - return len; -} - -//Set corresponding bit -void ArduCAM:: set_bit(unsigned char addr, unsigned char bit) -{ - unsigned char temp; - temp = read_reg(addr); - write_reg(addr, temp | bit); -} -//Clear corresponding bit -void ArduCAM:: clear_bit(unsigned char addr, unsigned char bit) -{ - unsigned char temp; - temp = read_reg(addr); - write_reg(addr, temp & (~bit)); -} - -//Get corresponding bit status -unsigned char ArduCAM:: get_bit(unsigned char addr, unsigned char bit) -{ - unsigned char temp; - temp = read_reg(addr); - temp = temp & bit; - return temp; -} - - -void ArduCAM:: OV2640_set_JPEG_size(unsigned char size) -{ - switch(size) - { - case OV2640_160x120: - wrSensorRegs8_8(OV2640_160x120_JPEG); - break; - case OV2640_176x144: - wrSensorRegs8_8(OV2640_176x144_JPEG); - break; - case OV2640_320x240: - wrSensorRegs8_8(OV2640_320x240_JPEG); - break; - case OV2640_352x288: - wrSensorRegs8_8(OV2640_352x288_JPEG); - break; - case OV2640_640x480: - wrSensorRegs8_8(OV2640_640x480_JPEG); - break; - case OV2640_800x600: - wrSensorRegs8_8(OV2640_800x600_JPEG); - break; - case OV2640_1024x768: - wrSensorRegs8_8(OV2640_1024x768_JPEG); - break; - case OV2640_1280x1024: - wrSensorRegs8_8(OV2640_1280x1024_JPEG); - break; - case OV2640_1600x1200: - wrSensorRegs8_8(OV2640_1600x1200_JPEG); - break; - default: - wrSensorRegs8_8(OV2640_320x240_JPEG); - break; - } -} - - - -void ArduCAM:: OV5642_set_JPEG_size(unsigned char size) -{ - switch (size) - { - case OV5642_320x240: - wrSensorRegs16_8(ov5642_320x240); - break; - case OV5642_640x480: - wrSensorRegs16_8(ov5642_640x480); - break; - case OV5642_1024x768: - wrSensorRegs16_8(ov5642_1024x768); - break; - case OV5642_1280x960: - wrSensorRegs16_8(ov5642_1280x960); - break; - case OV5642_1600x1200: - wrSensorRegs16_8(ov5642_1600x1200); - break; - case OV5642_2048x1536: - wrSensorRegs16_8(ov5642_2048x1536); - break; - case OV5642_2592x1944: - wrSensorRegs16_8(ov5642_2592x1944); - break; - default: - wrSensorRegs16_8(ov5642_320x240); - break; - } -} - - - - - - -unsigned char ArduCAM:: wrSensorReg8_8(int regID, int regDat) -{ - delay_us(10); - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr) == 0) - { - sccb_bus_stop(); - return 1; - } - delay_us(10); - if(sccb_bus_write_byte(regID) == 0) - { - sccb_bus_stop(); - return 2; - } - delay_us(10); - if(sccb_bus_write_byte(regDat)==0) - { - sccb_bus_stop(); - return 3; - } - sccb_bus_stop(); - return 0; -} - - -unsigned char ArduCAM:: rdSensorReg8_8(unsigned char regID, unsigned char* regDat) -{ - delay_us(10); - - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr) == 0) - { - sccb_bus_stop(); - //goto start; - return 1; - } - delay_us(10); - if(sccb_bus_write_byte(regID)==0)//ID - { - sccb_bus_stop(); - //goto start; - return 2; - } - sccb_bus_stop(); - delay_us(10); - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr|0x01)==0) - { - sccb_bus_stop(); - //goto start; - return 3; - } - delay_us(10); - *regDat = sccb_bus_read_byte(); - sccb_bus_send_noack(); - sccb_bus_stop(); - return 0; -} - -//I2C Array Write 8bit address, 8bit data -int ArduCAM:: wrSensorRegs8_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned int reg_addr = 0; - unsigned int reg_val = 0; - const struct sensor_reg *next = reglist; - while ((reg_addr != 0xff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - err = wrSensorReg8_8(reg_addr, reg_val); - delay_ms(10); - next++; - } - - return err; -} - -unsigned char ArduCAM:: wrSensorReg16_8(int regID, int regDat) -{ - sccb_bus_start(); - if(0==sccb_bus_write_byte(sensor_addr)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regID>>8)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regID)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regDat)) - { - sccb_bus_stop(); - return(0); - } - sccb_bus_stop(); - - return(1); -} - -int ArduCAM:: wrSensorRegs16_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned int reg_addr; - unsigned char reg_val; - const struct sensor_reg *next = reglist; - - while ((reg_addr != 0xffff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - err = wrSensorReg16_8(reg_addr, reg_val); - next++; - delay_ms(1); - } - return err; -} - -int ArduCAM:: rdSensorRegs16_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned char testVal =0; - unsigned int reg_addr; - unsigned char reg_val; - const struct sensor_reg *next = reglist; - - while ((reg_addr != 0xffff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - // err = wrSensorReg16_8(reg_addr, reg_val); - //printf("Write register %04x value %02x\r\n",reg_addr,reg_val); - rdSensorReg16_8(reg_addr,&testVal); - printf("Read register %04x value %02x ",reg_addr,testVal); - if(testVal != reg_val){ - printf("(error) \r\n"); - }else{ - printf("\r\n"); - } - next++; - } - return err; -} - -unsigned char ArduCAM:: rdSensorReg16_8(unsigned int regID, unsigned char* regDat) -{ - sccb_bus_start(); - if(0==sccb_bus_write_byte(0x78)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - delay_us(20); - if(0==sccb_bus_write_byte(regID>>8)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - if(0==sccb_bus_write_byte(regID)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - sccb_bus_stop(); - - delay_us(20); - - - sccb_bus_start(); - if(0==sccb_bus_write_byte(0x79)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - *regDat=sccb_bus_read_byte(); - sccb_bus_send_noack(); - sccb_bus_stop(); - return(1); -} - -void ArduCAM:: resetFirmware(){ - //Reset the CPLD - write_reg(0x07, 0x80); - delay_ms(100); - write_reg(0x07, 0x00); - delay_ms(100); - -} - - imageData* ArduCAM:: getOneframe(imageData* dataBuf){ - int i , count; - bool is_header=0; - bool is_end = 0; - bool errorFlag = 0; - uint8_t temp_last = 0; - uint8_t temp = 0; - if( B_CS == CAM_CS1 ) - dataBuf->cameraID = 1; - else if (B_CS == CAM_CS2) - dataBuf->cameraID = 2; - else if (B_CS == CAM_CS3) - dataBuf->cameraID = 3; - else if (B_CS == CAM_CS4) - dataBuf->cameraID = 4; - else if (B_CS == CAM_CS5) - dataBuf->cameraID = 5; - else if (B_CS == CAM_CS6) - dataBuf->cameraID = 6; - else if (B_CS == CAM_CS7) - dataBuf->cameraID = 7; - else if (B_CS == CAM_CS8) - dataBuf->cameraID = 8; - //Flush the FIFO - flush_fifo(); - //Start capture - start_capture(); - // printf("Start capture...\r\n"); - while(!get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK)){;} - length = read_fifo_length(); - if(length == 0 || length > 0x7FFFF) //512K - { - printf("The %d camera length error.\r\n",dataBuf->cameraID); - return dataBuf; - } - count = length; - i = 0 ; - CS_LOW(); - set_fifo_burst();//Set fifo burst mode - dataBuf->dataLength = 0; - while (count--) { - temp_last = temp; - temp = spiSendReceive(0x00); - - //Read JPEG data from FIFO - if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while, - { - is_end = 1; - dataBuf->pu8ImageData[i++] = temp; //save the last 0XD9 - dataBuf->dataLength = i-1; -#if 0 - printf("Image save OK.\r\n"); - printf("The first byte is %x\r\n", dataBuf->pu8ImageData[0]); - printf("The end byte is %x\r\n", dataBuf->pu8ImageData[i-1]); -#endif - // is_header = false; - break; - } - if (is_header == true) - { - dataBuf->pu8ImageData[i++] = temp; - } - - else if ((temp == 0xD8) && (temp_last == 0xFF)) - { - is_header = true; - dataBuf->pu8ImageData[i++] = temp_last; - dataBuf->pu8ImageData[i++] = temp; - } - } - if(is_header == 0){ - printf("The %d camera can't find the header\r\n",dataBuf->cameraID); - errorFlag = 1; - }else{ - is_header = 0; - } - if(is_end == 0){ - printf("The %d camera can't find the end\r\n",dataBuf->cameraID); - errorFlag = 1; - }else { - is_end = 0; - } - if(errorFlag){ - dataBuf->errCount ++; - printf("The %d frame is error\r\n",dataBuf->errCount); - } - - count = 0; - CS_HIGH(); - return dataBuf; -} - - -void ArduCAM:: Arducam_bus_detect(){ -unsigned char vid, pid,temp ; - while(1){ - write_reg(ARDUCHIP_TEST1, 0x55 ); - temp = read_reg(ARDUCHIP_TEST1 ); - if (temp != 0x55){ - printf("SPI interface Error!\n"); - delay_ms(1000); - continue; - } - - else{ - printf("SPIinterface OK!\r\n"); - break; - } - } - - while(1){ - sensor_addr = 0x60; - wrSensorReg8_8(0xff, 0x01); - rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid); - rdSensorReg8_8(OV2640_CHIPID_LOW, &pid); - if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))) - printf("Can't find OV2640 module!\r\n"); - else{ - sensor_model = OV2640 ; - printf("OV2640 detected.\r\n"); - break; - } - sensor_addr = 0x78; - rdSensorReg16_8(OV5640_CHIPID_HIGH, &vid); - rdSensorReg16_8(OV5640_CHIPID_LOW, &pid); - if ((vid != 0x56) || (pid != 0x40)) - printf("Can't find OV5640 module!\r\n"); - else{ - sensor_model = OV5640 ; - printf("OV5640 detected.\r\n"); - break; - } - - sensor_addr = 0x78; - rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid); - rdSensorReg16_8(OV5642_CHIPID_LOW, &pid); - if ((vid != 0x56) || (pid != 0x42)){ - printf("Can't find OV5642 module!\r\n"); - continue; - } - else{ - sensor_model = OV5642 ; - printf("OV5642 detected.\r\n"); - break; - } - } -} - - - - - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.h b/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.h deleted file mode 100644 index b130681..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ArduCAM.h +++ /dev/null @@ -1,419 +0,0 @@ -#ifndef __ARDUCAM_H -#define __ARDUCAM_H -#include "bcm283x_board_driver.h" -#include -#include -typedef unsigned char uint8_t; -typedef unsigned char byte; - -#define JPEG_BUF_SIZE 2*1024*1024 //2M -#define CMD_BUF_SIZE 512 - -//ArduCAM CS define -#define CAM_CS1 17 -#define CAM_CS2 23 -#define CAM_CS3 22 -#define CAM_CS4 24 -#define CAM_CS5 5 -#define CAM_CS6 6 -#define CAM_CS7 13 -#define CAM_CS8 19 -#define sigTrig 18 - - -#define OV2640_CHIPID_HIGH 0x0A -#define OV2640_CHIPID_LOW 0x0B - -#define OV5642_CHIPID_HIGH 0x300a -#define OV5642_CHIPID_LOW 0x300b - -#define OV5640_CHIPID_HIGH 0x300a -#define OV5640_CHIPID_LOW 0x300b - -#define BMP 0 -#define JPEG 1 -#define RAW 2 - -#define OV7670 0 -#define MT9D111_A 1 -#define OV7675 2 -#define OV5642 3 -#define OV3640 4 -#define OV2640 5 -#define OV9655 6 -#define MT9M112 7 -#define OV7725 8 -#define OV7660 9 -#define MT9M001 10 -#define OV5640 11 -#define MT9D111_B 12 -#define OV9650 13 -#define MT9V111 14 -#define MT9T112 15 -#define MT9D112 16 - -#define OV2640_160x120 0 //160x120 -#define OV2640_176x144 1 //176x144 -#define OV2640_320x240 2 //320x240 -#define OV2640_352x288 3 //352x288 -#define OV2640_640x480 4 //640x480 -#define OV2640_800x600 5 //800x600 -#define OV2640_1024x768 6 //1024x768 -#define OV2640_1280x1024 7 //1280x1024 -#define OV2640_1600x1200 8 //1600x1200 - -#define OV5642_320x240 0 //320x240 -#define OV5642_640x480 1 //640x480 -#define OV5642_1024x768 2 //1024x768 -#define OV5642_1280x960 3 //1280x960 -#define OV5642_1600x1200 4 //1600x1200 -#define OV5642_2048x1536 5 //2048x1536 -#define OV5642_2592x1944 6 //2592x1944 - - -#define OV5640_320x240 0 //320x240 -#define OV5640_352x288 1 //352x288 -#define OV5640_640x480 2 //640x480 -#define OV5640_800x480 3 //800x480 -#define OV5640_1024x768 4 //1024x768 -#define OV5640_1280x960 5 //1280x960 -#define OV5640_1600x1200 6 //1600x1200 -#define OV5640_2048x1536 7 //2048x1536 -#define OV5640_2592x1944 8 //2592x1944 - - - - -//Light Mode - -#define Auto 0 -#define Sunny 1 -#define Cloudy 2 -#define Office 3 -#define Home 4 - -#define Advanced_AWB 0 -#define Simple_AWB 1 -#define Manual_day 2 -#define Manual_A 3 -#define Manual_cwf 4 -#define Manual_cloudy 5 - - - -//Color Saturation - -#define Saturation4 0 -#define Saturation3 1 -#define Saturation2 2 -#define Saturation1 3 -#define Saturation0 4 -#define Saturation_1 5 -#define Saturation_2 6 -#define Saturation_3 7 -#define Saturation_4 8 - -//Brightness - -#define Brightness4 0 -#define Brightness3 1 -#define Brightness2 2 -#define Brightness1 3 -#define Brightness0 4 -#define Brightness_1 5 -#define Brightness_2 6 -#define Brightness_3 7 -#define Brightness_4 8 - - -//Contrast - -#define Contrast4 0 -#define Contrast3 1 -#define Contrast2 2 -#define Contrast1 3 -#define Contrast0 4 -#define Contrast_1 5 -#define Contrast_2 6 -#define Contrast_3 7 -#define Contrast_4 8 - - - -#define degree_180 0 -#define degree_150 1 -#define degree_120 2 -#define degree_90 3 -#define degree_60 4 -#define degree_30 5 -#define degree_0 6 -#define degree30 7 -#define degree60 8 -#define degree90 9 -#define degree120 10 -#define degree150 11 - - - -//Special effects - -#define Antique 0 -#define Bluish 1 -#define Greenish 2 -#define Reddish 3 -#define BW 4 -#define Negative 5 -#define BWnegative 6 -#define Normal 7 -#define Sepia 8 -#define Overexposure 9 -#define Solarize 10 -#define Blueish 11 -#define Yellowish 12 - -#define Exposure_17_EV 0 -#define Exposure_13_EV 1 -#define Exposure_10_EV 2 -#define Exposure_07_EV 3 -#define Exposure_03_EV 4 -#define Exposure_default 5 -#define Exposure07_EV 6 -#define Exposure10_EV 7 -#define Exposure13_EV 8 -#define Exposure17_EV 9 -#define Exposure03_EV 10 - - -#define Auto_Sharpness_default 0 -#define Auto_Sharpness1 1 -#define Auto_Sharpness2 2 -#define Manual_Sharpnessoff 3 -#define Manual_Sharpness1 4 -#define Manual_Sharpness2 5 -#define Manual_Sharpness3 6 -#define Manual_Sharpness4 7 -#define Manual_Sharpness5 8 - - - -#define Sharpness1 0 -#define Sharpness2 1 -#define Sharpness3 2 -#define Sharpness4 3 -#define Sharpness5 4 -#define Sharpness6 5 -#define Sharpness7 6 -#define Sharpness8 7 -#define Sharpness_auto 8 - - - - -#define EV3 0 -#define EV2 1 -#define EV1 2 -#define EV0 3 -#define EV_1 4 -#define EV_2 5 -#define EV_3 6 - -#define MIRROR 0 -#define FLIP 1 -#define MIRROR_FLIP 2 - - - - -#define high_quality 0 -#define default_quality 1 -#define low_quality 2 - -#define Color_bar 0 -#define Color_square 1 -#define BW_square 2 -#define DLI 3 - - -#define Night_Mode_On 0 -#define Night_Mode_Off 1 - -#define Off 0 -#define Manual_50HZ 1 -#define Manual_60HZ 2 -#define Auto_Detection 3 - - -/****************************************************/ -/* I2C Control Definition */ -/****************************************************/ -#define I2C_ADDR_8BIT 0 -#define I2C_ADDR_16BIT 1 -#define I2C_REG_8BIT 0 -#define I2C_REG_16BIT 1 -#define I2C_DAT_8BIT 0 -#define I2C_DAT_16BIT 1 - -/* Register initialization tables for SENSORs */ -/* Terminating list entry for reg */ -#define SENSOR_REG_TERM_8BIT 0xFF -#define SENSOR_REG_TERM_16BIT 0xFFFF -/* Terminating list entry for val */ -#define SENSOR_VAL_TERM_8BIT 0xFF -#define SENSOR_VAL_TERM_16BIT 0xFFFF - -//Define maximum frame buffer size -#if (defined OV2640_MINI_2MP) -#define MAX_FIFO_SIZE 0x5FFFF //384Kunsigned char -#elif (defined OV5642_MINI_5MP || defined OV5642_MINI_5MP_BIT_ROTATION_FIXED || defined ARDUCAM_SHIELD_REVC) -#define MAX_FIFO_SIZE 0x7FFFF //512Kunsigned char -#else -#define MAX_FIFO_SIZE 0x7FFFFF //8Munsigned char -#endif - -/****************************************************/ -/* ArduChip registers definition */ -/****************************************************/ -#define RWBIT 0x80 //READ AND WRITE BIT IS BIT[7] - -#define ARDUCHIP_TEST1 0x00 //TEST register - -#if !(defined OV2640_MINI_2MP) - #define ARDUCHIP_FRAMES 0x01 //FRAME control register, Bit[2:0] = Number of frames to be captured //On 5MP_Plus platforms bit[2:0] = 7 means continuous capture until frame buffer is full -#endif - -#define ARDUCHIP_MODE 0x02 //Mode register -#define MCU2LCD_MODE 0x00 -#define CAM2LCD_MODE 0x01 -#define LCD2MCU_MODE 0x02 - -#define ARDUCHIP_TIM 0x03 //Timming control -#if !(defined OV2640_MINI_2MP) - #define HREF_LEVEL_MASK 0x01 //0 = High active , 1 = Low active - #define VSYNC_LEVEL_MASK 0x02 //0 = High active , 1 = Low active - #define LCD_BKEN_MASK 0x04 //0 = Enable, 1 = Disable - #if (defined ARDUCAM_SHIELD_V2) - #define PCLK_REVERSE_MASK 0x08 //0 = Normal PCLK, 1 = REVERSED PCLK - #else - #define PCLK_DELAY_MASK 0x08 //0 = data no delay, 1 = data delayed one PCLK - #endif - //#define MODE_MASK 0x10 //0 = LCD mode, 1 = FIFO mode -#endif -//#define FIFO_PWRDN_MASK 0x20 //0 = Normal operation, 1 = FIFO power down -//#define LOW_POWER_MODE 0x40 //0 = Normal mode, 1 = Low power mode - -#define ARDUCHIP_FIFO 0x04 //FIFO and I2C control -#define FIFO_CLEAR_MASK 0x01 -#define FIFO_START_MASK 0x02 -#define FIFO_RDPTR_RST_MASK 0x10 -#define FIFO_WRPTR_RST_MASK 0x20 - -#define ARDUCHIP_GPIO 0x06 //GPIO Write Register -#if !(defined (ARDUCAM_SHIELD_V2) || defined (ARDUCAM_SHIELD_REVC)) -#define GPIO_RESET_MASK 0x01 //0 = Sensor reset, 1 = Sensor normal operation -#define GPIO_PWDN_MASK 0x02 //0 = Sensor normal operation, 1 = Sensor standby -#define GPIO_PWREN_MASK 0x04 //0 = Sensor LDO disable, 1 = sensor LDO enable -#endif - -#define BURST_FIFO_READ 0x3C //Burst FIFO read operation -#define SINGLE_FIFO_READ 0x3D //Single FIFO read operation - -#define ARDUCHIP_REV 0x40 //ArduCHIP revision -#define VER_LOW_MASK 0x3F -#define VER_HIGH_MASK 0xC0 - -#define ARDUCHIP_TRIG 0x41 //Trigger source -#define VSYNC_MASK 0x01 -#define SHUTTER_MASK 0x02 -#define CAP_DONE_MASK 0x08 - -#define FIFO_SIZE1 0x42 //Camera write FIFO size[7:0] for burst to read -#define FIFO_SIZE2 0x43 //Camera write FIFO size[15:8] -#define FIFO_SIZE3 0x44 //Camera write FIFO size[18:16] - -#ifndef _SENSOR_ -#define _SENSOR_ -struct sensor_reg { - unsigned int reg; - unsigned int val; -}; - -typedef struct -{ - unsigned long dataLength; - uint8_t pu8ImageData[JPEG_BUF_SIZE]; - uint8_t cameraID; - unsigned int errCount = 0; -}imageData; - - - -#endif -class ArduCAM{ -public: - ArduCAM( void ); - ArduCAM(byte model ,int CS); - void InitCAM( void ); - -void resetFirmware(void ); - - -void CS_HIGH(void); -void CS_LOW(void); - -void OV2640_set_JPEG_size(unsigned char size); -void OV5642_set_JPEG_size(unsigned char size); -void OV5640_set_JPEG_size(unsigned char size); -void set_format(unsigned char fmt); - - -void OV5642_set_Color_Saturation(unsigned char Color_Saturation); - void OV5642_set_Brightness(unsigned char Brightness); - void OV5642_set_Special_effects(unsigned char Special_effect); -void OV5642_set_Sharpness(unsigned char Sharpness); - - - -void flush_fifo( void ); -void start_capture( void); -void clear_fifo_flag(void); -unsigned char read_fifo(void); - -unsigned char read_reg(unsigned char addr); -void write_reg(unsigned char addr, unsigned char data); - -unsigned int read_fifo_length(); -void set_fifo_burst(void); - -void set_bit(unsigned char addr, unsigned char bit); -void clear_bit(unsigned char addr, unsigned char bit); -unsigned char get_bit(unsigned char addr, unsigned char bit); -void set_mode(unsigned char mode); - -unsigned char bus_write(int address, int value); -unsigned char bus_read(int address); -unsigned char read_fifo_burst(void); - - - -unsigned char wrSensorReg8_8(int regID, int regDat); -int wrSensorRegs8_8(const struct sensor_reg*); -unsigned char rdSensorReg8_8(unsigned char regID, unsigned char* regDat); - -unsigned char wrSensorReg16_8(int regID, int regDat); -int wrSensorRegs16_8(const struct sensor_reg reglist[]); -unsigned char rdSensorReg16_8(unsigned int regID, unsigned char* regDat); -int rdSensorRegs16_8(const struct sensor_reg reglist[]); -imageData* getOneframe(imageData* dataBuf); -void Arducam_bus_detect(void); -void Arducam_CS_Init(void); - -protected: - volatile uint8_t *P_CS; - uint8_t B_CS; - byte m_fmt; - byte sensor_model; - byte sensor_addr; -}; -extern unsigned int length; - -#endif diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ArducamDemo.cpp b/Multi_Camera_Adapter_SPI_Camera/src/ArducamDemo.cpp deleted file mode 100644 index 3488939..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ArducamDemo.cpp +++ /dev/null @@ -1,373 +0,0 @@ -#include -#include -#include "ArduCAM.h" -#include "sccb_bus.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace cv; -using namespace std; - -imageData* ArducamImageData = new imageData; - -#define CAMERA_1_EN -#define CAMERA_2_EN -#define CAMERA_3_EN -#define CAMERA_4_EN -//#define CAMERA_5_EN -//#define CAMERA_6_EN -//#define CAMERA_7_EN -//#define CAMERA_8_EN - - - -#define posW 320 -#define posH 240 - -#define SPI_CLK_SPEED 2000000 - -cv::Mat JPGToMat(uint8_t* bytes,int length){ - cv::Mat image = Mat(1,length,CV_8UC1,bytes); - if(length <= 0){ - image.data = NULL; - return image; - } - image = imdecode(image,IMREAD_ANYCOLOR); - return image; -} -cv::Mat ConvertImage(imageData* frameData){ - cv::Mat rawImage ; - if(frameData->dataLength<=0){ - printf("The %d camera is error.\r\n",frameData->cameraID); - return rawImage; - } - rawImage = JPGToMat(frameData->pu8ImageData,frameData->dataLength); - return rawImage; -} -#if defined (CAMERA_1_EN) -ArduCAM myCAM1( OV2640, CAM_CS1 ); -#endif -#if defined (CAMERA_2_EN) -ArduCAM myCAM2( OV2640, CAM_CS2); -#endif -#if defined (CAMERA_3_EN) -ArduCAM myCAM3( OV2640, CAM_CS3 ); -#endif -#if defined (CAMERA_4_EN) -ArduCAM myCAM4( OV2640, CAM_CS4); -#endif -#if defined (CAMERA_5_EN) -ArduCAM myCAM5( OV2640, CAM_CS5); -#endif -#if defined (CAMERA_6_EN) -ArduCAM myCAM6( OV2640, CAM_CS6); -#endif -#if defined (CAMERA_7_EN) -ArduCAM myCAM7( OV2640, CAM_CS7); -#endif -#if defined (CAMERA_8_EN) -ArduCAM myCAM8( OV2640, CAM_CS8); -#endif - - - -int main(int argc, char *argv[]){ - printf("Arducam begin.\r\n"); - unsigned char vid, pid; - unsigned char temp; - cv::Mat rawImage ; - pioInit(); - spiInit(SPI_CLK_SPEED,0); - sccb_bus_init(); - pinMode(sigTrig, OUTPUT); - digitalWrite(sigTrig, HIGH); - #if defined (CAMERA_1_EN) - myCAM1.Arducam_CS_Init(); - myCAM1.resetFirmware(); - #endif - #if defined (CAMERA_2_EN) - myCAM2.Arducam_CS_Init(); - myCAM2.resetFirmware(); - #endif - #if defined (CAMERA_3_EN) - myCAM3.Arducam_CS_Init(); - myCAM3.resetFirmware(); - #endif - #if defined (CAMERA_4_EN) - myCAM4.Arducam_CS_Init(); - myCAM4.resetFirmware(); - #endif - #if defined (CAMERA_5_EN) - myCAM5.Arducam_CS_Init(); - myCAM5.resetFirmware(); - #endif - #if defined (CAMERA_6_EN) - myCAM6.Arducam_CS_Init(); - myCAM6.resetFirmware(); - #endif - #if defined (CAMERA_7_EN) - myCAM7.Arducam_CS_Init(); - myCAM7.resetFirmware(); - #endif - #if defined (CAMERA_8_EN) - myCAM8.Arducam_CS_Init(); - myCAM8.resetFirmware(); - #endif - delay_ms(100); - printf("Begin to test the SPI bus\r\n"); - #if defined (CAMERA_1_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM1.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM1.read_reg(ARDUCHIP_TEST1); - if (temp != 0x55){ - printf("SPI1 interface Error!\r\n"); - printf("Expect: 0x55. Read data :0x%x\r\n",temp); - digitalWrite(sigTrig, LOW); delay_ms(5); - digitalWrite(sigTrig, HIGH); - delay_ms(1000);continue; - } - else{ - printf("SPI1 interface OK.\r\n");break; - } - - } - #endif - #if defined (CAMERA_2_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM2.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM2.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI2 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI2 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_3_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM3.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM3.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI3 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI3 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_4_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM4.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM4.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI4 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI4 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_5_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM5.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM5.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI5 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI5 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_6_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM6.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM6.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI6 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI6 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_7_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM7.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM7.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI7 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI7 interface OK.\r\n");break; - } - } - #endif - #if defined (CAMERA_8_EN) - while(1){ - //Check if the ArduCAM SPI bus is OK - myCAM8.write_reg(ARDUCHIP_TEST1, 0x55); - temp = myCAM8.read_reg(ARDUCHIP_TEST1); - - if (temp != 0x55){ - printf("SPI8 interface Error!\r\n"); - delay_ms(1000);continue; - }else{ - printf("SPI8 interface OK.\r\n");break; - } - } - #endif - while(1){ - //Check if the camera module type is OV2640 - myCAM1.wrSensorReg8_8(0xff, 0x01); - myCAM1.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid); - myCAM1.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid); - if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))){ - printf("Can't find OV2640 module!\r\n"); - delay_ms(1000);continue; - } - else{ - printf("OV2640 detected.\r\n");break; - } - } - myCAM1.set_format(JPEG); - myCAM1.InitCAM(); - myCAM1.OV2640_set_JPEG_size(OV2640_320x240); - delay_ms(1000); -#if defined (CAMERA_1_EN) - cv::namedWindow("Arducam SPI1 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI1 Camera", posW*1,posH*1); - -#endif -#if defined (CAMERA_2_EN) - cv::namedWindow("Arducam SPI2 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI2 Camera",posW*2,posH*1); - -#endif -#if defined (CAMERA_3_EN) - cv::namedWindow("Arducam SPI3 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI3 Camera", posW*3,posH*1); - -#endif -#if defined (CAMERA_4_EN) - cv::namedWindow("Arducam SPI4 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI4 Camera", posW*4,posH*1); - -#endif -#if defined (CAMERA_5_EN) - cv::namedWindow("Arducam SPI5 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI5 Camera", posW*1,posH*2); -#endif - -#if defined (CAMERA_6_EN) - cv::namedWindow("Arducam SPI6 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI6 Camera", posW*2,posH*2); -#endif -#if defined (CAMERA_7_EN) - cv::namedWindow("Arducam SPI7 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI7 Camera", posW*3,posH*2); -#endif -#if defined (CAMERA_8_EN) - cv::namedWindow("Arducam SPI8 Camera", cv::WINDOW_AUTOSIZE); - cv::moveWindow("Arducam SPI8 Camera", posW*4,posH*2); -#endif - - - - - -while(1){ -#if defined (CAMERA_1_EN) - myCAM1.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI1 Camera", rawImage); -#endif -#if defined (CAMERA_2_EN) - myCAM2.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI2 Camera", rawImage); -#endif -#if defined (CAMERA_3_EN) - myCAM3.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI3 Camera", rawImage); -#endif -#if defined (CAMERA_4_EN) - myCAM4.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI4 Camera", rawImage); -#endif -#if defined (CAMERA_5_EN) - myCAM5.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI5 Camera", rawImage); -#endif -#if defined (CAMERA_6_EN) - myCAM6.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI6 Camera", rawImage); -#endif -#if defined (CAMERA_7_EN) - myCAM7.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI7 Camera", rawImage); -#endif -#if defined (CAMERA_8_EN) - myCAM8.getOneframe(ArducamImageData); - rawImage = ConvertImage(ArducamImageData); - if(rawImage.empty()){ - printf("Image load failed\r\n"); - }else - cv::imshow("Arducam SPI8 Camera", rawImage); -#endif - - if(waitKey(20) >=0) break; // 等待按键,跳出 - -} -} - - - - - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.c b/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.c deleted file mode 100644 index 4038e38..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.c +++ /dev/null @@ -1,349 +0,0 @@ -#include "bcm283x_board_driver.h" - -#include -#include - -#ifdef __cplusplus -extern "C"{ -#endif - - -// Pointers that will be memory mapped when pioInit() is called -volatile unsigned int *gpio; //pointer to base of gpio -volatile unsigned int *spi; //pointer to base of spi registers -volatile unsigned int *pwm; - -volatile unsigned int *sys_timer; -volatile unsigned int *arm_timer; // pointer to base of arm timer registers - -volatile unsigned int *uart; -volatile unsigned int *cm_pwm; - - -///////////////////////////////////////////////////////////////////// -// General Functions -///////////////////////////////////////////////////////////////////// -// TODO: return error code instead of printing (mem_fd, reg_map) - -int irq1, irq2, irqbasic; - -void pioInit() { - int mem_fd; - void *reg_map; - - // /dev/mem is a psuedo-driver for accessing memory in the Linux filesystem - if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { - printf("can't open /dev/mem \n"); - exit(-1); - } - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - GPIO_BASE); // Offset to GPIO peripheral - - if (reg_map == MAP_FAILED) { - printf("gpio mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - gpio = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - SPI0_BASE); // Offset to SPI peripheral - - if (reg_map == MAP_FAILED) { - printf("spi mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - spi = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - PWM_BASE); // Offset to PWM peripheral - - if (reg_map == MAP_FAILED) { - printf("pwm mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - pwm = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - SYS_TIMER_BASE); // Offset to Timer peripheral - - if (reg_map == MAP_FAILED) { - printf("sys timer mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - sys_timer = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - ARM_TIMER_BASE); // Offset to interrupts - - - if (reg_map == MAP_FAILED) { - printf("arm timer mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - arm_timer = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - UART_BASE); // Offset to UART peripheral - - if (reg_map == MAP_FAILED) { - printf("uart mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - uart = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - CM_PWM_BASE); // Offset to ARM timer peripheral - - if (reg_map == MAP_FAILED) { - printf("cm_pwm mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - cm_pwm = (volatile unsigned *)reg_map; - close(mem_fd); -} - - -void noInterrupts(void) { - //save current interrupts - irq1 = IRQ_ENABLE1; - irq2 = IRQ_ENABLE2; - irqbasic = IRQ_ENABLE_BASIC; - - //disable interrupts - IRQ_DISABLE1 = irq1; - IRQ_DISABLE2 = irq2; - IRQ_DISABLE_BASIC = irqbasic; -} - -void interrupts(void) { - if(IRQ_ENABLE1 == 0){ // if interrupts are disabled - //restore interrupts - IRQ_ENABLE1 = irq1; - IRQ_ENABLE2 = irq2; - IRQ_ENABLE_BASIC = irqbasic; - } -} - - -void pinMode(int pin, int function) { - int reg = pin/10; - int offset = (pin%10)*3; - GPFSEL[reg] &= ~((0b111 & ~function) << offset); - GPFSEL[reg] |= ((0b111 & function) << offset); -} - -void digitalWrite(int pin, int val) { - int reg = pin / 32; - int offset = pin % 32; - - if (val) GPSET[reg] = 1 << offset; - else GPCLR[reg] = 1 << offset; -} - -int digitalRead(int pin) { - int reg = pin / 32; - int offset = pin % 32; - - return (GPLEV[reg] >> offset) & 0x00000001; -} - -void pinsMode(int pins[], int numPins, int fxn) { - int i; - for(i=0; i> 1; - } -} - -int digitalReads(int pins[], int numPins) { - int i, val = digitalRead(pins[0]); - - for(i=1; i> 8); // send data MSB first - rec = (rec << 8) | spiSendReceive(send & 0xFF); - SPI0CSbits.TA = 0; // turn off SPI - return rec; -} - -///////////////////////////////////////////////////////////////////// -// UART Functions -///////////////////////////////////////////////////////////////////// - -void uartInit(int baud) { - uint fb = 12000000/baud; // 3 MHz UART clock - - pinMode(14, ALT0); - pinMode(15, ALT0); - UART_IBRD = fb >> 6; // 6 Fract, 16 Int bits of BRD - UART_FBRD = fb & 63; - UART_LCRHbits.WLEN = 3; // 8 Data, 1 Stop, 0 Parity, no FIFO, no Flow - UART_CRbits.UARTEN = 1; // Enable uart. -} - -char getCharSerial(void) { - while (UART_FRbits.RXFE); // Wait until data is available. - return UART_DRbits.DATA; // Return char from serial port. -} - - -void putCharSerial(char c) { - while (!UART_FRbits.TXFE); - UART_DRbits.DATA = c; -} - -///////////////////////////////////////////////////////////////////// -// Pulse Width Modulation Functions -///////////////////////////////////////////////////////////////////// - -void pwmInit() { - pinMode(18, ALT5); - - // Configure the clock manager to generate a 25 MHz PWM clock. - // Documentation on the clock manager is missing in the datasheet - // but found in "BCM2835 Audio and PWM Clocks" by G.J. van Loo 6 Feb 2013. - // Maximum operating frequency of PWM clock is 25 MHz. - // Writes to the clock manager registers require simultaneous writing - // a "password" of 5A to the top bits to reduce the risk of accidental writes. - - CM_PWMCTL = 0; // Turn off PWM before changing - CM_PWMCTL = PWM_CLK_PASSWORD|0x20; // Turn off clock generator - while(CM_PWMCTLbits.BUSY); // Wait for generator to stop - CM_PWMCTL = PWM_CLK_PASSWORD|0x206; // Src = unfiltered 500 MHz CLKD - CM_PWMDIV = PWM_CLK_PASSWORD|(PLL_CLOCK_DIVISOR << 12); // PWM Freq = 25 MHz - CM_PWMCTL = CM_PWMCTL|PWM_CLK_PASSWORD|0x10; // Enable PWM clock - while (!CM_PWMCTLbits.BUSY); // Wait for generator to start - PWM_CTLbits.MSEN1 = 1; // Channel 1 in mark/space mode - PWM_CTLbits.PWEN1 = 1; // Enable pwm -} - -/** - * dut is a value between 0 and 1 - * freq is pwm frequency in Hz - */ -void setPWM(float freq, float dut) { - PWM_RNG1 = (int)(CM_FREQUENCY / freq); - PWM_DAT1 = (int)(dut * (CM_FREQUENCY / freq)); -} - -void analogWrite(int val) { - setPWM(78125, val/255.0); -} - - -#ifdef __cplusplus -} -#endif - - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.h b/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.h deleted file mode 100644 index bb60410..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/bcm283x_board_driver.h +++ /dev/null @@ -1,709 +0,0 @@ - -#ifndef BCM_283X_H -#define BCM_283X_H - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -///////////////////////////////////////////////////////////////////// -// Constants -///////////////////////////////////////////////////////////////////// - -// GPIO FSEL Types -#define INPUT 0 -#define OUTPUT 1 -#define ALT0 4 -#define ALT1 5 -#define ALT2 6 -#define ALT3 7 -#define ALT4 3 -#define ALT5 2 - -// Clock Manager Bitfield offsets: -#define PWM_CLK_PASSWORD 0x5a000000 -#define PWM_MASH 9 -#define PWM_KILL 5 -#define PWM_ENAB 4 -#define PWM_SRC 0 - -// PWM Constants -#define PLL_FREQUENCY 500000000 // default PLLD value is 500 [MHz] -#define CM_FREQUENCY 25000000 // max pwm clk is 25 [MHz] -#define PLL_CLOCK_DIVISOR (PLL_FREQUENCY / CM_FREQUENCY) - -///////////////////////////////////////////////////////////////////// -// Memory Map -///////////////////////////////////////////////////////////////////// - -// These #define values are specific to the BCM2835, taken from "BCM2835 ARM Peripherals" -//#define BCM2835_PERI_BASE 0x20000000 - -// Updated to BCM2836 for Raspberry Pi 3.0 Fall 2015 dmh -#define BCM2835_PERI_BASE 0x3F000000 - -// Updated to BCM2711 for Raspberry Pi 4.0 Fall 2015 dmh -//#define BCM2835_PERI_BASE 0xFE000000 - -#define GPIO_BASE (BCM2835_PERI_BASE + 0x200000) -#define UART_BASE (BCM2835_PERI_BASE + 0x201000) -#define SPI0_BASE (BCM2835_PERI_BASE + 0x204000) -#define PWM_BASE (BCM2835_PERI_BASE + 0x20c000) - -#define SYS_TIMER_BASE (BCM2835_PERI_BASE + 0x3000) -#define ARM_TIMER_BASE (BCM2835_PERI_BASE + 0xB000) - -#define CM_PWM_BASE (BCM2835_PERI_BASE + 0x101000) - -#define BLOCK_SIZE (4*1024) - - - -#define SPI_CS_LEN_LONG 0x02000000 -#define SPI_CS_DMA_LEN 0x01000000 -#define SPI_CS_CSPOL2 0x00800000 -#define SPI_CS_CSPOL1 0x00400000 -#define SPI_CS_CSPOL0 0x00200000 -#define SPI_CS_RXF 0x00100000 -#define SPI_CS_RXR 0x00080000 -#define SPI_CS_TXD 0x00040000 -#define SPI_CS_RXD 0x00020000 -#define SPI_CS_DONE 0x00010000 -#define SPI_CS_LEN 0x00002000 -#define SPI_CS_REN 0x00001000 -#define SPI_CS_ADCS 0x00000800 -#define SPI_CS_INTR 0x00000400 -#define SPI_CS_INTD 0x00000200 -#define SPI_CS_DMAEN 0x00000100 -#define SPI_CS_TA 0x00000080 -#define SPI_CS_CSPOL 0x00000040 -#define SPI_CS_CLEAR_RX 0x00000020 -#define SPI_CS_CLEAR_TX 0x00000010 -#define SPI_CS_CPOL 0x00000008 -#define SPI_CS_CPHA 0x00000004 -#define SPI_CS_CS_10 0x00000002 -#define SPI_CS_CS_01 0x00000001 - - - - -///////////////////////////////////////////////////////////////////// -// GPIO Registers -///////////////////////////////////////////////////////////////////// - -// Function Select -#define GPFSEL ((volatile unsigned int *) (gpio + 0)) -typedef struct -{ - unsigned FSEL0 : 3; - unsigned FSEL1 : 3; - unsigned FSEL2 : 3; - unsigned FSEL3 : 3; - unsigned FSEL4 : 3; - unsigned FSEL5 : 3; - unsigned FSEL6 : 3; - unsigned FSEL7 : 3; - unsigned FSEL8 : 3; - unsigned FSEL9 : 3; - unsigned : 2; -}gpfsel0bits; -#define GPFSEL0bits (*(volatile gpfsel0bits*) (gpio + 0)) -#define GPFSEL0 (*(volatile unsigned int*) (gpio + 0)) - -typedef struct -{ - unsigned FSEL10 : 3; - unsigned FSEL11 : 3; - unsigned FSEL12 : 3; - unsigned FSEL13 : 3; - unsigned FSEL14 : 3; - unsigned FSEL15 : 3; - unsigned FSEL16 : 3; - unsigned FSEL17 : 3; - unsigned FSEL18 : 3; - unsigned FSEL19 : 3; - unsigned : 2; -}gpfsel1bits; -#define GPFSEL1bits (*(volatile gpfsel1bits*) (gpio + 1)) -#define GPFSEL1 (*(volatile unsigned int*) (gpio + 1)) - -typedef struct -{ - unsigned FSEL20 : 3; - unsigned FSEL21 : 3; - unsigned FSEL22 : 3; - unsigned FSEL23 : 3; - unsigned FSEL24 : 3; - unsigned FSEL25 : 3; - unsigned FSEL26 : 3; - unsigned FSEL27 : 3; - unsigned FSEL28 : 3; - unsigned FSEL29 : 3; - unsigned : 2; -}gpfsel2bits; -#define GPFSEL2bits (* (volatile gpfsel2bits*) (gpio + 2)) -#define GPFSEL2 (* (volatile unsigned int *) (gpio + 2)) - -typedef struct -{ - unsigned FSEL30 : 3; - unsigned FSEL31 : 3; - unsigned FSEL32 : 3; - unsigned FSEL33 : 3; - unsigned FSEL34 : 3; - unsigned FSEL35 : 3; - unsigned FSEL36 : 3; - unsigned FSEL37 : 3; - unsigned FSEL38 : 3; - unsigned FSEL39 : 3; - unsigned : 2; -}gpfsel3bits; -#define GPFSEL3bits (* (volatile gpfsel3bits*) (gpio + 3)) -#define GPFSEL3 (* (volatile unsigned int *) (gpio + 3)) - - -typedef struct -{ - unsigned FSEL40 : 3; - unsigned FSEL41 : 3; - unsigned FSEL42 : 3; - unsigned FSEL43 : 3; - unsigned FSEL44 : 3; - unsigned FSEL45 : 3; - unsigned FSEL46 : 3; - unsigned FSEL47 : 3; - unsigned FSEL48 : 3; - unsigned FSEL49 : 3; - unsigned : 2; -}gpfsel4bits; -#define GPFSEL4bits (* (volatile gpfsel4bits*) (gpio + 4)) -#define GPFSEL4 (* (volatile unsigned int *) (gpio + 4)) - -typedef struct -{ - unsigned FSEL50 : 3; - unsigned FSEL51 : 3; - unsigned FSEL52 : 3; - unsigned FSEL53 : 3; - unsigned : 20; -}gpfsel5bits; -#define GPFSEL5bits (* (volatile gpfsel5bits*) (gpio + 5)) -#define GPFSEL5 (* (volatile unsigned int *) (gpio + 5)) - -// Pin Output Select -#define GPSET ((volatile unsigned int *) (gpio + 7)) -typedef struct -{ - unsigned SET0 : 1; - unsigned SET1 : 1; - unsigned SET2 : 1; - unsigned SET3 : 1; - unsigned SET4 : 1; - unsigned SET5 : 1; - unsigned SET6 : 1; - unsigned SET7 : 1; - unsigned SET8 : 1; - unsigned SET9 : 1; - unsigned SET10 : 1; - unsigned SET11 : 1; - unsigned SET12 : 1; - unsigned SET13 : 1; - unsigned SET14 : 1; - unsigned SET15 : 1; - unsigned SET16 : 1; - unsigned SET17 : 1; - unsigned SET18 : 1; - unsigned SET19 : 1; - unsigned SET20 : 1; - unsigned SET21 : 1; - unsigned SET22 : 1; - unsigned SET23 : 1; - unsigned SET24 : 1; - unsigned SET25 : 1; - unsigned SET26 : 1; - unsigned SET27 : 1; - unsigned SET28 : 1; - unsigned SET29 : 1; - unsigned SET30 : 1; - unsigned SET31 : 1; -}gpset0bits; -#define GPSET0bits (* (volatile gpset0bits*) (gpio + 7)) -#define GPSET0 (* (volatile unsigned int *) (gpio + 7)) - -typedef struct -{ - unsigned SET32 : 1; - unsigned SET33 : 1; - unsigned SET34 : 1; - unsigned SET35 : 1; - unsigned SET36 : 1; - unsigned SET37 : 1; - unsigned SET38 : 1; - unsigned SET39 : 1; - unsigned SET40 : 1; - unsigned SET41 : 1; - unsigned SET42 : 1; - unsigned SET43 : 1; - unsigned SET44 : 1; - unsigned SET45 : 1; - unsigned SET46 : 1; - unsigned SET47 : 1; - unsigned SET48 : 1; - unsigned SET49 : 1; - unsigned SET50 : 1; - unsigned SET51 : 1; - unsigned SET52 : 1; - unsigned SET53 : 1; - unsigned : 10; -}gpset1bits; -#define GPSET1bits (* (volatile gpset1bits*) (gpio + 8)) -#define GPSET1 (* (volatile unsigned int *) (gpio + 8)) - -// Pin Output Clear -#define GPCLR ((volatile unsigned int *) (gpio + 10)) -typedef struct -{ - unsigned CLR0 : 1; - unsigned CLR1 : 1; - unsigned CLR2 : 1; - unsigned CLR3 : 1; - unsigned CLR4 : 1; - unsigned CLR5 : 1; - unsigned CLR6 : 1; - unsigned CLR7 : 1; - unsigned CLR8 : 1; - unsigned CLR9 : 1; - unsigned CLR10 : 1; - unsigned CLR11 : 1; - unsigned CLR12 : 1; - unsigned CLR13 : 1; - unsigned CLR14 : 1; - unsigned CLR15 : 1; - unsigned CLR16 : 1; - unsigned CLR17 : 1; - unsigned CLR18 : 1; - unsigned CLR19 : 1; - unsigned CLR20 : 1; - unsigned CLR21 : 1; - unsigned CLR22 : 1; - unsigned CLR23 : 1; - unsigned CLR24 : 1; - unsigned CLR25 : 1; - unsigned CLR26 : 1; - unsigned CLR27 : 1; - unsigned CLR28 : 1; - unsigned CLR29 : 1; - unsigned CLR30 : 1; - unsigned CLR31 : 1; -}gpclr0bits; -#define GPCLR0bits (* (volatile gpclr0bits*) (gpio + 10)) -#define GPCLR0 (* (volatile unsigned int *) (gpio + 10)) - -typedef struct -{ - unsigned CLR32 : 1; - unsigned CLR33 : 1; - unsigned CLR34 : 1; - unsigned CLR35 : 1; - unsigned CLR36 : 1; - unsigned CLR37 : 1; - unsigned CLR38 : 1; - unsigned CLR39 : 1; - unsigned CLR40 : 1; - unsigned CLR41 : 1; - unsigned CLR42 : 1; - unsigned CLR43 : 1; - unsigned CLR44 : 1; - unsigned CLR45 : 1; - unsigned CLR46 : 1; - unsigned CLR47 : 1; - unsigned CLR48 : 1; - unsigned CLR49 : 1; - unsigned CLR50 : 1; - unsigned CLR51 : 1; - unsigned CLR52 : 1; - unsigned CLR53 : 1; - unsigned : 10; -}gpclr1bits; -#define GPCLR1bits (* (volatile gpclr1bits*) (gpio + 11)) -#define GPCLR1 (* (volatile unsigned int *) (gpio + 11)) - -// Pin Level -#define GPLEV ((volatile unsigned int *) (gpio + 13)) -typedef struct -{ - unsigned LEV0 : 1; - unsigned LEV1 : 1; - unsigned LEV2 : 1; - unsigned LEV3 : 1; - unsigned LEV4 : 1; - unsigned LEV5 : 1; - unsigned LEV6 : 1; - unsigned LEV7 : 1; - unsigned LEV8 : 1; - unsigned LEV9 : 1; - unsigned LEV10 : 1; - unsigned LEV11 : 1; - unsigned LEV12 : 1; - unsigned LEV13 : 1; - unsigned LEV14 : 1; - unsigned LEV15 : 1; - unsigned LEV16 : 1; - unsigned LEV17 : 1; - unsigned LEV18 : 1; - unsigned LEV19 : 1; - unsigned LEV20 : 1; - unsigned LEV21 : 1; - unsigned LEV22 : 1; - unsigned LEV23 : 1; - unsigned LEV24 : 1; - unsigned LEV25 : 1; - unsigned LEV26 : 1; - unsigned LEV27 : 1; - unsigned LEV28 : 1; - unsigned LEV29 : 1; - unsigned LEV30 : 1; - unsigned LEV31 : 1; -}gplev0bits; -#define GPLEV0bits (* (volatile gplev0bits*) (gpio + 13)) -#define GPLEV0 (* (volatile unsigned int *) (gpio + 13)) - - -typedef struct -{ - unsigned LEV32 : 1; - unsigned LEV33 : 1; - unsigned LEV34 : 1; - unsigned LEV35 : 1; - unsigned LEV36 : 1; - unsigned LEV37 : 1; - unsigned LEV38 : 1; - unsigned LEV39 : 1; - unsigned LEV40 : 1; - unsigned LEV41 : 1; - unsigned LEV42 : 1; - unsigned LEV43 : 1; - unsigned LEV44 : 1; - unsigned LEV45 : 1; - unsigned LEV46 : 1; - unsigned LEV47 : 1; - unsigned LEV48 : 1; - unsigned LEV49 : 1; - unsigned LEV50 : 1; - unsigned LEV51 : 1; - unsigned LEV52 : 1; - unsigned LEV53 : 1; - unsigned : 10; -}gplev1bits; -#define GPLEV1bits (* (volatile gplev1bits*) (gpio + 14)) -#define GPLEV1 (* (volatile unsigned int *) (gpio + 14)) - -///////////////////////////////////////////////////////////////////// -// SPI Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned CS :2; - unsigned CPHA :1; - unsigned CPOL :1; - unsigned CLEAR :2; - unsigned CSPOL :1; - unsigned TA :1; - unsigned DMAEN :1; - unsigned INTD :1; - unsigned INTR :1; - unsigned ADCS :1; - unsigned REN :1; - unsigned LEN :1; - unsigned LMONO :1; - unsigned TE_EN :1; - unsigned DONE :1; - unsigned RXD :1; - unsigned TXD :1; - unsigned RXR :1; - unsigned RXF :1; - unsigned CSPOL0 :1; - unsigned CSPOL1 :1; - unsigned CSPOL2 :1; - unsigned DMA_LEN :1; - unsigned LEN_LONG :1; - unsigned :6; -}spi0csbits; -#define SPI0CSbits (* (volatile spi0csbits*) (spi + 0)) -#define SPI0CS (* (volatile unsigned int *) (spi + 0)) - -#define SPI0FIFO (* (volatile unsigned int *) (spi + 1)) -#define SPI0CLK (* (volatile unsigned int *) (spi + 2)) -#define SPI0DLEN (* (volatile unsigned int *) (spi + 3)) - -///////////////////////////////////////////////////////////////////// -// System Timer Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned M0 :1; - unsigned M1 :1; - unsigned M2 :1; - unsigned M3 :1; - unsigned :28; -}sys_timer_csbits; -#define SYS_TIMER_CSbits (*(volatile sys_timer_csbits*) (sys_timer + 0)) -#define SYS_TIMER_CS (* (volatile unsigned int*)(sys_timer + 0)) - -#define SYS_TIMER_CLO (* (volatile unsigned int*)(sys_timer + 1)) -#define SYS_TIMER_CHI (* (volatile unsigned int*)(sys_timer + 2)) -#define SYS_TIMER_C0 (* (volatile unsigned int*)(sys_timer + 3)) -#define SYS_TIMER_C1 (* (volatile unsigned int*)(sys_timer + 4)) -#define SYS_TIMER_C2 (* (volatile unsigned int*)(sys_timer + 5)) -#define SYS_TIMER_C3 (* (volatile unsigned int*)(sys_timer + 6)) - -///////////////////////////////////////////////////////////////////// -// ARM Interrupt Registers -///////////////////////////////////////////////////////////////////// - -#define IRQ_PENDING_BASIC (* (volatile unsigned int *) (arm_timer + 128)) -#define IRQ_PENDING1 (* (volatile unsigned int *) (arm_timer + 129)) -#define IRQ_PENDING2 (* (volatile unsigned int *) (arm_timer + 130)) - -#define IRQ_ENABLE1 (* (volatile unsigned int *) (arm_timer + 132)) -#define IRQ_ENABLE2 (* (volatile unsigned int *) (arm_timer + 133)) -#define IRQ_ENABLE_BASIC (* (volatile unsigned int *) (arm_timer + 134)) -#define IRQ_DISABLE1 (* (volatile unsigned int *) (arm_timer + 135)) -#define IRQ_DISABLE2 (* (volatile unsigned int *) (arm_timer + 136)) -#define IRQ_DISABLE_BASIC (* (volatile unsigned int *) (arm_timer + 137)) - -///////////////////////////////////////////////////////////////////// -// ARM Timer Registers -///////////////////////////////////////////////////////////////////// - -#define ARM_TIMER_LOAD (* (volatile unsigned int *) (arm_timer + 256)) -//TODO: make timer control struct -#define ARM_TIMER_CONTROL (* (volatile unsigned int *) (arm_timer + 258)) -#define ARM_TIMER_IRQCLR (* (volatile unsigned int*) (arm_timer + 259)) -#define ARM_TIMER_RAWIRQ (* (volatile unsigned int *) (arm_timer + 260)) -#define ARM_TIMER_RELOAD (* (volatile unsigned int *) (arm_timer + 262)) -#define ARM_TIMER_DIV (* (volatile unsigned int *) (arm_timer + 263)) - -///////////////////////////////////////////////////////////////////// -// UART Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned DATA : 8; - unsigned FE : 1; - unsigned PE : 1; - unsigned BE : 1; - unsigned OE : 1; - unsigned : 20; -} uart_drbits; -#define UART_DRbits (* (volatile uart_drbits*) (uart + 0)) -#define UART_DR (*(volatile unsigned int *) (uart + 0)) - -typedef struct -{ - unsigned int CTS : 1; - unsigned int DSR : 1; - unsigned int DCD : 1; - unsigned int BUSY : 1; - unsigned int RXFE : 1; - unsigned int TXFF : 1; - unsigned int RXFF : 1; - unsigned int TXFE : 1; - unsigned int RI : 1; - unsigned int : 24; -} uart_frbits; -#define UART_FRbits (*(volatile uart_frbits*) (uart + 6)) -#define UART_FR (*(volatile unsigned int *) (uart + 6)) - -typedef struct -{ - unsigned int IBRD : 16; - unsigned int : 16; -} uart_ibrdbits; -#define UART_IBRDbits (*(volatile uart_ibrdbits*) (uart + 9)) -#define UART_IBRD (*(volatile unsigned int *) (uart + 9)) - -typedef struct -{ - unsigned int FBRD : 6; - unsigned int : 26; -} uart_fbrdbits; -#define UART_FBRDbits (*(volatile uart_fbrdbits*) (uart + 10)) -#define UART_FBRD (*(volatile unsigned int *) (uart + 10)) - -typedef struct -{ - unsigned int BRK : 1; - unsigned int PEN : 1; - unsigned int EPS : 1; - unsigned int STP2 : 1; - unsigned int FEN : 1; - unsigned int WLEN : 2; - unsigned int SPS : 1; - unsigned int : 24; -} uart_lcrhbits; -#define UART_LCRHbits (* (volatile uart_lcrhbits*) (uart + 11)) -#define UART_LCRH (*(volatile unsigned int *) (uart + 11)) - -typedef struct -{ - unsigned int UARTEN : 1; - unsigned int SIREN : 1; - unsigned int SIRLP : 1; - unsigned int : 4; - unsigned int LBE : 1; - unsigned int TXE : 1; - unsigned int RXE : 1; - unsigned int DTR : 1; - unsigned int RTS : 1; - unsigned int OUT1 : 1; - unsigned int OUT2 : 1; - unsigned int RTSEN : 1; - unsigned int CTSEN : 1; - unsigned int : 16; -} uart_crbits; -#define UART_CRbits (* (volatile uart_crbits*) (uart + 12)) -#define UART_CR (*(volatile unsigned int *) (uart + 12)) - - -typedef struct -{ - unsigned int RIRMIS : 1; - unsigned int CTSRMIS : 1; - unsigned int DCDRMIS : 1; - unsigned int DSRRMIS : 1; - unsigned int RXRIS : 1; - unsigned int TXRIS : 1; - unsigned int RTRIS : 1; - unsigned int FERIS : 1; - unsigned int PERIS : 1; - unsigned int BERIS : 1; - unsigned int OERIS : 1; - unsigned int : 21; -} uart_risbits; -#define UART_RISbits (* (volatile uart_risbits*) (uart + 15)) -#define UART_RIS (*(volatile unsigned int *) (uart + 15)) - -///////////////////////////////////////////////////////////////////// -// PWM Registers -///////////////////////////////////////////////////////////////////// -typedef struct -{ - unsigned PWEN1 :1; - unsigned MODE1 :1; - unsigned RPTL1 :1; - unsigned SBIT1 :1; - unsigned POLA1 :1; - unsigned USEF1 :1; - unsigned CLRF1 :1; - unsigned MSEN1 :1; - unsigned PWEN2 :1; - unsigned MODE2 :1; - unsigned RPTL2 :1; - unsigned SBIT2 :1; - unsigned POLA2 :1; - unsigned USEF2 :1; - unsigned :1; - unsigned MSEN2 :1; - unsigned :16; -} pwm_ctlbits; -#define PWM_CTLbits (* (volatile pwm_ctlbits *) (pwm + 0)) -#define PWM_CTL (*(volatile unsigned int *) (pwm + 0)) - -#define PWM_RNG1 (*(volatile unsigned int *) (pwm + 4)) -#define PWM_DAT1 (*(volatile unsigned int *)(pwm + 5)) - -///////////////////////////////////////////////////////////////////// -// Clock Manager Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned SRC :4; - unsigned ENAB :1; - unsigned KILL :1; - unsigned :1; - unsigned BUSY :1; - unsigned FLIP :1; - unsigned MASH :2; - unsigned :13; - unsigned PASSWD :8; -}cm_pwmctl_bits; -#define CM_PWMCTLbits (* (volatile cm_pwmctl_bits *) (cm_pwm + 40)) -#define CM_PWMCTL (* (volatile unsigned int*) (cm_pwm + 40)) - -typedef struct -{ - unsigned DIVF :12; - unsigned DIVI :12; - unsigned PASSWD :8; -} cm_pwmdivbits; -#define CM_PWMDIVbits (* (volatile cm_pwmdivbits *) (cm_pwm + 41)) -#define CM_PWMDIV (*(volatile unsigned int *)(cm_pwm + 41)) - -///////////////////////////////////////////////////////////////////// -// Interrupt Functions -///////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////// -// GPIO Functions -///////////////////////////////////////////////////////////////////// -#define HIGH 1 -#define LOW 0 - -extern void pioInit(); - -extern void noInterrupts(void); -extern void interrupts(void); - -extern void pinMode(int pin, int function); -extern void digitalWrite(int pin, int val); - -extern int digitalRead(int pin); -extern void pinsMode(int pins[], int numPins, int fxn); -extern void digitalWrites(int pins[], int numPins, int val); -extern int digitalReads(int pins[], int numPins); -extern void delay_us(unsigned int micros); -extern void delay_ms(unsigned int millis); - -///////////////////////////////////////////////////////////////////// -// SPI Functions -///////////////////////////////////////////////////////////////////// -extern void spiInit(int freq, int settings); -extern char spiSendReceive(char send); -extern short spiSendReceive16(short send) ; - -///////////////////////////////////////////////////////////////////// -// UART Functions -///////////////////////////////////////////////////////////////////// - -extern void uartInit(int baud); - -extern char getCharSerial(void); - - -extern void putCharSerial(char c); - -extern void pwmInit(); -extern void setPWM(float freq, float dut); - -extern void analogWrite(int val); -extern unsigned long get_microsecond_timestamp(); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ov2640_regs.h b/Multi_Camera_Adapter_SPI_Camera/src/ov2640_regs.h deleted file mode 100644 index 4acb4f4..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ov2640_regs.h +++ /dev/null @@ -1,859 +0,0 @@ -#ifndef OV2640_REGS_H -#define OV2640_REGS_H -#include "ArduCAM.h" -#define OV2640_CHIPID_HIGH 0x0A -#define OV2640_CHIPID_LOW 0x0B -const struct sensor_reg OV2640_QVGA[] = -{ - {0xff, 0x0}, - {0x2c, 0xff}, - {0x2e, 0xdf}, - {0xff, 0x1}, - {0x3c, 0x32}, - {0x11, 0x0}, - {0x9, 0x2}, - {0x4, 0xa8}, - {0x13, 0xe5}, - {0x14, 0x48}, - {0x2c, 0xc}, - {0x33, 0x78}, - {0x3a, 0x33}, - {0x3b, 0xfb}, - {0x3e, 0x0}, - {0x43, 0x11}, - {0x16, 0x10}, - {0x39, 0x2}, - {0x35, 0x88}, - - {0x22, 0xa}, - {0x37, 0x40}, - {0x23, 0x0}, - {0x34, 0xa0}, - {0x6, 0x2}, - {0x6, 0x88}, - {0x7, 0xc0}, - {0xd, 0xb7}, - {0xe, 0x1}, - {0x4c, 0x0}, - {0x4a, 0x81}, - {0x21, 0x99}, - {0x24, 0x40}, - {0x25, 0x38}, - {0x26, 0x82}, - {0x5c, 0x0}, - {0x63, 0x0}, - {0x46, 0x22}, - {0xc, 0x3a}, - {0x5d, 0x55}, - {0x5e, 0x7d}, - {0x5f, 0x7d}, - {0x60, 0x55}, - {0x61, 0x70}, - {0x62, 0x80}, - {0x7c, 0x5}, - {0x20, 0x80}, - {0x28, 0x30}, - {0x6c, 0x0}, - {0x6d, 0x80}, - {0x6e, 0x0}, - {0x70, 0x2}, - {0x71, 0x94}, - {0x73, 0xc1}, - {0x3d, 0x34}, - {0x12, 0x4}, - {0x5a, 0x57}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0xff, 0x0}, - {0xe5, 0x7f}, - {0xf9, 0xc0}, - {0x41, 0x24}, - {0xe0, 0x14}, - {0x76, 0xff}, - {0x33, 0xa0}, - {0x42, 0x20}, - {0x43, 0x18}, - {0x4c, 0x0}, - {0x87, 0xd0}, - {0x88, 0x3f}, - {0xd7, 0x3}, - {0xd9, 0x10}, - {0xd3, 0x82}, - {0xc8, 0x8}, - {0xc9, 0x80}, - {0x7c, 0x0}, - {0x7d, 0x0}, - {0x7c, 0x3}, - {0x7d, 0x48}, - {0x7d, 0x48}, - {0x7c, 0x8}, - {0x7d, 0x20}, - {0x7d, 0x10}, - {0x7d, 0xe}, - {0x90, 0x0}, - {0x91, 0xe}, - {0x91, 0x1a}, - {0x91, 0x31}, - {0x91, 0x5a}, - {0x91, 0x69}, - {0x91, 0x75}, - {0x91, 0x7e}, - {0x91, 0x88}, - {0x91, 0x8f}, - {0x91, 0x96}, - {0x91, 0xa3}, - {0x91, 0xaf}, - {0x91, 0xc4}, - {0x91, 0xd7}, - {0x91, 0xe8}, - {0x91, 0x20}, - {0x92, 0x0}, - - {0x93, 0x6}, - {0x93, 0xe3}, - {0x93, 0x3}, - {0x93, 0x3}, - {0x93, 0x0}, - {0x93, 0x2}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x96, 0x0}, - {0x97, 0x8}, - {0x97, 0x19}, - {0x97, 0x2}, - {0x97, 0xc}, - {0x97, 0x24}, - {0x97, 0x30}, - {0x97, 0x28}, - {0x97, 0x26}, - {0x97, 0x2}, - {0x97, 0x98}, - {0x97, 0x80}, - {0x97, 0x0}, - {0x97, 0x0}, - {0xa4, 0x0}, - {0xa8, 0x0}, - {0xc5, 0x11}, - {0xc6, 0x51}, - {0xbf, 0x80}, - {0xc7, 0x10}, - {0xb6, 0x66}, - {0xb8, 0xa5}, - {0xb7, 0x64}, - {0xb9, 0x7c}, - {0xb3, 0xaf}, - {0xb4, 0x97}, - {0xb5, 0xff}, - {0xb0, 0xc5}, - {0xb1, 0x94}, - {0xb2, 0xf}, - {0xc4, 0x5c}, - {0xa6, 0x0}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x1b}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x19}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x19}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0x7f, 0x0}, - {0xe5, 0x1f}, - {0xe1, 0x77}, - {0xdd, 0x7f}, - {0xc2, 0xe}, - - {0xff, 0x0}, - {0xe0, 0x4}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x0}, - {0x54, 0x0}, - {0x55, 0x88}, - {0x57, 0x0}, - - {0x50, 0x92}, - {0x5a, 0x50}, - {0x5b, 0x3c}, - {0x5c, 0x0}, - {0xd3, 0x4}, - {0xe0, 0x0}, - - {0xff, 0x0}, - {0x5, 0x0}, - - {0xda, 0x8}, - {0xd7, 0x3}, - {0xe0, 0x0}, - - {0x5, 0x0}, - - - {0xff,0xff}, -}; - -const struct sensor_reg OV2640_JPEG_INIT[] = -{ - { 0xff, 0x00 }, - { 0x2c, 0xff }, - { 0x2e, 0xdf }, - { 0xff, 0x01 }, - { 0x3c, 0x32 }, - { 0x11, 0x00 }, - { 0x09, 0x02 }, - { 0x04, 0x28 }, - { 0x13, 0xe5 }, - { 0x14, 0x48 }, - { 0x2c, 0x0c }, - { 0x33, 0x78 }, - { 0x3a, 0x33 }, - { 0x3b, 0xfB }, - { 0x3e, 0x00 }, - { 0x43, 0x11 }, - { 0x16, 0x10 }, - { 0x39, 0x92 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0x48, 0x00 }, - { 0x5B, 0x00 }, - { 0x42, 0x03 }, - { 0x4a, 0x81 }, - { 0x21, 0x99 }, - { 0x24, 0x40 }, - { 0x25, 0x38 }, - { 0x26, 0x82 }, - { 0x5c, 0x00 }, - { 0x63, 0x00 }, - { 0x61, 0x70 }, - { 0x62, 0x80 }, - { 0x7c, 0x05 }, - { 0x20, 0x80 }, - { 0x28, 0x30 }, - { 0x6c, 0x00 }, - { 0x6d, 0x80 }, - { 0x6e, 0x00 }, - { 0x70, 0x02 }, - { 0x71, 0x94 }, - { 0x73, 0xc1 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x37, 0xc0 }, - { 0x4f, 0x60 }, - { 0x50, 0xa8 }, - { 0x6d, 0x00 }, - { 0x3d, 0x38 }, - { 0x46, 0x3f }, - { 0x4f, 0x60 }, - { 0x0c, 0x3c }, - { 0xff, 0x00 }, - { 0xe5, 0x7f }, - { 0xf9, 0xc0 }, - { 0x41, 0x24 }, - { 0xe0, 0x14 }, - { 0x76, 0xff }, - { 0x33, 0xa0 }, - { 0x42, 0x20 }, - { 0x43, 0x18 }, - { 0x4c, 0x00 }, - { 0x87, 0xd5 }, - { 0x88, 0x3f }, - { 0xd7, 0x03 }, - { 0xd9, 0x10 }, - { 0xd3, 0x82 }, - { 0xc8, 0x08 }, - { 0xc9, 0x80 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7c, 0x03 }, - { 0x7d, 0x48 }, - { 0x7d, 0x48 }, - { 0x7c, 0x08 }, - { 0x7d, 0x20 }, - { 0x7d, 0x10 }, - { 0x7d, 0x0e }, - { 0x90, 0x00 }, - { 0x91, 0x0e }, - { 0x91, 0x1a }, - { 0x91, 0x31 }, - { 0x91, 0x5a }, - { 0x91, 0x69 }, - { 0x91, 0x75 }, - { 0x91, 0x7e }, - { 0x91, 0x88 }, - { 0x91, 0x8f }, - { 0x91, 0x96 }, - { 0x91, 0xa3 }, - { 0x91, 0xaf }, - { 0x91, 0xc4 }, - { 0x91, 0xd7 }, - { 0x91, 0xe8 }, - { 0x91, 0x20 }, - { 0x92, 0x00 }, - { 0x93, 0x06 }, - { 0x93, 0xe3 }, - { 0x93, 0x05 }, - { 0x93, 0x05 }, - { 0x93, 0x00 }, - { 0x93, 0x04 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x96, 0x00 }, - { 0x97, 0x08 }, - { 0x97, 0x19 }, - { 0x97, 0x02 }, - { 0x97, 0x0c }, - { 0x97, 0x24 }, - { 0x97, 0x30 }, - { 0x97, 0x28 }, - { 0x97, 0x26 }, - { 0x97, 0x02 }, - { 0x97, 0x98 }, - { 0x97, 0x80 }, - { 0x97, 0x00 }, - { 0x97, 0x00 }, - { 0xc3, 0xed }, - { 0xa4, 0x00 }, - { 0xa8, 0x00 }, - { 0xc5, 0x11 }, - { 0xc6, 0x51 }, - { 0xbf, 0x80 }, - { 0xc7, 0x10 }, - { 0xb6, 0x66 }, - { 0xb8, 0xA5 }, - { 0xb7, 0x64 }, - { 0xb9, 0x7C }, - { 0xb3, 0xaf }, - { 0xb4, 0x97 }, - { 0xb5, 0xFF }, - { 0xb0, 0xC5 }, - { 0xb1, 0x94 }, - { 0xb2, 0x0f }, - { 0xc4, 0x5c }, - { 0xc0, 0x64 }, - { 0xc1, 0x4B }, - { 0x8c, 0x00 }, - { 0x86, 0x3D }, - { 0x50, 0x00 }, - { 0x51, 0xC8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x5a, 0xC8 }, - { 0x5b, 0x96 }, - { 0x5c, 0x00 }, - { 0xd3, 0x00 }, //{ 0xd3, 0x7f }, - { 0xc3, 0xed }, - { 0x7f, 0x00 }, - { 0xda, 0x00 }, - { 0xe5, 0x1f }, - { 0xe1, 0x67 }, - { 0xe0, 0x00 }, - { 0xdd, 0x7f }, - { 0x05, 0x00 }, - - { 0x12, 0x40 }, - { 0xd3, 0x04 }, //{ 0xd3, 0x7f }, - { 0xc0, 0x16 }, - { 0xC1, 0x12 }, - { 0x8c, 0x00 }, - { 0x86, 0x3d }, - { 0x50, 0x00 }, - { 0x51, 0x2C }, - { 0x52, 0x24 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x5A, 0x2c }, - { 0x5b, 0x24 }, - { 0x5c, 0x00 }, - { 0xff, 0xff }, -}; - -const struct sensor_reg OV2640_YUV422[] = -{ - { 0xFF, 0x00 }, - { 0x05, 0x00 }, - { 0xDA, 0x10 }, - { 0xD7, 0x03 }, - { 0xDF, 0x00 }, - { 0x33, 0x80 }, - { 0x3C, 0x40 }, - { 0xe1, 0x77 }, - { 0x00, 0x00 }, - { 0xff, 0xff }, -}; - -const struct sensor_reg OV2640_JPEG[] = -{ - { 0xe0, 0x14 }, - { 0xe1, 0x77 }, - { 0xe5, 0x1f }, - { 0xd7, 0x03 }, - { 0xda, 0x10 }, - { 0xe0, 0x00 }, - { 0xFF, 0x01 }, - { 0x04, 0x08 }, - { 0xff, 0xff }, -}; - -/* JPG 160x120 */ -const struct sensor_reg OV2640_160x120_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x92 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x28 }, - { 0x5b, 0x1e }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG, 0x176x144 */ - -const struct sensor_reg OV2640_176x144_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x92 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x2c }, - { 0x5b, 0x24 }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 320x240 */ - -const struct sensor_reg OV2640_320x240_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x89 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x50 }, - { 0x5b, 0x3c }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 352x288 */ - -const struct sensor_reg OV2640_352x288_JPEG[] = - -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x89 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x58 }, - { 0x5b, 0x48 }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 640x480 */ -const struct sensor_reg OV2640_640x480_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x89}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0xa0}, - {0x5b, 0x78}, - {0x5c, 0x00}, - {0xd3, 0x04}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - -/* JPG 800x600 */ -const struct sensor_reg OV2640_800x600_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x35}, - {0x50, 0x89}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0xc8}, - {0x5b, 0x96}, - {0x5c, 0x00}, - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - -/* JPG 1024x768 */ -const struct sensor_reg OV2640_1024x768_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xc0, 0xC8}, - {0xc1, 0x96}, - {0x8c, 0x00}, - {0x86, 0x3D}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2C}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x5a, 0x00}, - {0x5b, 0xC0}, - {0x5c, 0x01}, - {0xd3, 0x02}, - - - {0xff, 0xff}, -}; - - /* JPG 1280x1024 */ -const struct sensor_reg OV2640_1280x1024_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0x40}, - {0x5b, 0xf0}, - {0x5c, 0x01}, - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - - /* JPG 1600x1200 */ -const struct sensor_reg OV2640_1600x1200_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0x90}, - {0x5b, 0x2C}, - {0x5c, 0x05}, //bit2->1;bit[1:0]->1 - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; -#endif - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ov5640_regs.h b/Multi_Camera_Adapter_SPI_Camera/src/ov5640_regs.h deleted file mode 100644 index f8f1583..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ov5640_regs.h +++ /dev/null @@ -1,715 +0,0 @@ -#ifndef OV5640_REGS_H -#define OV5640_REGS_H -#include "ArduCAM.h" - -#define OV5640_CHIPID_HIGH 0x300a -#define OV5640_CHIPID_LOW 0x300b - -const struct sensor_reg OV5640YUV_Sensor_Dvp_Init[] = -{ - { 0x4740, 0x20 }, - - { 0x4050, 0x6e }, - { 0x4051, 0x8f }, - - { 0x3008, 0x42 }, - { 0x3103, 0x03 }, - { 0x3017, 0x7f }, - { 0x3018, 0xff }, - { 0x302c, 0x02 }, - { 0x3108, 0x01 }, - { 0x3630, 0x2e },//2e - { 0x3632, 0xe2 }, - { 0x3633, 0x23 },//23 - { 0x3621, 0xe0 }, - { 0x3704, 0xa0 }, - { 0x3703, 0x5a }, - { 0x3715, 0x78 }, - { 0x3717, 0x01 }, - { 0x370b, 0x60 }, - { 0x3705, 0x1a }, - { 0x3905, 0x02 }, - { 0x3906, 0x10 }, - { 0x3901, 0x0a }, - { 0x3731, 0x12 }, - { 0x3600, 0x08 }, - { 0x3601, 0x33 }, - { 0x302d, 0x60 }, - { 0x3620, 0x52 }, - { 0x371b, 0x20 }, - { 0x471c, 0x50 }, - - { 0x3a18, 0x00 }, - { 0x3a19, 0xf8 }, - - { 0x3635, 0x1c },//1c - { 0x3634, 0x40 }, - { 0x3622, 0x01 }, - - { 0x3c04, 0x28 }, - { 0x3c05, 0x98 }, - { 0x3c06, 0x00 }, - { 0x3c07, 0x08 }, - { 0x3c08, 0x00 }, - { 0x3c09, 0x1c }, - { 0x3c0a, 0x9c }, - { 0x3c0b, 0x40 }, - - { 0x3820, 0x41 }, - { 0x3821, 0x01 }, //07 - - //windows setup - { 0x3800, 0x00 }, - { 0x3801, 0x00 }, - { 0x3802, 0x00 }, - { 0x3803, 0x04 }, - { 0x3804, 0x0a }, - { 0x3805, 0x3f }, - { 0x3806, 0x07 }, - { 0x3807, 0x9b }, - { 0x3808, 0x05 }, - { 0x3809, 0x00 }, - { 0x380a, 0x03 }, - { 0x380b, 0xc0 }, - { 0x3810, 0x00 }, - { 0x3811, 0x10 }, - { 0x3812, 0x00 }, - { 0x3813, 0x06 }, - { 0x3814, 0x31 }, - { 0x3815, 0x31 }, - - { 0x3034, 0x1a }, - { 0x3035, 0x21 }, //15fps - { 0x3036, 0x46 }, - { 0x3037, 0x13 }, - { 0x3038, 0x00 }, - { 0x3039, 0x00 }, - - { 0x380c, 0x07 }, - { 0x380d, 0x68 }, - { 0x380e, 0x03 }, //03 - { 0x380f, 0xd8 }, //d8 - - { 0x3c01, 0xb4 }, - { 0x3c00, 0x04 }, - { 0x3a08, 0x00 }, - { 0x3a09, 0x93 }, - { 0x3a0e, 0x06 }, - { 0x3a0a, 0x00 }, - { 0x3a0b, 0x7b }, - { 0x3a0d, 0x08 }, - - { 0x3a00, 0x3c }, //15fps-10fps - { 0x3a02, 0x05 }, - { 0x3a03, 0xc4 }, - { 0x3a14, 0x05 }, - { 0x3a15, 0xc4 }, - - { 0x3618, 0x00 }, - { 0x3612, 0x29 }, - { 0x3708, 0x64 }, - { 0x3709, 0x52 }, - { 0x370c, 0x03 }, - - { 0x4001, 0x02 }, - { 0x4004, 0x02 }, - { 0x3000, 0x00 }, - { 0x3002, 0x1c }, - { 0x3004, 0xff }, - { 0x3006, 0xc3 }, - { 0x300e, 0x58 }, - { 0x302e, 0x00 }, - { 0x4300, 0x30 }, - { 0x501f, 0x00 }, - { 0x4713, 0x03 }, - { 0x4407, 0x04 }, - { 0x460b, 0x35 }, - { 0x460c, 0x22 },//add by bright - { 0x3824, 0x01 },//add by bright - { 0x5001, 0xa3 }, - - { 0x3406, 0x01 },//awbinit - { 0x3400, 0x06 }, - { 0x3401, 0x80 }, - { 0x3402, 0x04 }, - { 0x3403, 0x00 }, - { 0x3404, 0x06 }, - { 0x3405, 0x00 }, - //awb - { 0x5180, 0xff }, - { 0x5181, 0xf2 }, - { 0x5182, 0x00 }, - { 0x5183, 0x14 }, - { 0x5184, 0x25 }, - { 0x5185, 0x24 }, - { 0x5186, 0x16 }, - { 0x5187, 0x16 }, - { 0x5188, 0x16 }, - { 0x5189, 0x62 }, - { 0x518a, 0x62 }, - { 0x518b, 0xf0 }, - { 0x518c, 0xb2 }, - { 0x518d, 0x50 }, - { 0x518e, 0x30 }, - { 0x518f, 0x30 }, - { 0x5190, 0x50 }, - { 0x5191, 0xf8 }, - { 0x5192, 0x04 }, - { 0x5193, 0x70 }, - { 0x5194, 0xf0 }, - { 0x5195, 0xf0 }, - { 0x5196, 0x03 }, - { 0x5197, 0x01 }, - { 0x5198, 0x04 }, - { 0x5199, 0x12 }, - { 0x519a, 0x04 }, - { 0x519b, 0x00 }, - { 0x519c, 0x06 }, - { 0x519d, 0x82 }, - { 0x519e, 0x38 }, - //color matrix - { 0x5381, 0x1e }, - { 0x5382, 0x5b }, - { 0x5383, 0x14 }, - { 0x5384, 0x06 }, - { 0x5385, 0x82 }, - { 0x5386, 0x88 }, - { 0x5387, 0x7c }, - { 0x5388, 0x60 }, - { 0x5389, 0x1c }, - { 0x538a, 0x01 }, - { 0x538b, 0x98 }, - //sharp&noise - { 0x5300, 0x08 }, - { 0x5301, 0x30 }, - { 0x5302, 0x3f }, - { 0x5303, 0x10 }, - { 0x5304, 0x08 }, - { 0x5305, 0x30 }, - { 0x5306, 0x18 }, - { 0x5307, 0x28 }, - { 0x5309, 0x08 }, - { 0x530a, 0x30 }, - { 0x530b, 0x04 }, - { 0x530c, 0x06 }, - //gamma - { 0x5480, 0x01 }, - { 0x5481, 0x06 }, - { 0x5482, 0x12 }, - { 0x5483, 0x24 }, - { 0x5484, 0x4a }, - { 0x5485, 0x58 }, - { 0x5486, 0x65 }, - { 0x5487, 0x72 }, - { 0x5488, 0x7d }, - { 0x5489, 0x88 }, - { 0x548a, 0x92 }, - { 0x548b, 0xa3 }, - { 0x548c, 0xb2 }, - { 0x548d, 0xc8 }, - { 0x548e, 0xdd }, - { 0x548f, 0xf0 }, - { 0x5490, 0x15 }, - //UV adjust - { 0x5580, 0x06 }, - { 0x5583, 0x40 }, - { 0x5584, 0x20 }, - { 0x5589, 0x10 }, - { 0x558a, 0x00 }, - { 0x558b, 0xf8 }, - //lens shading - { 0x5000, 0xa7 }, - { 0x5800, 0x20 }, - { 0x5801, 0x19 }, - { 0x5802, 0x17 }, - { 0x5803, 0x16 }, - { 0x5804, 0x18 }, - { 0x5805, 0x21 }, - { 0x5806, 0x0F }, - { 0x5807, 0x0A }, - { 0x5808, 0x07 }, - { 0x5809, 0x07 }, - { 0x580a, 0x0A }, - { 0x580b, 0x0C }, - { 0x580c, 0x0A }, - { 0x580d, 0x03 }, - { 0x580e, 0x01 }, - { 0x580f, 0x01 }, - { 0x5810, 0x03 }, - { 0x5811, 0x09 }, - { 0x5812, 0x0A }, - { 0x5813, 0x03 }, - { 0x5814, 0x01 }, - { 0x5815, 0x01 }, - { 0x5816, 0x03 }, - { 0x5817, 0x08 }, - { 0x5818, 0x10 }, - { 0x5819, 0x0A }, - { 0x581a, 0x06 }, - { 0x581b, 0x06 }, - { 0x581c, 0x08 }, - { 0x581d, 0x0E }, - { 0x581e, 0x22 }, - { 0x581f, 0x18 }, - { 0x5820, 0x13 }, - { 0x5821, 0x12 }, - { 0x5822, 0x16 }, - { 0x5823, 0x1E }, - { 0x5824, 0x64 }, - { 0x5825, 0x2A }, - { 0x5826, 0x2C }, - { 0x5827, 0x2A }, - { 0x5828, 0x46 }, - { 0x5829, 0x2A }, - { 0x582a, 0x26 }, - { 0x582b, 0x24 }, - { 0x582c, 0x26 }, - { 0x582d, 0x2A }, - { 0x582e, 0x28 }, - { 0x582f, 0x42 }, - { 0x5830, 0x40 }, - { 0x5831, 0x42 }, - { 0x5832, 0x08 }, - { 0x5833, 0x28 }, - { 0x5834, 0x26 }, - { 0x5835, 0x24 }, - { 0x5836, 0x26 }, - { 0x5837, 0x2A }, - { 0x5838, 0x44 }, - { 0x5839, 0x4A }, - { 0x583a, 0x2C }, - { 0x583b, 0x2a }, - { 0x583c, 0x46 }, - { 0x583d, 0xCE }, - - { 0x5688, 0x22 }, - { 0x5689, 0x22 }, - { 0x568a, 0x42 }, - { 0x568b, 0x24 }, - { 0x568c, 0x42 }, - { 0x568d, 0x24 }, - { 0x568e, 0x22 }, - { 0x568f, 0x22 }, - - { 0x5025, 0x00 }, - - { 0x3a0f, 0x30 }, - { 0x3a10, 0x28 }, - { 0x3a1b, 0x30 }, - { 0x3a1e, 0x28 }, - { 0x3a11, 0x61 }, - { 0x3a1f, 0x10 }, - - { 0x4005, 0x1a }, - { 0x3406, 0x00 },//awbinit - { 0x3503, 0x00 },//awbinit - { 0x3008, 0x02 }, - { 0xffff, 0xff }, -}; - - - -const struct sensor_reg ov5640_vga_preview[] = -{ - // YUV VGA 30fps, night mode 5fps - // Input Clock = 24Mhz, PCLK = 56MHz - { 0x3035, 0x11 }, // PLL - { 0x3036, 0x46 }, // PLL - { 0x3c07, 0x08 }, // light meter 1 threshold [7:0] - { 0x3820, 0x41 }, // Sensor flip off, ISP flip on - { 0x3821, 0x01 }, // Sensor mirror on, ISP mirror on, H binning on - { 0x3814, 0x31 }, // X INC - { 0x3815, 0x31 }, // Y INC - { 0x3800, 0x00 }, // HS - { 0x3801, 0x00 }, // HS - { 0x3802, 0x00 }, // VS - { 0x3803, 0x04 }, // VS - { 0x3804, 0x0a }, // HW (HE) - { 0x3805, 0x3f }, // HW (HE) - { 0x3806, 0x07 }, // VH (VE) - { 0x3807, 0x9b }, // VH (VE) - { 0x3808, 0x02 }, // DVPHO - { 0x3809, 0x80 }, // DVPHO - { 0x380a, 0x01 }, // DVPVO - { 0x380b, 0xe0 }, // DVPVO - { 0x380c, 0x07 }, // HTS - { 0x380d, 0x68 }, // HTS - { 0x380e, 0x03 }, // VTS - { 0x380f, 0xd8 }, // VTS - { 0x3813, 0x06 }, // Timing Voffset - { 0x3618, 0x00 }, - { 0x3612, 0x29 }, - { 0x3709, 0x52 }, - { 0x370c, 0x03 }, - { 0x3a02, 0x17 }, // 60Hz max exposure, night mode 5fps - { 0x3a03, 0x10 }, // 60Hz max exposure - // banding filters are calculated automatically in camera driver - //{ 0x3a08, 0x01 }, // B50 step - //{ 0x3a09, 0x27 }, // B50 step - //{ 0x3a0a, 0x00 }, // B60 step - //{ 0x3a0b, 0xf6 }, // B60 step - //{ 0x3a0e, 0x03 }, // 50Hz max band - //{ 0x3a0d, 0x04 }, // 60Hz max band - { 0x3a14, 0x17 }, // 50Hz max exposure, night mode 5fps - { 0x3a15, 0x10 }, // 50Hz max exposure - { 0x4004, 0x02 }, // BLC 2 lines - { 0x3002, 0x1c }, // reset JFIFO, SFIFO, JPEG - { 0x3006, 0xc3 }, // disable clock of JPEG2x, JPEG - { 0x4713, 0x03 }, // JPEG mode 3 - { 0x4407, 0x04 }, // Quantization scale - { 0x460b, 0x35 }, - { 0x460c, 0x22 }, - { 0x4837, 0x22 }, // DVP CLK divider - { 0x3824, 0x02 }, // DVP CLK divider - { 0x5001, 0xa3 }, // SDE on, scale on, UV average off, color matrix on, AWB on - { 0x3503, 0x00 }, // AEC/AGC on - -}; - -const struct sensor_reg OV5640_RGB_QVGA[] = -{ - {0x3008, 0x02}, - {0x3035, 0x41}, - {0x4740, 0x21}, - {0x4300, 0x61}, - {0x3808, 0x01}, - {0x3809, 0x40}, - {0x380a, 0x00}, - {0x380b, 0xf0}, - {0x501f, 0x01}, - {0xffff, 0xff}, -}; - -//2592x1944 QSXGA -const struct sensor_reg OV5640_JPEG_QSXGA[] = -{ - {0x3820 ,0x40}, - {0x3821 ,0x26}, - {0x3814 ,0x11}, - {0x3815 ,0x11}, - {0x3803 ,0x00}, - {0x3807 ,0x9f}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0b}, - {0x380d ,0x1c}, - {0x380e ,0x07}, - {0x380f ,0xb0}, - {0x3813 ,0x04}, - {0x3618 ,0x04}, - {0x3612 ,0x4b}, - {0x3708 ,0x64}, - {0x3709 ,0x12}, - {0x370c ,0x00}, - {0x3a02 ,0x07}, - {0x3a03 ,0xb0}, - {0x3a0e ,0x06}, - {0x3a0d ,0x08}, - {0x3a14 ,0x07}, - {0x3a15 ,0xb0}, - {0x4001 ,0x02}, - {0x4004 ,0x06}, - {0x3002 ,0x00}, - {0x3006 ,0xff}, - {0x3824 ,0x04}, - {0x5001 ,0x83}, - {0x3036 ,0x69}, - {0x3035 ,0x31}, - {0x4005 ,0x1A}, - {0xffff, 0xff}, -}; - -//5MP -const struct sensor_reg OV5640_5MP_JPEG[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0xA }, - {0x3809 ,0x20}, - {0x380a ,0x7 }, - {0x380b ,0x98}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//320x240 QVGA -const struct sensor_reg OV5640_QSXGA2QVGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xf0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//640x480 VGA -const struct sensor_reg OV5640_QSXGA2VGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x2 }, - {0x3809 ,0x80}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//800x480 WVGA -const struct sensor_reg OV5640_QSXGA2WVGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x3 }, - {0x3809 ,0x20}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x3810, 0x00}, - {0x3811, 0x10}, - {0x3812, 0x01}, - {0x3813, 0x48}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//352x288 CIF -const struct sensor_reg OV5640_QSXGA2CIF[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x1 }, - {0x3809 ,0x60}, - {0x380a ,0x1 }, - {0x380b ,0x20}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x3810, 0x00}, - {0x3811, 0x10}, - {0x3812, 0x00}, - {0x3813, 0x70}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//1280x960 SXGA -const struct sensor_reg OV5640_QSXGA2SXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x5 }, - {0x3809 ,0x0 }, - {0x380a ,0x3 }, - {0x380b ,0xc0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, - -}; - -//2048x1536 QXGA -const struct sensor_reg OV5640_QSXGA2QXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x8 }, - {0x3809 ,0x0 }, - {0x380a ,0x6 }, - {0x380b ,0x0 }, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - -//1600x1200 UXGA -const struct sensor_reg OV5640_QSXGA2UXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x6 }, - {0x3809 ,0x40}, - {0x380a ,0x4 }, - {0x380b ,0xb0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//1024x768 XGA -const struct sensor_reg OV5640_QSXGA2XGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x4 }, - {0x3809 ,0x0 }, - {0x380a ,0x3 }, - {0x380b ,0x0 }, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - -#endif - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/ov5642_regs.h b/Multi_Camera_Adapter_SPI_Camera/src/ov5642_regs.h deleted file mode 100644 index 3740efc..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/ov5642_regs.h +++ /dev/null @@ -1,2528 +0,0 @@ -#ifndef OV5642_REGS_H -#define OV5642_REGS_H -#include "ArduCAM.h" - -#define OV5642_CHIPID_HIGH 0x300a -#define OV5642_CHIPID_LOW 0x300b -const struct sensor_reg ov5642_RAW[] = -{ -{0x3103,0x03}, -{0x3008,0x82}, -{0x3017,0x7f}, -{0x3018,0xfc}, -{0x3810,0xc2}, -{0x3615,0xf0}, -{0x3000,0x00}, -{0x3001,0x00}, -{0x3002,0x00}, -{0x3003,0x00}, -{0x3011,0x08}, -{0x3010,0x30}, -{0x3604,0x60}, -{0x3622,0x08}, -{0x3621,0x17}, -{0x3709,0x00}, -{0x4000,0x21}, -{0x401d,0x02}, -{0x3600,0x54}, -{0x3605,0x04}, -{0x3606,0x3f}, -{0x3c01,0x80}, -{0x300d,0x21}, -{0x3623,0x22}, -{0x5000,0xcf}, -{0x5001,0xFF}, -{0x5020,0x04}, -{0x5181,0x79}, -{0x5182,0x00}, -{0x5185,0x22}, -{0x5197,0x01}, -{0x5500,0x0a}, -{0x5504,0x00}, -{0x5505,0x7f}, -{0x5080,0x08}, -{0x300e,0x18}, -{0x4610,0x00}, -{0x471d,0x05}, -{0x4708,0x06}, -{0x3710,0x10}, -{0x370d,0x06}, -{0x3632,0x41}, -{0x3702,0x40}, -{0x3620,0x37}, -{0x3631,0x01}, -{0x370c,0xa0}, -{0x3808,0x0a}, -{0x3809,0x20}, -{0x380a,0x07}, -{0x380b,0x98}, -{0x380c,0x0c}, -{0x380d,0x80}, -{0x380e,0x07}, -{0x380f,0xd0}, -{0x5000,0x06}, -{0x501f,0x03}, -{0x3503,0x07}, -{0x3501,0x73}, -{0x3502,0x80}, -{0x350b,0x00}, -{0x3818,0xc0}, -{0x3621,0x27}, -{0x3801,0x8a}, -{0x3a00,0x78}, -{0x3a1a,0x04}, -{0x3a13,0x30}, -{0x3a18,0x00}, -{0x3a19,0x7c}, -{0x3a08,0x12}, -{0x3a09,0xc0}, -{0x3a0a,0x0f}, -{0x3a0b,0xa0}, -{0x3004,0xff}, -{0x350c,0x07}, -{0x350d,0xd0}, -{0x3a0d,0x08}, -{0x3a0e,0x06}, -{0x3500,0x00}, -{0x3501,0x00}, -{0x3502,0x00}, -{0x350a,0x00}, -{0x350b,0x00}, -{0x3503,0x00}, -{0x3030,0x2b}, -{0x3a02,0x00}, -{0x3a03,0x7d}, -{0x3a04,0x00}, -{0x3a14,0x00}, -{0x3a15,0x7d}, -{0x3a16,0x00}, -{0x3a00,0x78}, -{0x3a08,0x09}, -{0x3a09,0x60}, -{0x3a0a,0x07}, -{0x3a0b,0xd0}, -{0x3a0d,0x10}, -{0x3a0e,0x0d}, -{0x3620,0x57}, -{0x3703,0x98}, -{0x3704,0x1c}, -{0x589b,0x00}, -{0x589a,0xc0}, -{0x3633,0x07}, -{0x3702,0x10}, -{0x3703,0xb2}, -{0x3704,0x18}, -{0x370b,0x40}, -{0x370d,0x02}, -{0x3620,0x52}, -{0x5000,0x06}, -{0x5001,0xff}, -{0x5005,0x00}, -{0x3818,0x80}, -{0x3621,0x17}, -{0x3801,0xb4}, -{0x3001,0x40}, -{0x3002,0x1c}, -{0x3810,0x00}, -{0x3818,0x00}, -{0x460c,0x20}, -{0x501f,0x03}, -{0x4300,0xf8}, - -{0xffff,0xff}, -}; - - - -const struct sensor_reg OV5642_1280x960_RAW[] = -{ -{0x3103,0x93}, -{0x3008,0x02}, -{0x3017,0x7f}, -{0x3018,0xf0}, -{0x3615,0xf0}, -{0x3000,0xF8}, -{0x3001,0x48}, -{0x3002,0x5c}, -{0x3003,0x02}, -{0x3005,0xB7}, -{0x3006,0x43}, -{0x3007,0x37}, -{0x300f,0x06}, -{0x3011,0x08}, -{0x3010,0x20}, -{0x3012,0x00}, -{0x460c,0x22}, -{0x3815,0x04}, -{0x370c,0xA0}, -{0x3602,0xFC}, -{0x3612,0xFF}, -{0x3634,0xC0}, -{0x3613,0x00}, -{0x3622,0x00}, -{0x3603,0x27}, -{0x4000,0x21}, -{0x401D,0x02}, -{0x3600,0x54}, -{0x3605,0x04}, -{0x3606,0x3F}, -{0x5020,0x04}, -{0x5197,0x01}, -{0x5001,0xFF}, -{0x5500,0x10}, -{0x5502,0x00}, -{0x5503,0x04}, -{0x5504,0x00}, -{0x5505,0x7F}, -{0x5080,0x08}, -{0x300E,0x18}, -{0x4610,0x00}, -{0x471D,0x05}, -{0x4708,0x06}, -{0x3710,0x10}, -{0x3632,0x41}, -{0x3631,0x01}, -{0x501F,0x03}, -{0x3604,0x40}, -{0x4300,0x00}, -{0x3824,0x11}, -{0x5000,0x4F}, -{0x3818,0xC1}, -{0x3705,0xDB}, -{0x370A,0x81}, -{0x3621,0xC7}, -{0x3800,0x03}, -{0x3801,0xE8}, -{0x3802,0x03}, -{0x3803,0xE8}, -{0x3804,0x38}, -{0x3805,0x00}, -{0x3806,0x03}, -{0x3807,0xC0}, -{0x3808,0x05}, -{0x3809,0x00}, -{0x380A,0x03}, -{0x380B,0xC0}, -{0x380C,0x0A}, -{0x380D,0xF0}, -{0x380E,0x03}, -{0x380F,0xE8}, -{0x3827,0x08}, -{0x3810,0xC0}, -{0x5683,0x00}, -{0x5686,0x03}, -{0x5687,0xC0}, -{0x3A1A,0x04}, -{0x3A13,0x30}, -{0x3004,0xDF}, -{0x350C,0x07}, -{0x350D,0xD0}, -{0x3500,0x35}, -{0x3501,0x00}, -{0x3502,0x00}, -{0x350A,0x00}, -{0x350B,0x00}, -{0x3503,0x00}, -{0x5682,0x05}, -{0x3A0F,0x78}, -{0x3A11,0xD0}, -{0x3A1B,0x7A}, -{0x3A1E,0x66}, -{0x3A1F,0x40}, -{0x3A10,0x68}, -{0x3030,0x0B}, -{0x3A01,0x04}, -{0x3A02,0x00}, -{0x3A03,0x78}, -{0x3A04,0x00}, -{0x3A05,0x30}, -{0x3A14,0x00}, -{0x3A15,0x64}, -{0x3A16,0x00}, -{0x3A17,0x89}, -{0x3A18,0x00}, -{0x3A19,0x70}, -{0x3A00,0x78}, -{0x3A08,0x12}, -{0x3A09,0xC0}, -{0x3A0A,0x0F}, -{0x3A0B,0xA0}, -{0x3A0D,0x04}, -{0x3A0E,0x03}, -{0x3C00,0x04}, -{0x3C01,0xB4}, -{0x5688,0xFD}, -{0x5689,0xDF}, -{0x568A,0xFE}, -{0x568B,0xEF}, -{0x568C,0xFE}, -{0x568D,0xEF}, -{0x568E,0xAA}, -{0x568F,0xAA}, -{0x589B,0x04}, -{0x589A,0xC5}, -{0x528A,0x00}, -{0x528B,0x02}, -{0x528C,0x08}, -{0x528D,0x10}, -{0x528E,0x20}, -{0x528F,0x28}, -{0x5290,0x30}, -{0x5292,0x00}, -{0x5293,0x00}, -{0x5294,0x00}, -{0x5295,0x02}, -{0x5296,0x00}, -{0x5297,0x08}, -{0x5298,0x00}, -{0x5299,0x10}, -{0x529A,0x00}, -{0x529B,0x20}, -{0x529C,0x00}, -{0x529D,0x28}, -{0x529E,0x00}, -{0x5282,0x00}, -{0x529F,0x30}, -{0x5300,0x00}, -{0x5302,0x00}, -{0x5303,0x7C}, -{0x530C,0x00}, -{0x530D,0x0C}, -{0x530E,0x20}, -{0x530F,0x80}, -{0x5310,0x20}, -{0x5311,0x80}, -{0x5308,0x20}, -{0x5309,0x40}, -{0x5304,0x00}, -{0x5305,0x30}, -{0x5306,0x00}, -{0x5307,0x80}, -{0x5314,0x08}, -{0x5315,0x20}, -{0x5319,0x30}, -{0x5316,0x10}, -{0x5317,0x08}, -{0x5318,0x02}, -{0x5380,0x01}, -{0x5381,0x20}, -{0x5382,0x00}, -{0x5383,0x4E}, -{0x5384,0x00}, -{0x5385,0x0F}, -{0x5386,0x00}, -{0x5387,0x00}, -{0x5388,0x01}, -{0x5389,0x15}, -{0x538A,0x00}, -{0x538B,0x31}, -{0x538C,0x00}, -{0x538D,0x00}, -{0x538E,0x00}, -{0x538F,0x0F}, -{0x5390,0x00}, -{0x5391,0xAB}, -{0x5392,0x00}, -{0x5393,0xA2}, -{0x5394,0x08}, -{0x5301,0x20}, -{0x5480,0x14}, -{0x5482,0x03}, -{0x5483,0x57}, -{0x5484,0x65}, -{0x5485,0x71}, -{0x5481,0x21}, -{0x5486,0x7D}, -{0x5487,0x87}, -{0x5488,0x91}, -{0x5489,0x9A}, -{0x548A,0xAA}, -{0x548B,0xB8}, -{0x548C,0xCD}, -{0x548D,0xDD}, -{0x548E,0xEA}, -{0x548F,0x10}, -{0x5490,0x05}, -{0x5491,0x00}, -{0x5492,0x04}, -{0x5493,0x20}, -{0x5494,0x03}, -{0x5495,0x60}, -{0x5496,0x02}, -{0x5497,0xB8}, -{0x5498,0x02}, -{0x5499,0x86}, -{0x549A,0x02}, -{0x549B,0x5B}, -{0x549C,0x02}, -{0x549D,0x3B}, -{0x549E,0x02}, -{0x549F,0x1C}, -{0x54A0,0x02}, -{0x54A1,0x04}, -{0x54A2,0x01}, -{0x54A3,0xED}, -{0x54A4,0x01}, -{0x54A5,0xC5}, -{0x54A6,0x01}, -{0x54A7,0xA5}, -{0x54A8,0x01}, -{0x54A9,0x6C}, -{0x54AA,0x01}, -{0x54AB,0x41}, -{0x54AC,0x01}, -{0x54AD,0x20}, -{0x54AE,0x00}, -{0x54AF,0x16}, -{0x3406,0x00}, -{0x5192,0x04}, -{0x5191,0xF8}, -{0x5193,0x70}, -{0x5194,0xF0}, -{0x5195,0xF0}, -{0x518D,0x3D}, -{0x518F,0x54}, -{0x518E,0x3D}, -{0x5190,0x54}, -{0x518B,0xC0}, -{0x518C,0xBD}, -{0x5187,0x18}, -{0x5188,0x18}, -{0x5189,0x6E}, -{0x518A,0x68}, -{0x5186,0x1C}, -{0x5181,0x50}, -{0x5182,0x11}, -{0x5183,0x14}, -{0x5184,0x25}, -{0x5185,0x24}, -{0x5025,0x82}, -{0x5583,0x40}, -{0x5584,0x40}, -{0x5580,0x02}, -{0x3633,0x07}, -{0x3702,0x10}, -{0x3703,0xB2}, -{0x3704,0x18}, -{0x370B,0x40}, -{0x370D,0x02}, -{0x3620,0x52}, - -{0xffff,0xff}, -}; - -const struct sensor_reg OV5642_1920x1080_RAW[] = -{ - -{0x3808,0x07}, -{0x3809,0x80}, -{0x380A,0x04}, -{0x380B,0x38}, -{0xffff,0xff}, -}; - -const struct sensor_reg OV5642_640x480_RAW[] = -{ - /* -{0x3800,0x03}, -{0x3801,0xE8}, -{0x3802,0x03}, -{0x3803,0xE8}, -{0x3804,0x38}, -{0x3805,0x00}, -{0x3806,0x03}, -{0x3807,0xC0}, -*/ -{0x3808,0x02}, -{0x3809,0x80}, -{0x380A,0x01}, -{0x380B,0xe0}, -{0xffff,0xff}, -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const struct sensor_reg ov5642_320x240[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xa8}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xF0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0x3801, 0xb0}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_640x480[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xa8}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x2 }, - {0x3809 ,0x80}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0x3801, 0xb0}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1280x960[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x5 }, - {0x3809 ,0x00}, - {0x380a ,0x3 }, - {0x380b ,0xC0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1600x1200[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x6 }, - {0x3809 ,0x40}, - {0x380a ,0x4 }, - {0x380b ,0xB0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1024x768[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x4 }, - {0x3809 ,0x0}, - {0x380a ,0x3 }, - {0x380b ,0x0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - - - -const struct sensor_reg ov5642_2048x1536[] = -{ - {0x3800 ,0x01}, - {0x3801 ,0xb0}, - {0x3802 ,0x00}, - {0x3803 ,0x0a}, - {0x3804 ,0x0a}, - {0x3805 ,0x20}, - {0x3806 ,0x07}, - {0x3807 ,0x98}, - - {0x3808 ,0x08}, - {0x3809 ,0x00}, - {0x380a ,0x06}, - {0x380b ,0x00}, - - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x3810 ,0xc2}, - {0x3815 ,0x44}, - {0x3818 ,0xa8}, - {0x3824 ,0x01}, - {0x3827 ,0x0a}, - {0x3a00 ,0x78}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x3a00 ,0x78}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x471c ,0x50}, - {0x5682 ,0x0a}, - {0x5683 ,0x20}, - {0x5686 ,0x07}, - {0x5687 ,0x98}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4300 ,0x32}, - {0x460b ,0x35}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x02}, - {0x4600 ,0x80}, - {0x4721 ,0x02}, - {0x471c ,0x40}, - {0x4408 ,0x00}, - {0x460c ,0x22}, - {0x3815 ,0x04}, - {0x3818 ,0xc8}, - {0x501f ,0x00}, - {0x5002 ,0xe0}, - {0x440a ,0x01}, - {0x4402 ,0x90}, - {0x3811 ,0xf0}, - {0x3818, 0xa8}, - {0x3621, 0x10}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_2592x1944[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0xA }, - {0x3809 ,0x20}, - {0x380a ,0x7 }, - {0x380b ,0x98}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_dvp_zoom8[] = -{ - - {0x3800 ,0x5 }, - {0x3801 ,0xf8}, - {0x3802 ,0x3 }, - {0x3803 ,0x5c}, - {0x3804 ,0x1 }, - {0x3805 ,0x44}, - {0x3806 ,0x0 }, - {0x3807 ,0xf0}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xf0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0x1 }, - {0x5683 ,0x44}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x0 }, - {0x5687 ,0xf3}, - /* - {0x381c ,0x21}, - {0x3524 ,0x0 }, - {0x3825 ,0x0 }, - {0x3826 ,0x0 }, - {0x3827 ,0x0 }, - {0x3010 ,0x70}, -*/ - - {0xffff, 0xff}, -}; - -const struct sensor_reg OV5642_QVGA_Preview[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x5c}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3005 ,0xff}, - {0x3006 ,0x43}, - {0x3007 ,0x37}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x460c ,0x22}, - {0x3815 ,0x04}, - {0x370c ,0xa0}, - {0x3602 ,0xfc}, - {0x3612 ,0xff}, - {0x3634 ,0xc0}, - {0x3613 ,0x00}, - {0x3605 ,0x7c}, - {0x3621 ,0x09}, - {0x3622 ,0x60}, - {0x3604 ,0x40}, - {0x3603 ,0xa7}, - {0x3603 ,0x27}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5001 ,0xff}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x3808 ,0x02}, - {0x3809 ,0x80}, - {0x380a ,0x01}, - {0x380b ,0xe0}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x4300 ,0x30}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3503 ,0x07}, - {0x3824 ,0x11}, - {0x3501 ,0x1e}, - {0x3502 ,0x80}, - {0x350b ,0x7f}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x03}, - {0x380f ,0xe8}, - {0x3a0d ,0x04}, - {0x3a0e ,0x03}, - {0x3818 ,0xc1}, - {0x3705 ,0xdb}, - {0x370a ,0x81}, - {0x3801 ,0x80}, - {0x3621 ,0x87}, - {0x3801 ,0x50}, - {0x3803 ,0x08}, - {0x3827 ,0x08}, - {0x3810 ,0x40}, - {0x3804 ,0x05}, - {0x3805 ,0x00}, - {0x5682 ,0x05}, - {0x5683 ,0x00}, - {0x3806 ,0x03}, - {0x3807 ,0xc0}, - {0x5686 ,0x03}, - {0x5687 ,0xbc}, - {0x3a00 ,0x78}, - {0x3a1a ,0x05}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x528a ,0x02}, - {0x528b ,0x04}, - {0x528c ,0x08}, - {0x528d ,0x08}, - {0x528e ,0x08}, - {0x528f ,0x10}, - {0x5290 ,0x10}, - {0x5292 ,0x00}, - {0x5293 ,0x02}, - {0x5294 ,0x00}, - {0x5295 ,0x02}, - {0x5296 ,0x00}, - {0x5297 ,0x02}, - {0x5298 ,0x00}, - {0x5299 ,0x02}, - {0x529a ,0x00}, - {0x529b ,0x02}, - {0x529c ,0x00}, - {0x529d ,0x02}, - {0x529e ,0x00}, - {0x529f ,0x02}, - {0x3030 ,0x0b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x5193 ,0x70}, - {0x589b ,0x04}, - {0x589a ,0xc5}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x04}, - {0x528a ,0x01}, - {0x528b ,0x04}, - {0x528c ,0x08}, - {0x528d ,0x10}, - {0x528e ,0x20}, - {0x528f ,0x28}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x01}, - {0x5294 ,0x00}, - {0x5295 ,0x04}, - {0x5296 ,0x00}, - {0x5297 ,0x08}, - {0x5298 ,0x00}, - {0x5299 ,0x10}, - {0x529a ,0x00}, - {0x529b ,0x20}, - {0x529c ,0x00}, - {0x529d ,0x28}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x0c}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x06}, - {0x5187 ,0x08}, - {0x5188 ,0x08}, - {0x5189 ,0x7c}, - {0x518a ,0x60}, - {0x518b ,0xb2}, - {0x518c ,0xb2}, - {0x518d ,0x44}, - {0x518e ,0x3d}, - {0x518f ,0x58}, - {0x5190 ,0x46}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x04}, - {0x5199 ,0x12}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0x82}, - {0x519e ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3808 ,0x01}, - {0x3809 ,0x40}, - {0x380a ,0x00}, - {0x380b ,0xf0}, - {0x3a00 ,0x78}, - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - - - - {0xffff,0xff}, -}; - -const struct sensor_reg OV5642_JPEG_Capture_QSXGA[] = -{ - // OV5642_ QSXGA _YUV7.5 fps - // 24 MHz input clock, 24Mhz pclk - // jpeg mode 7.5fps - - {0x3503 ,0x07}, //AEC Manual Mode Control - {0x3000 ,0x00}, //SYSTEM RESET00 - {0x3001 ,0x00}, //Reset for Individual Block - {0x3002 ,0x00}, //Reset for Individual Block - {0x3003 ,0x00}, //Reset for Individual Block - {0x3005 ,0xff}, //Clock Enable Control - {0x3006 ,0xff}, //Clock Enable Control - {0x3007 ,0x3f}, //Clock Enable Control - {0x350c ,0x07}, //AEC VTS Output high bits - {0x350d ,0xd0}, //AEC VTS Output low bits - {0x3602 ,0xe4}, //Analog Control Registers - {0x3612 ,0xac}, //Analog Control Registers - {0x3613 ,0x44}, //Analog Control Registers - {0x3621 ,0x27}, //Array Control 01 - {0x3622 ,0x08}, //Analog Control Registers - {0x3623 ,0x22}, //Analog Control Registers - {0x3604 ,0x60}, //Analog Control Registers - {0x3705 ,0xda}, //Analog Control Registers - {0x370a ,0x80}, //Analog Control Registers - {0x3801 ,0x8a}, //HS - {0x3803 ,0x0a}, //VS - {0x3804 ,0x0a}, //HW - {0x3805 ,0x20}, //HW - {0x3806 ,0x07}, //VH - {0x3807 ,0x98}, //VH - {0x3808 ,0x0a}, //DVPHO - {0x3809 ,0x20}, //DVPHO - {0x380a ,0x07}, //DVPVO - {0x380b ,0x98}, //DVPVO - {0x380c ,0x0c}, //HTS - {0x380d ,0x80}, //HTS - {0x380e ,0x07}, //VTS - {0x380f ,0xd0}, //VTS - {0x3810 ,0xc2}, - {0x3815 ,0x44}, - {0x3818 ,0xc8}, //Mirror NO, Compression enable - {0x3824 ,0x01}, //RSV - {0x3827 ,0x0a}, //RSV - {0x3a00 ,0x78}, //AEC System Control 0 - {0x3a0d ,0x10}, //60 Hz Max Bands in One Frame - {0x3a0e ,0x0d}, //50 Hz Max Bands in One Frame - {0x3a10 ,0x32}, //Stable Range Low Limit (enter) - {0x3a1b ,0x3c}, //Stable Range High Limit (go out) - {0x3a1e ,0x32}, //Stable Range Low Limit (go out) - {0x3a11 ,0x80}, //Step Manual Mode, Fast Zone High Limit - {0x3a1f ,0x20}, //Step Manual Mode, Fast Zone Low Limit - {0x3a00 ,0x78}, //AEC System Control 0 - {0x460b ,0x35}, //RSV VFIFO Control 0B - {0x471d ,0x00}, //DVP CONTROL 1D - {0x4713 ,0x03}, //COMPRESSION MODE SELECT mode3 - {0x471c ,0x50}, //RSV - {0x5682 ,0x0a}, //AVG X END - {0x5683 ,0x20}, //AVG X END - {0x5686 ,0x07}, //AVG Y END - {0x5687 ,0x98}, //AVG Y END - {0x5001 ,0x4f}, //ISP CONTROL 01, UV adjust/Line stretch/UV average/Color matrix/AWB enable - {0x589b ,0x00}, //RSV - {0x589a ,0xc0}, //RSV - {0x4407 ,0x08}, //COMPRESSION CTRL07 Bit[5:0]: Quantization scale 0x02 - {0x589b ,0x00}, //RSV - {0x589a ,0xc0}, //RSV - {0x3002 ,0x0c}, //Reset for Individual Block, Reset SFIFO/compression - {0x3002 ,0x00}, //Reset for Individual Block - {0x3503 ,0x00}, //AEC Manual Mode Control, Auto enable - //{0x3818, 0xa8}, - //{0x3621, 0x17}, - //{0x3801, 0xb0}, - {0x5025, 0x80}, - {0x3a0f, 0x48}, - {0x3a10, 0x40}, - {0x3a1b, 0x4a}, - {0x3a1e, 0x3e}, - {0x3a11, 0x70}, - {0x3a1f, 0x20}, - {0xffff, 0xff}, - -}; - - -const struct sensor_reg OV5642_1080P_Video_setting[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x00}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3030 ,0x0b}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x3604 ,0x60}, - {0x3622 ,0x60}, - {0x3621 ,0x09}, - {0x3709 ,0x00}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x300d ,0x22}, - {0x3623 ,0x22}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x370c ,0xa0}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x5687 ,0x94}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x5001 ,0xcf}, - {0x4300 ,0x30}, - {0x4300 ,0x30}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x03}, - {0x471c ,0x50}, - {0x4721 ,0x02}, - {0x4402 ,0x90}, - {0x460c ,0x22}, - {0x3815 ,0x44}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3818 ,0xc8}, - {0x3801 ,0x88}, - {0x3824 ,0x11}, - {0x3a00 ,0x78}, - {0x3a1a ,0x04}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x3030 ,0x0b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x4407 ,0x04}, - {0x5193 ,0x70}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x06}, - {0x3825 ,0xac}, - {0x3827 ,0x0c}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x06}, - {0x5187 ,0x08}, - {0x5188 ,0x08}, - {0x5189 ,0x7c}, - {0x518a ,0x60}, - {0x518b ,0xb2}, - {0x518c ,0xb2}, - {0x518d ,0x44}, - {0x518e ,0x3d}, - {0x518f ,0x58}, - {0x5190 ,0x46}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x04}, - {0x5199 ,0x12}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0x82}, - {0x519e ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3503 ,0x07}, - {0x3011 ,0x07}, - {0x350c ,0x04}, - {0x350d ,0x58}, - {0x3801 ,0x8a}, - {0x3803 ,0x0a}, - {0x3804 ,0x07}, - {0x3805 ,0x80}, - {0x3806 ,0x04}, - {0x3807 ,0x38}, - {0x3808 ,0x07}, - {0x3809 ,0x80}, - {0x380a ,0x04}, - {0x380b ,0x38}, - {0x380c ,0x09}, - {0x380d ,0xd6}, - {0x380e ,0x04}, - {0x380f ,0x58}, - {0x381c ,0x11}, - {0x381d ,0xba}, - {0x381e ,0x04}, - {0x381f ,0x48}, - {0x3820 ,0x04}, - {0x3821 ,0x18}, - {0x3a08 ,0x14}, - {0x3a09 ,0xe0}, - {0x3a0a ,0x11}, - {0x3a0b ,0x60}, - {0x3a0d ,0x04}, - {0x3a0e ,0x03}, - {0x5682 ,0x07}, - {0x5683 ,0x60}, - {0x5686 ,0x04}, - {0x5687 ,0x1c}, - {0x5001 ,0x7f}, - {0x3503 ,0x00}, - {0x3010 ,0x10}, - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - {0x3010, 0x00}, - {0x3818, 0xa8}, - {0x3621, 0x27}, - - {0xffff, 0xff}, -}; - -const struct sensor_reg OV5642_720P_Video_setting[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x00}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3030 ,0x2b}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x3604 ,0x60}, - {0x3622 ,0x60}, - {0x3621 ,0x09}, - {0x3709 ,0x00}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x300d ,0x22}, - {0x3623 ,0x22}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x370c ,0xa0}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x5687 ,0x94}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x5001 ,0xcf}, - {0x4300 ,0x30}, - {0x4300 ,0x30}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x03}, - {0x471c ,0x50}, - {0x4721 ,0x02}, - {0x4402 ,0x90}, - {0x460c ,0x22}, - {0x3815 ,0x44}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3818 ,0xc8}, - {0x3801 ,0x88}, - {0x3824 ,0x11}, - {0x3a00 ,0x78}, - {0x3a1a ,0x04}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x3030 ,0x2b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x4407 ,0x04}, - {0x5193 ,0x70}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x06}, - {0x3825 ,0xac}, - {0x3827 ,0x0c}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3503 ,0x07}, - {0x3011 ,0x08}, - {0x350c ,0x02}, - {0x350d ,0xe4}, - {0x3621 ,0xc9}, - {0x370a ,0x81}, - {0x3803 ,0x08}, - {0x3804 ,0x05}, - {0x3805 ,0x00}, - {0x3806 ,0x02}, - {0x3807 ,0xd0}, - {0x3808 ,0x05}, - {0x3809 ,0x00}, - {0x380a ,0x02}, - {0x380b ,0xd0}, - {0x380c ,0x08}, - {0x380d ,0x72}, - {0x380e ,0x02}, - {0x380f ,0xe4}, - {0x3810 ,0xc0}, - {0x3818 ,0xc9}, - {0x381c ,0x10}, - {0x381d ,0xa0}, - {0x381e ,0x05}, - {0x381f ,0xb0}, - {0x3820 ,0x00}, - {0x3821 ,0x00}, - {0x3824 ,0x11}, - {0x3a08 ,0x1b}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x17}, - {0x3a0b ,0x20}, - {0x3a0d ,0x02}, - {0x3a0e ,0x01}, - {0x401c ,0x04}, - {0x5682 ,0x05}, - {0x5683 ,0x00}, - {0x5686 ,0x02}, - {0x5687 ,0xcc}, - {0x5001 ,0x7f}, - {0x589b ,0x06}, - {0x589a ,0xc5}, - {0x3503 ,0x00}, - {0x3010 ,0x10}, - - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - {0x3818, 0xa8}, - {0x3621, 0x27}, - {0xffff, 0xff}, - -}; - -#endif - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.c b/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.c deleted file mode 100644 index 7ea6fe6..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.c +++ /dev/null @@ -1,139 +0,0 @@ -#ifdef __cplusplus -extern "C"{ -#endif -#include "sccb_bus.h" - -#define SCCB_SIC_H() digitalWrite(scl_port,HIGH) //SCL H -#define SCCB_SIC_L() digitalWrite(scl_port,LOW) //SCL H - -#define SCCB_SID_H() digitalWrite(sda_port,HIGH) //SDA H -#define SCCB_SID_L() digitalWrite(sda_port,LOW) //SDA H - - -#define SCCB_DATA_IN pinMode(sda_port, INPUT); -#define SCCB_DATA_OUT pinMode(sda_port, OUTPUT); - -#define SCCB_SID_STATE digitalRead(sda_port) - - -unsigned char I2C_TIM = 30; -void sccb_bus_init(void) -{ - pinMode(sda_port, OUTPUT); - pinMode(scl_port, OUTPUT); - digitalWrite(sda_port, HIGH); - digitalWrite(scl_port, HIGH); -} - -void sccb_bus_start(void) -{ - SCCB_SID_H(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); -} - -void sccb_bus_stop(void) -{ - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SID_H(); - delay_us(I2C_TIM); -} - -void sccb_bus_send_noack(void) -{ - SCCB_SID_H(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); -} - -void sccb_bus_send_ack(void) -{ - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); -} - -unsigned char sccb_bus_write_byte(unsigned char data) -{ - unsigned char i; - unsigned char tem; - for(i = 0; i < 8; i++) - { - if((data< 0; i--) - { - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - read = read << 1; - if(SCCB_SID_STATE) - { - read += 1; - } - SCCB_SIC_L(); - delay_us(I2C_TIM); - } - SCCB_DATA_OUT; - return read; -} -#ifdef __cplusplus -} -#endif - - diff --git a/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.h b/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.h deleted file mode 100644 index 0878bc1..0000000 --- a/Multi_Camera_Adapter_SPI_Camera/src/sccb_bus.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef _SCCB_BUS_H_ -#define _SCCB_BUS_H_ -#include "bcm283x_board_driver.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#define sda_port 2 -#define scl_port 3 - - -#define SCCB_SIC_H() digitalWrite(scl_port,HIGH) //SCL H -#define SCCB_SIC_L() digitalWrite(scl_port,LOW) //SCL H - -#define SCCB_SID_H() digitalWrite(sda_port,HIGH) //SDA H -#define SCCB_SID_L() digitalWrite(sda_port,LOW) //SDA H -#define SCCB_DATA_IN pinMode(sda_port, INPUT); -#define SCCB_DATA_OUT pinMode(sda_port, OUTPUT); - -#define SCCB_SID_STATE digitalRead(sda_port) - -void sccb_bus_init(void); -void sccb_bus_start(void); -void sccb_bus_stop(void); -void sccb_bus_send_noack(void); -void sccb_bus_send_ack(void); -unsigned char sccb_bus_write_byte(unsigned char data); -unsigned char sccb_bus_read_byte(void); - -extern unsigned char I2C_TIM; - -#ifdef __cplusplus -} -#endif -#endif /* _SCCB_BUS_H_ */ - -/******************* (C) COPYRIGHT 2015 WangBao *****END OF FILE****/ diff --git a/SPI_Camera/README.md b/SPI_Camera/README.md deleted file mode 100644 index 7af8292..0000000 --- a/SPI_Camera/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# RaspberryPi -## Arducam releases new Arducam Mini cameras drivers for Raspberry Pi platform. -- Optimized the speed of SPI and Improved image transmission speed -- Support for Arducam Mini 2MP/2MP Plus/5MP/5MP Plus -- Support for 4 cameras work together -- Support for transering image data through the wifi. -- It will continue to be updated ... -## Pins definition (BCM) -```Bash -//ArduCAM CS pins -#define CAM_CS1 17 -#define CAM_CS2 23 -#define CAM_CS3 22 -#define CAM_CS4 24 -``` -```Bash -//I2c pins -#define sda_port 2 -#define scl_port 3 -``` -```Bash -//SPI pins -//set 9 (MISO), 10 (MOSI), 11 (SCLK) alt fxn 0 (SPI0) -``` - -## Platform configuration (bcm283x_board_driver.h) -- These #define values are specific to the BCM2835, taken from "BCM2835 ARM Peripherals" -```Bash -#define BCM2835_PERI_BASE 0x20000000 -``` -- Updated to BCM2836 for Raspberry Pi 2.0 -```Bash -#define BCM2835_PERI_BASE 0x3F000000 -``` - -## Quickly start -```bash -sudo git clone https://github.com/ArduCAM/RaspberryPi.git -``` -```bash -cd RaspberryPi/SPI_Camera -``` -```bash -sudo make -``` -```bash -sudo ./run_Arducam_Demo -``` -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/data/image1.png) -## Getting and setting the APP -### Install the app from https://github.com/ArduCAM/RaspberryPi/blob/master/data/Arducam.apk -### Open the app and click the setting -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/data/app_image1.png) -### Congfigure the IP Address( you can run 'sudo ifconfig' to check your IP address) The Video port is 2002. -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/data/app_image2.png) -### Click the begin button to show the image the camera transfers. -![Alt text](https://github.com/ArduCAM/RaspberryPi/blob/master/data/app_image3.png) - - - - - - - - diff --git a/SPI_Camera/makefile b/SPI_Camera/makefile deleted file mode 100644 index 375e780..0000000 --- a/SPI_Camera/makefile +++ /dev/null @@ -1,27 +0,0 @@ -NAME=run_Arducam_Demo -CC=gcc -CFLAGS=-Wall -pthread -ODIR=obj -SDIR=src - -_DEPS=ArduCAM.h bcm283x_board_driver.h sccb_bus.h ov2640_regs.h ov5640_regs.h ov5642_regs.h -DEPS=$(patsubst %,$(SDIR)/%,$(_DEPS)) - -_OBJ=ArducamDemo.o ArduCAM.o bcm283x_board_driver.o sccb_bus.o -OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ)) - -$(ODIR)/%.o: src/%.c $(DEPS) - @mkdir -p $(@D) - $(CC) -c -o $@ $< $(CFLAGS) - -$(NAME): $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) - -.PHONY: run - -run: $(NAME) - sudo ./$(NAME) - -.PHONY: clean -clean: - rm $(NAME) $(ODIR)/*.o diff --git a/SPI_Camera/src/ArduCAM.c b/SPI_Camera/src/ArduCAM.c deleted file mode 100644 index 3dd254a..0000000 --- a/SPI_Camera/src/ArduCAM.c +++ /dev/null @@ -1,978 +0,0 @@ -#include "ArduCAM.h" -#include "sccb_bus.h" -#include "ov2640_regs.h" -#include "ov5642_regs.h" -#include "ov5640_regs.h" -unsigned char sensor_model = 0; -unsigned char sensor_addr = 0; -unsigned char m_fmt = JPEG; -unsigned int length = 0; - -void ArduCAM_Init(unsigned char model) -{ - switch (model) - { - case OV2640: - case OV9650: - case OV9655: - { - wrSensorReg8_8(0xff, 0x01); - wrSensorReg8_8(0x12, 0x80); - if(m_fmt == JPEG) - { - wrSensorRegs8_8(OV2640_JPEG_INIT); - wrSensorRegs8_8(OV2640_YUV422); - wrSensorRegs8_8(OV2640_JPEG); - wrSensorReg8_8(0xff, 0x01); - wrSensorReg8_8(0x15, 0x00); - wrSensorRegs8_8(OV2640_320x240_JPEG); - } - else - { - wrSensorRegs8_8(OV2640_QVGA); - } - break; - } - case OV5640: - { - if (m_fmt == JPEG) - { - wrSensorReg16_8(0x3103, 0x11); - wrSensorReg16_8(0x3008, 0x82); - wrSensorRegs16_8(OV5640YUV_Sensor_Dvp_Init); - wrSensorRegs16_8(OV5640_JPEG_QSXGA); - wrSensorRegs16_8(OV5640_QSXGA2QVGA); - wrSensorReg16_8(0x4407, 0x04); - - } - else - { - wrSensorReg16_8(0x3103, 0x11); - wrSensorReg16_8(0x3008, 0x82); - wrSensorRegs16_8(OV5640YUV_Sensor_Dvp_Init); - wrSensorRegs16_8(OV5640_RGB_QVGA); - } - break; - } - case OV5642: - { - wrSensorReg16_8(0x3008, 0x80); - wrSensorRegs16_8(OV5642_QVGA_Preview); - - if (m_fmt == JPEG) - { - printf("the format is JPEG\r\n"); - wrSensorRegs16_8(OV5642_JPEG_Capture_QSXGA); - wrSensorRegs16_8(ov5642_320x240); - wrSensorReg16_8(0x3818, 0xa8); - wrSensorReg16_8(0x3621, 0x10); - wrSensorReg16_8(0x3801, 0xb0); - wrSensorReg16_8(0x4407, 0x04); - - - } - else - { - unsigned char reg_val; - wrSensorReg16_8(0x4740, 0x21); - wrSensorReg16_8(0x501e, 0x2a); - wrSensorReg16_8(0x5002, 0xf8); - wrSensorReg16_8(0x501f, 0x01); - wrSensorReg16_8(0x4300, 0x61); - rdSensorReg16_8(0x3818, ®_val); - wrSensorReg16_8(0x3818, (reg_val | 0x60) & 0xff); - rdSensorReg16_8(0x3621, ®_val); - wrSensorReg16_8(0x3621, reg_val & 0xdf); - } - break; - } - default: - break; - } - if(model == OV2640 ) - OV2640_set_JPEG_size(OV2640_320x240); - if(model == OV5640 ||model == OV5642){ - if(model == OV5640) - OV5640_set_JPEG_size(OV5640_1600x1200); - - else{ - OV5642_set_JPEG_size(OV5642_320x240); - printf("set resolution OK\r\n"); - } - } - - -} - -void ArduCAM_CS_init(int CS1, int CS2, int CS3, int CS4) -{ - if(CS1> -1){ - pinMode(CS1, OUTPUT); - digitalWrite(CS1, HIGH); - } - if(CS2> -1){ - pinMode(CS2, OUTPUT); - digitalWrite(CS2, HIGH); - } - if(CS3> -1){ - pinMode(CS3, OUTPUT); - digitalWrite(CS3, HIGH); - } - if(CS4> -1){ - pinMode(CS4, OUTPUT); - digitalWrite(CS4, HIGH); - } - -} - -void CS_HIGH(int CS) -{ - delay_us(1); - digitalWrite(CS, HIGH); -} - -void CS_LOW(int CS) -{ - delay_us(1); - digitalWrite(CS, LOW); -} - -void set_format(unsigned char fmt) -{ - if (fmt == BMP) - m_fmt = BMP; - else if(fmt == RAW) - m_fmt = RAW; - else - m_fmt = JPEG; -} - -unsigned char bus_read(int address,int CS) -{ - unsigned char value; - CS_LOW(CS); - spiSendReceive(address); - value = spiSendReceive(0x00); - CS_HIGH(CS); - return value; -} - -unsigned char bus_write(int address,int value,int CS) -{ - CS_LOW(CS); - spiSendReceive(address); - spiSendReceive(value); - CS_HIGH(CS); - return 1; -} - -unsigned char read_reg(unsigned char addr,int CS) -{ - unsigned char readData; - readData = bus_read(addr & 0x7F, CS); - return readData; -} -void write_reg(unsigned char addr, unsigned char data, int CS) -{ - bus_write(addr | 0x80, data, CS); -} - -unsigned char read_fifo(int CS) -{ - unsigned char data; - data = bus_read(SINGLE_FIFO_READ, CS); - return data; -} -void set_fifo_burst() -{ - spiSendReceive(BURST_FIFO_READ); -} - - -void flush_fifo(int CS) -{ - write_reg(ARDUCHIP_FIFO, FIFO_CLEAR_MASK, CS); -} - -void start_capture(int CS) -{ - write_reg(ARDUCHIP_FIFO, FIFO_START_MASK, CS); -} - -void clear_fifo_flag(int CS ) -{ - write_reg(ARDUCHIP_FIFO, FIFO_CLEAR_MASK, CS); -} - -unsigned int read_fifo_length(int CS) -{ - unsigned int len1,len2,len3,len=0; - len1 = read_reg(FIFO_SIZE1, CS); - len2 = read_reg(FIFO_SIZE2, CS); - len3 = read_reg(FIFO_SIZE3, CS) & 0x7f; - len = ((len3 << 16) | (len2 << 8) | len1) & 0x07fffff; - return len; -} - -//Set corresponding bit -void set_bit(unsigned char addr, unsigned char bit, int CS) -{ - unsigned char temp; - temp = read_reg(addr, CS); - write_reg(addr, temp | bit, CS); -} -//Clear corresponding bit -void clear_bit(unsigned char addr, unsigned char bit, int CS) -{ - unsigned char temp; - temp = read_reg(addr, CS); - write_reg(addr, temp & (~bit), CS); -} - -//Get corresponding bit status -unsigned char get_bit(unsigned char addr, unsigned char bit, int CS) -{ - unsigned char temp; - temp = read_reg(addr, CS); - temp = temp & bit; - return temp; -} - -//Set ArduCAM working mode -//MCU2LCD_MODE: MCU writes the LCD screen GRAM -//CAM2LCD_MODE: Camera takes control of the LCD screen -//LCD2MCU_MODE: MCU read the LCD screen GRAM -void set_mode(unsigned char mode,int CS) -{ - switch (mode) - { - case MCU2LCD_MODE: - write_reg(ARDUCHIP_MODE, MCU2LCD_MODE, CS); - break; - case CAM2LCD_MODE: - write_reg(ARDUCHIP_MODE, CAM2LCD_MODE, CS); - break; - case LCD2MCU_MODE: - write_reg(ARDUCHIP_MODE, LCD2MCU_MODE, CS); - break; - default: - write_reg(ARDUCHIP_MODE, MCU2LCD_MODE, CS); - break; - } -} - - -void OV2640_set_JPEG_size(unsigned char size) -{ - switch(size) - { - case OV2640_160x120: - wrSensorRegs8_8(OV2640_160x120_JPEG); - break; - case OV2640_176x144: - wrSensorRegs8_8(OV2640_176x144_JPEG); - break; - case OV2640_320x240: - wrSensorRegs8_8(OV2640_320x240_JPEG); - break; - case OV2640_352x288: - wrSensorRegs8_8(OV2640_352x288_JPEG); - break; - case OV2640_640x480: - wrSensorRegs8_8(OV2640_640x480_JPEG); - break; - case OV2640_800x600: - wrSensorRegs8_8(OV2640_800x600_JPEG); - break; - case OV2640_1024x768: - wrSensorRegs8_8(OV2640_1024x768_JPEG); - break; - case OV2640_1280x1024: - wrSensorRegs8_8(OV2640_1280x1024_JPEG); - break; - case OV2640_1600x1200: - wrSensorRegs8_8(OV2640_1600x1200_JPEG); - break; - default: - wrSensorRegs8_8(OV2640_320x240_JPEG); - break; - } -} - -void OV5640_set_JPEG_size(unsigned char size) -{ - switch (size) - { - case OV5640_320x240: - wrSensorRegs16_8(OV5640_QSXGA2QVGA); - break; - case OV5640_352x288: - wrSensorRegs16_8(OV5640_QSXGA2CIF); - break; - case OV5640_640x480: - wrSensorRegs16_8(OV5640_QSXGA2VGA); - break; - case OV5640_800x480: - wrSensorRegs16_8(OV5640_QSXGA2WVGA); - break; - case OV5640_1024x768: - wrSensorRegs16_8(OV5640_QSXGA2XGA); - break; - case OV5640_1280x960: - wrSensorRegs16_8(OV5640_QSXGA2SXGA); - break; - case OV5640_1600x1200: - wrSensorRegs16_8(OV5640_QSXGA2UXGA); - break; - case OV5640_2048x1536: - wrSensorRegs16_8(OV5640_QSXGA2QXGA); - break; - case OV5640_2592x1944: - wrSensorRegs16_8(OV5640_JPEG_QSXGA); - break; - default: - //320x240 - wrSensorRegs16_8(OV5640_QSXGA2QVGA); - break; - } -} - -void OV5642_set_JPEG_size(unsigned char size) -{ - switch (size) - { - case OV5642_320x240: - wrSensorRegs16_8(ov5642_320x240); - break; - case OV5642_640x480: - wrSensorRegs16_8(ov5642_640x480); - break; - case OV5642_1024x768: - wrSensorRegs16_8(ov5642_1024x768); - break; - case OV5642_1280x960: - wrSensorRegs16_8(ov5642_1280x960); - break; - case OV5642_1600x1200: - wrSensorRegs16_8(ov5642_1600x1200); - break; - case OV5642_2048x1536: - wrSensorRegs16_8(ov5642_2048x1536); - break; - case OV5642_2592x1944: - wrSensorRegs16_8(ov5642_2592x1944); - break; - default: - wrSensorRegs16_8(ov5642_320x240); - break; - } -} - - - - -void OV5642_set_Color_Saturation(unsigned char Color_Saturation) - { - switch(Color_Saturation) - { - case Saturation4: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x80); - wrSensorReg16_8(0x5584 ,0x80); //80 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation3: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x70); - wrSensorReg16_8(0x5584 ,0x70); //70 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation2: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x60); - wrSensorReg16_8(0x5584 ,0x60); //60 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation1: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x50); - wrSensorReg16_8(0x5584 ,0x50); //50 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation0: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x40); - wrSensorReg16_8(0x5584 ,0x40); //40 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation_1: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x30); - wrSensorReg16_8(0x5584 ,0x30); //30 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation_2: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x20); - wrSensorReg16_8(0x5584 ,0x20);//20 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation_3: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x10); - wrSensorReg16_8(0x5584 ,0x10); //10 - wrSensorReg16_8(0x5580 ,0x02); - break; - case Saturation_4: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5583 ,0x00); //0 - wrSensorReg16_8(0x5584 ,0x00); //0 - wrSensorReg16_8(0x5580 ,0x02); - break; - } - } - - void OV5642_set_Brightness(unsigned char Brightness) - { - - switch(Brightness) - { - case Brightness4: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x40); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x00); - break; - case Brightness3: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x30); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x00); - break; - case Brightness2: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x20); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x00); - break; - case Brightness1: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x10); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x00); - break; - case Brightness0: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x00); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x00); - break; - case Brightness_1: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x10); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x08); - break; - case Brightness_2: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x20); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x08); - break; - case Brightness_3: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x30); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x08); - break; - case Brightness_4: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5589 ,0x40); - wrSensorReg16_8(0x5580 ,0x04); - wrSensorReg16_8(0x558a ,0x08); - break; - } - - } - - void OV5642_set_Special_effects(unsigned char Special_effect) - { - switch(Special_effect) - { - case Bluish: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x18); - wrSensorReg16_8(0x5585 ,0xa0); - wrSensorReg16_8(0x5586 ,0x40); - break; - case Greenish: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x18); - wrSensorReg16_8(0x5585 ,0x60); - wrSensorReg16_8(0x5586 ,0x60); - break; - case Reddish: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x18); - wrSensorReg16_8(0x5585 ,0x80); - wrSensorReg16_8(0x5586 ,0xc0); - break; - case BW: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x18); - wrSensorReg16_8(0x5585 ,0x80); - wrSensorReg16_8(0x5586 ,0x80); - break; - case Negative: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x40); - break; - - case Sepia: - wrSensorReg16_8(0x5001 ,0xff); - wrSensorReg16_8(0x5580 ,0x18); - wrSensorReg16_8(0x5585 ,0x40); - wrSensorReg16_8(0x5586 ,0xa0); - break; - case Normal: - wrSensorReg16_8(0x5001 ,0x7f); - wrSensorReg16_8(0x5580 ,0x00); - break; - } - } - - - - void OV5642_set_Sharpness(unsigned char Sharpness) - { - switch(Sharpness) - { - case Auto_Sharpness_default: - wrSensorReg16_8(0x530A ,0x00); - wrSensorReg16_8(0x530c ,0x0 ); - wrSensorReg16_8(0x530d ,0xc ); - wrSensorReg16_8(0x5312 ,0x40); - break; - case Auto_Sharpness1: - wrSensorReg16_8(0x530A ,0x00); - wrSensorReg16_8(0x530c ,0x4 ); - wrSensorReg16_8(0x530d ,0x18); - wrSensorReg16_8(0x5312 ,0x20); - break; - case Auto_Sharpness2: - wrSensorReg16_8(0x530A ,0x00); - wrSensorReg16_8(0x530c ,0x8 ); - wrSensorReg16_8(0x530d ,0x30); - wrSensorReg16_8(0x5312 ,0x10); - break; - case Manual_Sharpnessoff: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x00); - wrSensorReg16_8(0x531f ,0x00); - break; - case Manual_Sharpness1: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x04); - wrSensorReg16_8(0x531f ,0x04); - break; - case Manual_Sharpness2: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x08); - wrSensorReg16_8(0x531f ,0x08); - break; - case Manual_Sharpness3: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x0c); - wrSensorReg16_8(0x531f ,0x0c); - break; - case Manual_Sharpness4: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x0f); - wrSensorReg16_8(0x531f ,0x0f); - break; - case Manual_Sharpness5: - wrSensorReg16_8(0x530A ,0x08); - wrSensorReg16_8(0x531e ,0x1f); - wrSensorReg16_8(0x531f ,0x1f); - break; - } - } - -unsigned char wrSensorReg8_8(int regID, int regDat) -{ - delay_us(10); - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr) == 0) - { - sccb_bus_stop(); - return 1; - } - delay_us(10); - if(sccb_bus_write_byte(regID) == 0) - { - sccb_bus_stop(); - return 2; - } - delay_us(10); - if(sccb_bus_write_byte(regDat)==0) - { - sccb_bus_stop(); - return 3; - } - sccb_bus_stop(); - return 0; -} - - -unsigned char rdSensorReg8_8(unsigned char regID, unsigned char* regDat) -{ - delay_us(10); - - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr) == 0) - { - sccb_bus_stop(); - //goto start; - return 1; - } - delay_us(10); - if(sccb_bus_write_byte(regID)==0)//ID - { - sccb_bus_stop(); - //goto start; - return 2; - } - sccb_bus_stop(); - delay_us(10); - sccb_bus_start(); - if(sccb_bus_write_byte(sensor_addr|0x01)==0) - { - sccb_bus_stop(); - //goto start; - return 3; - } - delay_us(10); - *regDat = sccb_bus_read_byte(); - sccb_bus_send_noack(); - sccb_bus_stop(); - return 0; -} - -//I2C Array Write 8bit address, 8bit data -int wrSensorRegs8_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned int reg_addr = 0; - unsigned int reg_val = 0; - const struct sensor_reg *next = reglist; - while ((reg_addr != 0xff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - err = wrSensorReg8_8(reg_addr, reg_val); - delay_ms(10); - next++; - } - - return err; -} - -unsigned char wrSensorReg16_8(int regID, int regDat) -{ - sccb_bus_start(); - if(0==sccb_bus_write_byte(sensor_addr)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regID>>8)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regID)) - { - sccb_bus_stop(); - return(0); - } - delay_us(10); - if(0==sccb_bus_write_byte(regDat)) - { - sccb_bus_stop(); - return(0); - } - sccb_bus_stop(); - - return(1); -} - -int wrSensorRegs16_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned int reg_addr; - unsigned char reg_val; - const struct sensor_reg *next = reglist; - - while ((reg_addr != 0xffff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - err = wrSensorReg16_8(reg_addr, reg_val); - next++; - delay_ms(1); - } - return err; -} - - -int rdSensorRegs16_8(const struct sensor_reg reglist[]) -{ - int err = 0; - unsigned char testVal =0; - unsigned int reg_addr; - unsigned char reg_val; - const struct sensor_reg *next = reglist; - - while ((reg_addr != 0xffff) | (reg_val != 0xff)) - { - reg_addr =next->reg; - reg_val = next->val; - // err = wrSensorReg16_8(reg_addr, reg_val); - //printf("Write register %04x value %02x\r\n",reg_addr,reg_val); - rdSensorReg16_8(reg_addr,&testVal); - printf("Read register %04x value %02x ",reg_addr,testVal); - if(testVal != reg_val){ - printf("(error) \r\n"); - }else{ - printf("\r\n"); - } - next++; - } - return err; -} - -unsigned char rdSensorReg16_8(unsigned int regID, unsigned char* regDat) -{ - sccb_bus_start(); - if(0==sccb_bus_write_byte(0x78)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - delay_us(20); - if(0==sccb_bus_write_byte(regID>>8)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - if(0==sccb_bus_write_byte(regID)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - sccb_bus_stop(); - - delay_us(20); - - - sccb_bus_start(); - if(0==sccb_bus_write_byte(0x79)) - { - sccb_bus_stop(); - return(0); - } - delay_us(20); - *regDat=sccb_bus_read_byte(); - sccb_bus_send_noack(); - sccb_bus_stop(); - return(1); -} - -void resetFirmware(int CS1, int CS2, int CS3, int CS4){ - - if (CS1 > -1 ){ - write_reg(0x07, 0x80,CS1); - delay_ms(100); - write_reg(0x07, 0x00,CS1); - delay_ms(100); - if(sensor_model == OV5640 || sensor_model == OV5642){ - write_reg(ARDUCHIP_FRAMES, 0x00,CAM_CS1); - set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK, CAM_CS1); - } - - } - if (CS2 > -1 ){ - write_reg(0x07, 0x80,CS2); - delay_ms(100); - write_reg(0x07, 0x00,CS2); - delay_ms(100); - if(sensor_model==OV5640 || sensor_model == OV5642){ - write_reg(ARDUCHIP_FRAMES, 0x00,CAM_CS2); - set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK, CAM_CS2); - } - } - if (CS3 > -1 ){ - write_reg(0x07, 0x80,CS3); - delay_ms(100); - write_reg(0x07, 0x00,CS3); - delay_ms(100); - if(sensor_model==OV5640 || sensor_model == OV5642){ - write_reg(ARDUCHIP_FRAMES, 0x00,CAM_CS3); - set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK, CAM_CS3); - } - } - if (CS4 > -1 ){ - write_reg(0x07, 0x80,CS4); - delay_ms(100); - write_reg(0x07, 0x00,CS4); - delay_ms(100); - if(sensor_model==OV5640 || sensor_model == OV5642){ - write_reg(ARDUCHIP_FRAMES, 0x00,CAM_CS4); - set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK, CAM_CS4); - } - } - -} - - void singleCapture(int CS){ - int i , count; - //Flush the FIFO - flush_fifo(CS); - //Start capture - start_capture(CS); - while(!get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK, CS)){;} - length = read_fifo_length(CS); - count = length; - i = 0 ; - CS_LOW(CS); - set_fifo_burst();//Set fifo burst mode - while (count--) { - readbuf[i++] = spiSendReceive(0x00); - } - count = 0; - CS_HIGH(CS); -} - - - - - -void Arducam_bus_detect(int CS1,int CS2,int CS3,int CS4){ -unsigned char vid, pid,temp ; - -if(CS1> -1){ - while(1){ - write_reg(ARDUCHIP_TEST1, 0x55 ,CS1 ); - temp = read_reg(ARDUCHIP_TEST1 ,CS1 ); - if (temp != 0x55){ - printf("SPI1 interface Error!\n"); - delay_ms(1000); - continue; - } - - else{ - printf("SPI1 interface OK!\r\n"); - break; - } - } -} - - - if(CS2> -1){ - while(1){ - write_reg(ARDUCHIP_TEST1, 0x55 ,CS2 ); - temp = read_reg(ARDUCHIP_TEST1 ,CS2 ); - if (temp != 0x55){ - printf("SPI2 interface Error!\n"); - delay_ms(1000); - continue; - } - - else{ - printf("SPI2 interface OK!\r\n"); - break; - } - } - } - - if(CS3> -1){ - while(1){ - write_reg(ARDUCHIP_TEST1, 0x55 ,CS3 ); - temp = read_reg(ARDUCHIP_TEST1 ,CS3 ); - if (temp != 0x55){ - printf("SPI3 interface Error!\n"); - delay_ms(1000); - continue; - } - - else{ - printf("SPI3 interface OK!\r\n"); - break; - } - } -} - if(CS4> -1){ - while(1){ - write_reg(ARDUCHIP_TEST1, 0x55 ,CS4 ); - temp = read_reg(ARDUCHIP_TEST1 ,CS4 ); - if (temp != 0x55){ - printf("SPI4 interface Error!\n"); - delay_ms(1000); - continue; - } - - else{ - printf("SPI4 interface OK!\r\n"); - break; - } - } - } - - - while(1){ - sensor_addr = 0x60; - wrSensorReg8_8(0xff, 0x01); - rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid); - rdSensorReg8_8(OV2640_CHIPID_LOW, &pid); - if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))) - printf("Can't find OV2640 module!\r\n"); - else{ - sensor_model = OV2640 ; - printf("OV2640 detected.\r\n"); - break; - } - sensor_addr = 0x78; - rdSensorReg16_8(OV5640_CHIPID_HIGH, &vid); - rdSensorReg16_8(OV5640_CHIPID_LOW, &pid); - if ((vid != 0x56) || (pid != 0x40)) - printf("Can't find OV5640 module!\r\n"); - else{ - sensor_model = OV5640 ; - printf("OV5640 detected.\r\n"); - break; - } - - sensor_addr = 0x78; - rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid); - rdSensorReg16_8(OV5642_CHIPID_LOW, &pid); - if ((vid != 0x56) || (pid != 0x42)){ - printf("Can't find OV5642 module!\r\n"); - continue; - } - else{ - sensor_model = OV5642 ; - printf("OV5642 detected.\r\n"); - break; - } - } -} - - - - - diff --git a/SPI_Camera/src/ArduCAM.h b/SPI_Camera/src/ArduCAM.h deleted file mode 100644 index 40f7c8e..0000000 --- a/SPI_Camera/src/ArduCAM.h +++ /dev/null @@ -1,411 +0,0 @@ -#ifndef __ARDUCAM_H -#define __ARDUCAM_H - -#define JPEG_BUF_SIZE 2*1024*1024 //2M -#define CMD_BUF_SIZE 512 - - -char readbuf[JPEG_BUF_SIZE]; - - -char* sendbuf_cam1 ; -char* sendbuf_cam2 ; -char* sendbuf_cam3 ; -char* sendbuf_cam4 ; - - - -char revCmdData[CMD_BUF_SIZE]; - -//ArduCAM CS define -#define CAM_CS1 17 -#define CAM_CS2 23 -#define CAM_CS3 22 -#define CAM_CS4 24 - - - - -#include "bcm283x_board_driver.h" - -#define OV2640_CHIPID_HIGH 0x0A -#define OV2640_CHIPID_LOW 0x0B - -#define OV5642_CHIPID_HIGH 0x300a -#define OV5642_CHIPID_LOW 0x300b - -#define OV5640_CHIPID_HIGH 0x300a -#define OV5640_CHIPID_LOW 0x300b - -extern unsigned char sensor_model; -extern unsigned char sensor_addr; -extern unsigned int length; -extern unsigned char is_header; -#define BMP 0 -#define JPEG 1 -#define RAW 2 - -#define OV7670 0 -#define MT9D111_A 1 -#define OV7675 2 -#define OV5642 3 -#define OV3640 4 -#define OV2640 5 -#define OV9655 6 -#define MT9M112 7 -#define OV7725 8 -#define OV7660 9 -#define MT9M001 10 -#define OV5640 11 -#define MT9D111_B 12 -#define OV9650 13 -#define MT9V111 14 -#define MT9T112 15 -#define MT9D112 16 - -#define OV2640_160x120 0 //160x120 -#define OV2640_176x144 1 //176x144 -#define OV2640_320x240 2 //320x240 -#define OV2640_352x288 3 //352x288 -#define OV2640_640x480 4 //640x480 -#define OV2640_800x600 5 //800x600 -#define OV2640_1024x768 6 //1024x768 -#define OV2640_1280x1024 7 //1280x1024 -#define OV2640_1600x1200 8 //1600x1200 - -#define OV5642_320x240 0 //320x240 -#define OV5642_640x480 1 //640x480 -#define OV5642_1024x768 2 //1024x768 -#define OV5642_1280x960 3 //1280x960 -#define OV5642_1600x1200 4 //1600x1200 -#define OV5642_2048x1536 5 //2048x1536 -#define OV5642_2592x1944 6 //2592x1944 - - -#define OV5640_320x240 0 //320x240 -#define OV5640_352x288 1 //352x288 -#define OV5640_640x480 2 //640x480 -#define OV5640_800x480 3 //800x480 -#define OV5640_1024x768 4 //1024x768 -#define OV5640_1280x960 5 //1280x960 -#define OV5640_1600x1200 6 //1600x1200 -#define OV5640_2048x1536 7 //2048x1536 -#define OV5640_2592x1944 8 //2592x1944 - - - - -//Light Mode - -#define Auto 0 -#define Sunny 1 -#define Cloudy 2 -#define Office 3 -#define Home 4 - -#define Advanced_AWB 0 -#define Simple_AWB 1 -#define Manual_day 2 -#define Manual_A 3 -#define Manual_cwf 4 -#define Manual_cloudy 5 - - - -//Color Saturation - -#define Saturation4 0 -#define Saturation3 1 -#define Saturation2 2 -#define Saturation1 3 -#define Saturation0 4 -#define Saturation_1 5 -#define Saturation_2 6 -#define Saturation_3 7 -#define Saturation_4 8 - -//Brightness - -#define Brightness4 0 -#define Brightness3 1 -#define Brightness2 2 -#define Brightness1 3 -#define Brightness0 4 -#define Brightness_1 5 -#define Brightness_2 6 -#define Brightness_3 7 -#define Brightness_4 8 - - -//Contrast - -#define Contrast4 0 -#define Contrast3 1 -#define Contrast2 2 -#define Contrast1 3 -#define Contrast0 4 -#define Contrast_1 5 -#define Contrast_2 6 -#define Contrast_3 7 -#define Contrast_4 8 - - - -#define degree_180 0 -#define degree_150 1 -#define degree_120 2 -#define degree_90 3 -#define degree_60 4 -#define degree_30 5 -#define degree_0 6 -#define degree30 7 -#define degree60 8 -#define degree90 9 -#define degree120 10 -#define degree150 11 - - - -//Special effects - -#define Antique 0 -#define Bluish 1 -#define Greenish 2 -#define Reddish 3 -#define BW 4 -#define Negative 5 -#define BWnegative 6 -#define Normal 7 -#define Sepia 8 -#define Overexposure 9 -#define Solarize 10 -#define Blueish 11 -#define Yellowish 12 - -#define Exposure_17_EV 0 -#define Exposure_13_EV 1 -#define Exposure_10_EV 2 -#define Exposure_07_EV 3 -#define Exposure_03_EV 4 -#define Exposure_default 5 -#define Exposure07_EV 6 -#define Exposure10_EV 7 -#define Exposure13_EV 8 -#define Exposure17_EV 9 -#define Exposure03_EV 10 - - -#define Auto_Sharpness_default 0 -#define Auto_Sharpness1 1 -#define Auto_Sharpness2 2 -#define Manual_Sharpnessoff 3 -#define Manual_Sharpness1 4 -#define Manual_Sharpness2 5 -#define Manual_Sharpness3 6 -#define Manual_Sharpness4 7 -#define Manual_Sharpness5 8 - - - -#define Sharpness1 0 -#define Sharpness2 1 -#define Sharpness3 2 -#define Sharpness4 3 -#define Sharpness5 4 -#define Sharpness6 5 -#define Sharpness7 6 -#define Sharpness8 7 -#define Sharpness_auto 8 - - - - -#define EV3 0 -#define EV2 1 -#define EV1 2 -#define EV0 3 -#define EV_1 4 -#define EV_2 5 -#define EV_3 6 - -#define MIRROR 0 -#define FLIP 1 -#define MIRROR_FLIP 2 - - - - -#define high_quality 0 -#define default_quality 1 -#define low_quality 2 - -#define Color_bar 0 -#define Color_square 1 -#define BW_square 2 -#define DLI 3 - - -#define Night_Mode_On 0 -#define Night_Mode_Off 1 - -#define Off 0 -#define Manual_50HZ 1 -#define Manual_60HZ 2 -#define Auto_Detection 3 - - -/****************************************************/ -/* I2C Control Definition */ -/****************************************************/ -#define I2C_ADDR_8BIT 0 -#define I2C_ADDR_16BIT 1 -#define I2C_REG_8BIT 0 -#define I2C_REG_16BIT 1 -#define I2C_DAT_8BIT 0 -#define I2C_DAT_16BIT 1 - -/* Register initialization tables for SENSORs */ -/* Terminating list entry for reg */ -#define SENSOR_REG_TERM_8BIT 0xFF -#define SENSOR_REG_TERM_16BIT 0xFFFF -/* Terminating list entry for val */ -#define SENSOR_VAL_TERM_8BIT 0xFF -#define SENSOR_VAL_TERM_16BIT 0xFFFF - -//Define maximum frame buffer size -#if (defined OV2640_MINI_2MP) -#define MAX_FIFO_SIZE 0x5FFFF //384Kunsigned char -#elif (defined OV5642_MINI_5MP || defined OV5642_MINI_5MP_BIT_ROTATION_FIXED || defined ARDUCAM_SHIELD_REVC) -#define MAX_FIFO_SIZE 0x7FFFF //512Kunsigned char -#else -#define MAX_FIFO_SIZE 0x7FFFFF //8Munsigned char -#endif - -/****************************************************/ -/* ArduChip registers definition */ -/****************************************************/ -#define RWBIT 0x80 //READ AND WRITE BIT IS BIT[7] - -#define ARDUCHIP_TEST1 0x00 //TEST register - -#if !(defined OV2640_MINI_2MP) - #define ARDUCHIP_FRAMES 0x01 //FRAME control register, Bit[2:0] = Number of frames to be captured //On 5MP_Plus platforms bit[2:0] = 7 means continuous capture until frame buffer is full -#endif - -#define ARDUCHIP_MODE 0x02 //Mode register -#define MCU2LCD_MODE 0x00 -#define CAM2LCD_MODE 0x01 -#define LCD2MCU_MODE 0x02 - -#define ARDUCHIP_TIM 0x03 //Timming control -#if !(defined OV2640_MINI_2MP) - #define HREF_LEVEL_MASK 0x01 //0 = High active , 1 = Low active - #define VSYNC_LEVEL_MASK 0x02 //0 = High active , 1 = Low active - #define LCD_BKEN_MASK 0x04 //0 = Enable, 1 = Disable - #if (defined ARDUCAM_SHIELD_V2) - #define PCLK_REVERSE_MASK 0x08 //0 = Normal PCLK, 1 = REVERSED PCLK - #else - #define PCLK_DELAY_MASK 0x08 //0 = data no delay, 1 = data delayed one PCLK - #endif - //#define MODE_MASK 0x10 //0 = LCD mode, 1 = FIFO mode -#endif -//#define FIFO_PWRDN_MASK 0x20 //0 = Normal operation, 1 = FIFO power down -//#define LOW_POWER_MODE 0x40 //0 = Normal mode, 1 = Low power mode - -#define ARDUCHIP_FIFO 0x04 //FIFO and I2C control -#define FIFO_CLEAR_MASK 0x01 -#define FIFO_START_MASK 0x02 -#define FIFO_RDPTR_RST_MASK 0x10 -#define FIFO_WRPTR_RST_MASK 0x20 - -#define ARDUCHIP_GPIO 0x06 //GPIO Write Register -#if !(defined (ARDUCAM_SHIELD_V2) || defined (ARDUCAM_SHIELD_REVC)) -#define GPIO_RESET_MASK 0x01 //0 = Sensor reset, 1 = Sensor normal operation -#define GPIO_PWDN_MASK 0x02 //0 = Sensor normal operation, 1 = Sensor standby -#define GPIO_PWREN_MASK 0x04 //0 = Sensor LDO disable, 1 = sensor LDO enable -#endif - -#define BURST_FIFO_READ 0x3C //Burst FIFO read operation -#define SINGLE_FIFO_READ 0x3D //Single FIFO read operation - -#define ARDUCHIP_REV 0x40 //ArduCHIP revision -#define VER_LOW_MASK 0x3F -#define VER_HIGH_MASK 0xC0 - -#define ARDUCHIP_TRIG 0x41 //Trigger source -#define VSYNC_MASK 0x01 -#define SHUTTER_MASK 0x02 -#define CAP_DONE_MASK 0x08 - -#define FIFO_SIZE1 0x42 //Camera write FIFO size[7:0] for burst to read -#define FIFO_SIZE2 0x43 //Camera write FIFO size[15:8] -#define FIFO_SIZE3 0x44 //Camera write FIFO size[18:16] - -#ifndef _SENSOR_ -#define _SENSOR_ -struct sensor_reg { - unsigned int reg; - unsigned int val; -}; -#endif - - -void ArduCAM_Init(unsigned char model ); -void ArduCAM_CS_init(int CS1, int CS2, int CS3, int CS4); -void resetFirmware(int CS1, int CS2, int CS3, int CS4); - - -void CS_HIGH(int CS); -void CS_LOW(int CS); - -void OV2640_set_JPEG_size(unsigned char size); -void OV5642_set_JPEG_size(unsigned char size); -void OV5640_set_JPEG_size(unsigned char size); -void set_format(unsigned char fmt); - - -void OV5642_set_Color_Saturation(unsigned char Color_Saturation); - void OV5642_set_Brightness(unsigned char Brightness); - void OV5642_set_Special_effects(unsigned char Special_effect); -void OV5642_set_Sharpness(unsigned char Sharpness); - - - -void flush_fifo(int CS); -void start_capture(int CS); -void clear_fifo_flag(int CS); -unsigned char read_fifo(int CS); - -unsigned char read_reg(unsigned char addr,int CS); -void write_reg(unsigned char addr, unsigned char data,int CS); - -unsigned int read_fifo_length(int CS); -void set_fifo_burst(void); - -void set_bit(unsigned char addr, unsigned char bit,int CS); -void clear_bit(unsigned char addr, unsigned char bit,int CS); -unsigned char get_bit(unsigned char addr, unsigned char bit,int CS); -void set_mode(unsigned char mode,int CS); - -unsigned char bus_write(int address, int value,int CS); -unsigned char bus_read(int address,int CS); -unsigned char read_fifo_burst(void); - - - -unsigned char wrSensorReg8_8(int regID, int regDat); -int wrSensorRegs8_8(const struct sensor_reg*); -unsigned char rdSensorReg8_8(unsigned char regID, unsigned char* regDat); - -unsigned char wrSensorReg16_8(int regID, int regDat); -int wrSensorRegs16_8(const struct sensor_reg reglist[]); -unsigned char rdSensorReg16_8(unsigned int regID, unsigned char* regDat); -int rdSensorRegs16_8(const struct sensor_reg reglist[]); -void singleCapture(int CS); - - -void Arducam_bus_detect(int CS1,int CS2,int CS3,int CS4); - - - -#endif diff --git a/SPI_Camera/src/ArducamDemo.c b/SPI_Camera/src/ArducamDemo.c deleted file mode 100644 index 0909aa0..0000000 --- a/SPI_Camera/src/ArducamDemo.c +++ /dev/null @@ -1,345 +0,0 @@ -#include -#include -#include "ArduCAM.h" -#include "sccb_bus.h" -#include -#include -#include -#include -#include -#include -#include -#include - - -void *readDataThread(void *arg); -//void *sendDataThread(void *arg); -void dataParse(char* databuf); -void INThandler(int sig); - - -int sockfd, newsockfd, portno, clilen; -struct sockaddr_in serv_addr, cli_addr; -struct sigaction sa; -unsigned char start_read_data = 0; -unsigned char read_data_OK = 0; - -unsigned int length_cam1; -//unsigned int length_cam2; -//unsigned int length_cam3; -//unsigned int length_cam4; - - - - - -int main(int argc, char *argv[]) -{ - int n; - int on = 1; - pthread_t _readData;//_sendData; - pioInit(); - ArduCAM_CS_init( CAM_CS1, -1, -1, -1 ); // init the cs - // ArduCAM_CS_init( CAM_CS1, CAM_CS2, CAM_CS3, CAM_CS4 ); // init the cs - - sccb_bus_init(); - spiInit(4000000, 0); //8MHZ - //Arducam_bus_detect( CAM_CS1, CAM_CS2, CAM_CS3, CAM_CS4 ); // detect the SPI bus - Arducam_bus_detect( CAM_CS1, -1, -1, -1 ); - - resetFirmware( CAM_CS1, -1, -1, -1 ); //reset the firmware - // resetFirmware( CAM_CS1, CAM_CS2, CAM_CS3, CAM_CS4); //reset the firmware - ArduCAM_Init(sensor_model); - signal(SIGINT, INThandler); - sockfd = socket(AF_INET, SOCK_STREAM, 0); - if (sockfd < 0) { - perror("ERROR opening socket\r\n"); - exit(1); - } - - /* Initialize socket structure */ - bzero((char *) &serv_addr, sizeof(serv_addr)); - portno = 2002; - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = INADDR_ANY; - serv_addr.sin_port = htons(portno); - //creat two thread - pthread_create(&_readData, NULL, readDataThread, NULL); - // pthread_create(&_sendData, NULL, sendDataThread, NULL); - sleep(1); - /*Add support port reuse*/ - if ((setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) < 0) - { - perror("setsockopt failed"); - exit(EXIT_FAILURE); - } - /* Now bind the host address using bind() call.*/ - if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) { - perror("ERROR on binding"); - exit(1); - } - /* Add support reconnection */ - sa.sa_handler = SIG_IGN; - sigaction( SIGPIPE, &sa, 0 ); - /* Now start listening for the clients, here process will - go in sleep mode and will wait for the incoming connection - */ - while (1) { - read_data_OK = 0; - start_read_data = 0; - listen(sockfd, 5); - clilen = sizeof(cli_addr); - - printf("Waitting connection...\r\n"); - - /* Accept actual connection from the client */ - newsockfd = accept(sockfd, (struct sockaddr *)&cli_addr, (void *) &clilen); - if (newsockfd < 0) { - printf("error\r\n"); - } - printf("connect successfully\r\n"); - - bzero(&revCmdData, CMD_BUF_SIZE); // Clear the revCmdData buffer - while ((n = read(newsockfd, &revCmdData, CMD_BUF_SIZE)) > 0) { - // printf(revCmdData); // Check the receive cmd data - dataParse(revCmdData); // parse the data received - bzero(&revCmdData, CMD_BUF_SIZE); // Clear the revCmdData buffer - } - - if (n < 0) { - printf("Connection exception!\n"); - read_data_OK = 0; - start_read_data = 0; - - } - - } - printf("Close the sockfd\r\n"); - close(newsockfd); - close(sockfd); - return 0; -} - - - - -void *readDataThread(void *arg) { - while (1) { - if (start_read_data == 1) { - singleCapture(CAM_CS1); - - sendbuf_cam1 = readbuf; - length_cam1 = length; - if (sockfd) { - write(newsockfd, sendbuf_cam1 , length_cam1); - } - else { - start_read_data = 0; - break; - } -/* - singleCapture(CAM_CS2); - sendbuf_cam2 = readbuf; - length_cam2 = length; - if (sockfd) { - write(newsockfd, sendbuf_cam2 , length_cam2); - } - else { - start_read_data = 0; - break; - } - singleCapture(CAM_CS3); - sendbuf_cam3 = readbuf; - length_cam3 = length; - if (sockfd) { - write(newsockfd, sendbuf_cam3 , length_cam3); - } - else { - start_read_data = 0; - break; - } - singleCapture(CAM_CS4); - sendbuf_cam4 = readbuf; - length_cam4 = length; - if (sockfd) { - write(newsockfd, sendbuf_cam4 , length_cam4); - } - else { - start_read_data = 0; - break; - } - -*/ - // start_read_data = 0; - - } - } - return 0; -} - - -//void *sendDataThread(void *arg) { - // ; -//} - - -void INThandler(int sig) -{ - char c; - signal(sig, SIG_IGN); - printf("You hit Ctrl-C\n" - "Do you really want to quit? [y/n] "); - c = getchar(); - if (c == 'y' || c == 'Y') { - - if (newsockfd < 0) { - close(newsockfd); - close(sockfd); - } - start_read_data = 0; - printf("Bye Arducam.\n"); - printf("If you want to resart Arducam, just run \"sudo ./run_Arducam_Demo\"\r\n"); - exit(0); - } - else - signal(SIGINT, INThandler); - getchar(); // Get new line character -} - - - -void dataParse(char* databuf) { - char* response = "HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=frame\r\n\r\n"; - char* net_check = "HTTP/1.1 200 OK\r\n\r\n 123"; - - if (strchr(databuf, 0)) { - write(newsockfd, net_check , strlen(net_check)); - } - if (strstr(databuf, "stream") ) { - write(newsockfd, response , strlen(response)); - start_read_data = 1; - } - if (strstr(databuf, "ql=0")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_160x120); - printf("Set the resolution to OV2640_160x120 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_320x240); - printf("Set the resolution to OV5640_320x240 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_320x240); - printf("Set the resolution to OV5642_320x240 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=1")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_176x144); - printf("Set the resolution to OV2640_176x144 successfully\r\n"); - - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_352x288); - printf("Set the resolution to OV5640_352x288 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_640x480); - printf("Set the resolution to OV5642_640x480 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=2")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_320x240); - printf("Set the resolution to OV2640_320x240 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_640x480); - printf("Set the resolution to OV5640_640x480 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_1024x768); - printf("Set the resolution to OV5642_1024x768 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=3")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_352x288); - printf("Set the resolution to OV2640_352x288 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_800x480); - printf("Set the resolution to OV5640_800x480 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_1280x960); - printf("Set the resolution to OV5642_1280x960 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=4") ) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_640x480); - printf("Set the resolution to OV2640_640x480 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_1024x768); - printf("Set the resolution to OV5640_1024x768 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_1600x1200); - printf("Set the resolution to OV5642_1600x1200 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=5")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_800x600); - printf("Set the resolution to OV2640_800x600 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_1280x960); - printf("Set the resolution to OV5640_1280x960 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_2048x1536); - printf("Set the resolution to OV5642_2048x1536 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=6")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_1024x768); - printf("Set the resolution to OV2640_1024x768 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_1600x1200); - printf("Set the resolution to OV5640_1600x1200 successfully\r\n"); - } - else if (sensor_model == OV5642) { - OV5642_set_JPEG_size(OV5642_2592x1944); - printf("Set the resolution to OV5642_2592x1944 successfully\r\n"); - - } - } - else if (strstr(databuf, "ql=7")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_1280x1024); - printf("Set the resolution to OV2640_1280x1024 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_2048x1536); - printf("Set the resolution to OV5640_2048x1536 successfully\r\n"); - } - } - else if (strstr(databuf, "ql=8")) { - if (sensor_model == OV2640) { - OV2640_set_JPEG_size(OV2640_1600x1200); - printf("Set the resolution to OV2640_1600x1200 successfully\r\n"); - } - else if (sensor_model == OV5640) { - OV5640_set_JPEG_size(OV5640_2592x1944); - printf("Set the resolution to OV5640_2592x1944 successfully\r\n"); - } - } -} - - - diff --git a/SPI_Camera/src/bcm283x_board_driver.c b/SPI_Camera/src/bcm283x_board_driver.c deleted file mode 100644 index 9852218..0000000 --- a/SPI_Camera/src/bcm283x_board_driver.c +++ /dev/null @@ -1,331 +0,0 @@ -#include "bcm283x_board_driver.h" - -#include -#include -///////////////////////////////////////////////////////////////////// -// General Functions -///////////////////////////////////////////////////////////////////// -// TODO: return error code instead of printing (mem_fd, reg_map) - -int irq1, irq2, irqbasic; - -void pioInit() { - int mem_fd; - void *reg_map; - - // /dev/mem is a psuedo-driver for accessing memory in the Linux filesystem - if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { - printf("can't open /dev/mem \n"); - exit(-1); - } - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - GPIO_BASE); // Offset to GPIO peripheral - - if (reg_map == MAP_FAILED) { - printf("gpio mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - gpio = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - SPI0_BASE); // Offset to SPI peripheral - - if (reg_map == MAP_FAILED) { - printf("spi mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - spi = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - PWM_BASE); // Offset to PWM peripheral - - if (reg_map == MAP_FAILED) { - printf("pwm mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - pwm = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - SYS_TIMER_BASE); // Offset to Timer peripheral - - if (reg_map == MAP_FAILED) { - printf("sys timer mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - sys_timer = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - ARM_TIMER_BASE); // Offset to interrupts - - - if (reg_map == MAP_FAILED) { - printf("arm timer mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - arm_timer = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - UART_BASE); // Offset to UART peripheral - - if (reg_map == MAP_FAILED) { - printf("uart mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - uart = (volatile unsigned *)reg_map; - - reg_map = mmap( - NULL, //Address at which to start local mapping (null means don't-care) - BLOCK_SIZE, //Size of mapped memory block - PROT_READ|PROT_WRITE,// Enable both reading and writing to the mapped memory - MAP_SHARED, // This program does not have exclusive access to this memory - mem_fd, // Map to /dev/mem - CM_PWM_BASE); // Offset to ARM timer peripheral - - if (reg_map == MAP_FAILED) { - printf("cm_pwm mmap error %d\n", (int)reg_map); - close(mem_fd); - exit(-1); - } - - cm_pwm = (volatile unsigned *)reg_map; - close(mem_fd); -} - - -void noInterrupts(void) { - //save current interrupts - irq1 = IRQ_ENABLE1; - irq2 = IRQ_ENABLE2; - irqbasic = IRQ_ENABLE_BASIC; - - //disable interrupts - IRQ_DISABLE1 = irq1; - IRQ_DISABLE2 = irq2; - IRQ_DISABLE_BASIC = irqbasic; -} - -void interrupts(void) { - if(IRQ_ENABLE1 == 0){ // if interrupts are disabled - //restore interrupts - IRQ_ENABLE1 = irq1; - IRQ_ENABLE2 = irq2; - IRQ_ENABLE_BASIC = irqbasic; - } -} - - -void pinMode(int pin, int function) { - int reg = pin/10; - int offset = (pin%10)*3; - GPFSEL[reg] &= ~((0b111 & ~function) << offset); - GPFSEL[reg] |= ((0b111 & function) << offset); -} - -void digitalWrite(int pin, int val) { - int reg = pin / 32; - int offset = pin % 32; - - if (val) GPSET[reg] = 1 << offset; - else GPCLR[reg] = 1 << offset; -} - -int digitalRead(int pin) { - int reg = pin / 32; - int offset = pin % 32; - - return (GPLEV[reg] >> offset) & 0x00000001; -} - -void pinsMode(int pins[], int numPins, int fxn) { - int i; - for(i=0; i> 1; - } -} - -int digitalReads(int pins[], int numPins) { - int i, val = digitalRead(pins[0]); - - for(i=1; i> 8); // send data MSB first - rec = (rec << 8) | spiSendReceive(send & 0xFF); - SPI0CSbits.TA = 0; // turn off SPI - return rec; -} - -///////////////////////////////////////////////////////////////////// -// UART Functions -///////////////////////////////////////////////////////////////////// - -void uartInit(int baud) { - uint fb = 12000000/baud; // 3 MHz UART clock - - pinMode(14, ALT0); - pinMode(15, ALT0); - UART_IBRD = fb >> 6; // 6 Fract, 16 Int bits of BRD - UART_FBRD = fb & 63; - UART_LCRHbits.WLEN = 3; // 8 Data, 1 Stop, 0 Parity, no FIFO, no Flow - UART_CRbits.UARTEN = 1; // Enable uart. -} - -char getCharSerial(void) { - while (UART_FRbits.RXFE); // Wait until data is available. - return UART_DRbits.DATA; // Return char from serial port. -} - - -void putCharSerial(char c) { - while (!UART_FRbits.TXFE); - UART_DRbits.DATA = c; -} - -///////////////////////////////////////////////////////////////////// -// Pulse Width Modulation Functions -///////////////////////////////////////////////////////////////////// - -void pwmInit() { - pinMode(18, ALT5); - - // Configure the clock manager to generate a 25 MHz PWM clock. - // Documentation on the clock manager is missing in the datasheet - // but found in "BCM2835 Audio and PWM Clocks" by G.J. van Loo 6 Feb 2013. - // Maximum operating frequency of PWM clock is 25 MHz. - // Writes to the clock manager registers require simultaneous writing - // a "password" of 5A to the top bits to reduce the risk of accidental writes. - - CM_PWMCTL = 0; // Turn off PWM before changing - CM_PWMCTL = PWM_CLK_PASSWORD|0x20; // Turn off clock generator - while(CM_PWMCTLbits.BUSY); // Wait for generator to stop - CM_PWMCTL = PWM_CLK_PASSWORD|0x206; // Src = unfiltered 500 MHz CLKD - CM_PWMDIV = PWM_CLK_PASSWORD|(PLL_CLOCK_DIVISOR << 12); // PWM Freq = 25 MHz - CM_PWMCTL = CM_PWMCTL|PWM_CLK_PASSWORD|0x10; // Enable PWM clock - while (!CM_PWMCTLbits.BUSY); // Wait for generator to start - PWM_CTLbits.MSEN1 = 1; // Channel 1 in mark/space mode - PWM_CTLbits.PWEN1 = 1; // Enable pwm -} - -/** - * dut is a value between 0 and 1 - * freq is pwm frequency in Hz - */ -void setPWM(float freq, float dut) { - PWM_RNG1 = (int)(CM_FREQUENCY / freq); - PWM_DAT1 = (int)(dut * (CM_FREQUENCY / freq)); -} - -void analogWrite(int val) { - setPWM(78125, val/255.0); -} - - - diff --git a/SPI_Camera/src/bcm283x_board_driver.h b/SPI_Camera/src/bcm283x_board_driver.h deleted file mode 100644 index 9b3ff1e..0000000 --- a/SPI_Camera/src/bcm283x_board_driver.h +++ /dev/null @@ -1,713 +0,0 @@ - -#ifndef BCM_283X_H -#define BCM_283X_H - -// Include statements -#include -#include -#include -#include -#include -#include - -///////////////////////////////////////////////////////////////////// -// Constants -///////////////////////////////////////////////////////////////////// - -// GPIO FSEL Types -#define INPUT 0 -#define OUTPUT 1 -#define ALT0 4 -#define ALT1 5 -#define ALT2 6 -#define ALT3 7 -#define ALT4 3 -#define ALT5 2 - -// Clock Manager Bitfield offsets: -#define PWM_CLK_PASSWORD 0x5a000000 -#define PWM_MASH 9 -#define PWM_KILL 5 -#define PWM_ENAB 4 -#define PWM_SRC 0 - -// PWM Constants -#define PLL_FREQUENCY 500000000 // default PLLD value is 500 [MHz] -#define CM_FREQUENCY 25000000 // max pwm clk is 25 [MHz] -#define PLL_CLOCK_DIVISOR (PLL_FREQUENCY / CM_FREQUENCY) - -///////////////////////////////////////////////////////////////////// -// Memory Map -///////////////////////////////////////////////////////////////////// - -// These #define values are specific to the BCM2835, taken from "BCM2835 ARM Peripherals" -//#define BCM2835_PERI_BASE 0x20000000 - -// Updated to BCM2836 for Raspberry Pi 2.0 Fall 2015 dmh -#define BCM2835_PERI_BASE 0x3F000000 - -// Updated to BCM2711 for Raspberry Pi 4 Fall 2019 dmh -//#define BCM2835_PERI_BASE 0xFE000000 - -#define GPIO_BASE (BCM2835_PERI_BASE + 0x200000) -#define UART_BASE (BCM2835_PERI_BASE + 0x201000) -#define SPI0_BASE (BCM2835_PERI_BASE + 0x204000) -#define PWM_BASE (BCM2835_PERI_BASE + 0x20c000) - -#define SYS_TIMER_BASE (BCM2835_PERI_BASE + 0x3000) -#define ARM_TIMER_BASE (BCM2835_PERI_BASE + 0xB000) - -#define CM_PWM_BASE (BCM2835_PERI_BASE + 0x101000) - -#define BLOCK_SIZE (4*1024) - - - -#define SPI_CS_LEN_LONG 0x02000000 -#define SPI_CS_DMA_LEN 0x01000000 -#define SPI_CS_CSPOL2 0x00800000 -#define SPI_CS_CSPOL1 0x00400000 -#define SPI_CS_CSPOL0 0x00200000 -#define SPI_CS_RXF 0x00100000 -#define SPI_CS_RXR 0x00080000 -#define SPI_CS_TXD 0x00040000 -#define SPI_CS_RXD 0x00020000 -#define SPI_CS_DONE 0x00010000 -#define SPI_CS_LEN 0x00002000 -#define SPI_CS_REN 0x00001000 -#define SPI_CS_ADCS 0x00000800 -#define SPI_CS_INTR 0x00000400 -#define SPI_CS_INTD 0x00000200 -#define SPI_CS_DMAEN 0x00000100 -#define SPI_CS_TA 0x00000080 -#define SPI_CS_CSPOL 0x00000040 -#define SPI_CS_CLEAR_RX 0x00000020 -#define SPI_CS_CLEAR_TX 0x00000010 -#define SPI_CS_CPOL 0x00000008 -#define SPI_CS_CPHA 0x00000004 -#define SPI_CS_CS_10 0x00000002 -#define SPI_CS_CS_01 0x00000001 - - -// Pointers that will be memory mapped when pioInit() is called -volatile unsigned int *gpio; //pointer to base of gpio -volatile unsigned int *spi; //pointer to base of spi registers -volatile unsigned int *pwm; - -volatile unsigned int *sys_timer; -volatile unsigned int *arm_timer; // pointer to base of arm timer registers - -volatile unsigned int *uart; -volatile unsigned int *cm_pwm; - -///////////////////////////////////////////////////////////////////// -// GPIO Registers -///////////////////////////////////////////////////////////////////// - -// Function Select -#define GPFSEL ((volatile unsigned int *) (gpio + 0)) -typedef struct -{ - unsigned FSEL0 : 3; - unsigned FSEL1 : 3; - unsigned FSEL2 : 3; - unsigned FSEL3 : 3; - unsigned FSEL4 : 3; - unsigned FSEL5 : 3; - unsigned FSEL6 : 3; - unsigned FSEL7 : 3; - unsigned FSEL8 : 3; - unsigned FSEL9 : 3; - unsigned : 2; -}gpfsel0bits; -#define GPFSEL0bits (*(volatile gpfsel0bits*) (gpio + 0)) -#define GPFSEL0 (*(volatile unsigned int*) (gpio + 0)) - -typedef struct -{ - unsigned FSEL10 : 3; - unsigned FSEL11 : 3; - unsigned FSEL12 : 3; - unsigned FSEL13 : 3; - unsigned FSEL14 : 3; - unsigned FSEL15 : 3; - unsigned FSEL16 : 3; - unsigned FSEL17 : 3; - unsigned FSEL18 : 3; - unsigned FSEL19 : 3; - unsigned : 2; -}gpfsel1bits; -#define GPFSEL1bits (*(volatile gpfsel1bits*) (gpio + 1)) -#define GPFSEL1 (*(volatile unsigned int*) (gpio + 1)) - -typedef struct -{ - unsigned FSEL20 : 3; - unsigned FSEL21 : 3; - unsigned FSEL22 : 3; - unsigned FSEL23 : 3; - unsigned FSEL24 : 3; - unsigned FSEL25 : 3; - unsigned FSEL26 : 3; - unsigned FSEL27 : 3; - unsigned FSEL28 : 3; - unsigned FSEL29 : 3; - unsigned : 2; -}gpfsel2bits; -#define GPFSEL2bits (* (volatile gpfsel2bits*) (gpio + 2)) -#define GPFSEL2 (* (volatile unsigned int *) (gpio + 2)) - -typedef struct -{ - unsigned FSEL30 : 3; - unsigned FSEL31 : 3; - unsigned FSEL32 : 3; - unsigned FSEL33 : 3; - unsigned FSEL34 : 3; - unsigned FSEL35 : 3; - unsigned FSEL36 : 3; - unsigned FSEL37 : 3; - unsigned FSEL38 : 3; - unsigned FSEL39 : 3; - unsigned : 2; -}gpfsel3bits; -#define GPFSEL3bits (* (volatile gpfsel3bits*) (gpio + 3)) -#define GPFSEL3 (* (volatile unsigned int *) (gpio + 3)) - - -typedef struct -{ - unsigned FSEL40 : 3; - unsigned FSEL41 : 3; - unsigned FSEL42 : 3; - unsigned FSEL43 : 3; - unsigned FSEL44 : 3; - unsigned FSEL45 : 3; - unsigned FSEL46 : 3; - unsigned FSEL47 : 3; - unsigned FSEL48 : 3; - unsigned FSEL49 : 3; - unsigned : 2; -}gpfsel4bits; -#define GPFSEL4bits (* (volatile gpfsel4bits*) (gpio + 4)) -#define GPFSEL4 (* (volatile unsigned int *) (gpio + 4)) - -typedef struct -{ - unsigned FSEL50 : 3; - unsigned FSEL51 : 3; - unsigned FSEL52 : 3; - unsigned FSEL53 : 3; - unsigned : 20; -}gpfsel5bits; -#define GPFSEL5bits (* (volatile gpfsel5bits*) (gpio + 5)) -#define GPFSEL5 (* (volatile unsigned int *) (gpio + 5)) - -// Pin Output Select -#define GPSET ((volatile unsigned int *) (gpio + 7)) -typedef struct -{ - unsigned SET0 : 1; - unsigned SET1 : 1; - unsigned SET2 : 1; - unsigned SET3 : 1; - unsigned SET4 : 1; - unsigned SET5 : 1; - unsigned SET6 : 1; - unsigned SET7 : 1; - unsigned SET8 : 1; - unsigned SET9 : 1; - unsigned SET10 : 1; - unsigned SET11 : 1; - unsigned SET12 : 1; - unsigned SET13 : 1; - unsigned SET14 : 1; - unsigned SET15 : 1; - unsigned SET16 : 1; - unsigned SET17 : 1; - unsigned SET18 : 1; - unsigned SET19 : 1; - unsigned SET20 : 1; - unsigned SET21 : 1; - unsigned SET22 : 1; - unsigned SET23 : 1; - unsigned SET24 : 1; - unsigned SET25 : 1; - unsigned SET26 : 1; - unsigned SET27 : 1; - unsigned SET28 : 1; - unsigned SET29 : 1; - unsigned SET30 : 1; - unsigned SET31 : 1; -}gpset0bits; -#define GPSET0bits (* (volatile gpset0bits*) (gpio + 7)) -#define GPSET0 (* (volatile unsigned int *) (gpio + 7)) - -typedef struct -{ - unsigned SET32 : 1; - unsigned SET33 : 1; - unsigned SET34 : 1; - unsigned SET35 : 1; - unsigned SET36 : 1; - unsigned SET37 : 1; - unsigned SET38 : 1; - unsigned SET39 : 1; - unsigned SET40 : 1; - unsigned SET41 : 1; - unsigned SET42 : 1; - unsigned SET43 : 1; - unsigned SET44 : 1; - unsigned SET45 : 1; - unsigned SET46 : 1; - unsigned SET47 : 1; - unsigned SET48 : 1; - unsigned SET49 : 1; - unsigned SET50 : 1; - unsigned SET51 : 1; - unsigned SET52 : 1; - unsigned SET53 : 1; - unsigned : 10; -}gpset1bits; -#define GPSET1bits (* (volatile gpset1bits*) (gpio + 8)) -#define GPSET1 (* (volatile unsigned int *) (gpio + 8)) - -// Pin Output Clear -#define GPCLR ((volatile unsigned int *) (gpio + 10)) -typedef struct -{ - unsigned CLR0 : 1; - unsigned CLR1 : 1; - unsigned CLR2 : 1; - unsigned CLR3 : 1; - unsigned CLR4 : 1; - unsigned CLR5 : 1; - unsigned CLR6 : 1; - unsigned CLR7 : 1; - unsigned CLR8 : 1; - unsigned CLR9 : 1; - unsigned CLR10 : 1; - unsigned CLR11 : 1; - unsigned CLR12 : 1; - unsigned CLR13 : 1; - unsigned CLR14 : 1; - unsigned CLR15 : 1; - unsigned CLR16 : 1; - unsigned CLR17 : 1; - unsigned CLR18 : 1; - unsigned CLR19 : 1; - unsigned CLR20 : 1; - unsigned CLR21 : 1; - unsigned CLR22 : 1; - unsigned CLR23 : 1; - unsigned CLR24 : 1; - unsigned CLR25 : 1; - unsigned CLR26 : 1; - unsigned CLR27 : 1; - unsigned CLR28 : 1; - unsigned CLR29 : 1; - unsigned CLR30 : 1; - unsigned CLR31 : 1; -}gpclr0bits; -#define GPCLR0bits (* (volatile gpclr0bits*) (gpio + 10)) -#define GPCLR0 (* (volatile unsigned int *) (gpio + 10)) - -typedef struct -{ - unsigned CLR32 : 1; - unsigned CLR33 : 1; - unsigned CLR34 : 1; - unsigned CLR35 : 1; - unsigned CLR36 : 1; - unsigned CLR37 : 1; - unsigned CLR38 : 1; - unsigned CLR39 : 1; - unsigned CLR40 : 1; - unsigned CLR41 : 1; - unsigned CLR42 : 1; - unsigned CLR43 : 1; - unsigned CLR44 : 1; - unsigned CLR45 : 1; - unsigned CLR46 : 1; - unsigned CLR47 : 1; - unsigned CLR48 : 1; - unsigned CLR49 : 1; - unsigned CLR50 : 1; - unsigned CLR51 : 1; - unsigned CLR52 : 1; - unsigned CLR53 : 1; - unsigned : 10; -}gpclr1bits; -#define GPCLR1bits (* (volatile gpclr1bits*) (gpio + 11)) -#define GPCLR1 (* (volatile unsigned int *) (gpio + 11)) - -// Pin Level -#define GPLEV ((volatile unsigned int *) (gpio + 13)) -typedef struct -{ - unsigned LEV0 : 1; - unsigned LEV1 : 1; - unsigned LEV2 : 1; - unsigned LEV3 : 1; - unsigned LEV4 : 1; - unsigned LEV5 : 1; - unsigned LEV6 : 1; - unsigned LEV7 : 1; - unsigned LEV8 : 1; - unsigned LEV9 : 1; - unsigned LEV10 : 1; - unsigned LEV11 : 1; - unsigned LEV12 : 1; - unsigned LEV13 : 1; - unsigned LEV14 : 1; - unsigned LEV15 : 1; - unsigned LEV16 : 1; - unsigned LEV17 : 1; - unsigned LEV18 : 1; - unsigned LEV19 : 1; - unsigned LEV20 : 1; - unsigned LEV21 : 1; - unsigned LEV22 : 1; - unsigned LEV23 : 1; - unsigned LEV24 : 1; - unsigned LEV25 : 1; - unsigned LEV26 : 1; - unsigned LEV27 : 1; - unsigned LEV28 : 1; - unsigned LEV29 : 1; - unsigned LEV30 : 1; - unsigned LEV31 : 1; -}gplev0bits; -#define GPLEV0bits (* (volatile gplev0bits*) (gpio + 13)) -#define GPLEV0 (* (volatile unsigned int *) (gpio + 13)) - - -typedef struct -{ - unsigned LEV32 : 1; - unsigned LEV33 : 1; - unsigned LEV34 : 1; - unsigned LEV35 : 1; - unsigned LEV36 : 1; - unsigned LEV37 : 1; - unsigned LEV38 : 1; - unsigned LEV39 : 1; - unsigned LEV40 : 1; - unsigned LEV41 : 1; - unsigned LEV42 : 1; - unsigned LEV43 : 1; - unsigned LEV44 : 1; - unsigned LEV45 : 1; - unsigned LEV46 : 1; - unsigned LEV47 : 1; - unsigned LEV48 : 1; - unsigned LEV49 : 1; - unsigned LEV50 : 1; - unsigned LEV51 : 1; - unsigned LEV52 : 1; - unsigned LEV53 : 1; - unsigned : 10; -}gplev1bits; -#define GPLEV1bits (* (volatile gplev1bits*) (gpio + 14)) -#define GPLEV1 (* (volatile unsigned int *) (gpio + 14)) - -///////////////////////////////////////////////////////////////////// -// SPI Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned CS :2; - unsigned CPHA :1; - unsigned CPOL :1; - unsigned CLEAR :2; - unsigned CSPOL :1; - unsigned TA :1; - unsigned DMAEN :1; - unsigned INTD :1; - unsigned INTR :1; - unsigned ADCS :1; - unsigned REN :1; - unsigned LEN :1; - unsigned LMONO :1; - unsigned TE_EN :1; - unsigned DONE :1; - unsigned RXD :1; - unsigned TXD :1; - unsigned RXR :1; - unsigned RXF :1; - unsigned CSPOL0 :1; - unsigned CSPOL1 :1; - unsigned CSPOL2 :1; - unsigned DMA_LEN :1; - unsigned LEN_LONG :1; - unsigned :6; -}spi0csbits; -#define SPI0CSbits (* (volatile spi0csbits*) (spi + 0)) -#define SPI0CS (* (volatile unsigned int *) (spi + 0)) - -#define SPI0FIFO (* (volatile unsigned int *) (spi + 1)) -#define SPI0CLK (* (volatile unsigned int *) (spi + 2)) -#define SPI0DLEN (* (volatile unsigned int *) (spi + 3)) - -///////////////////////////////////////////////////////////////////// -// System Timer Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned M0 :1; - unsigned M1 :1; - unsigned M2 :1; - unsigned M3 :1; - unsigned :28; -}sys_timer_csbits; -#define SYS_TIMER_CSbits (*(volatile sys_timer_csbits*) (sys_timer + 0)) -#define SYS_TIMER_CS (* (volatile unsigned int*)(sys_timer + 0)) - -#define SYS_TIMER_CLO (* (volatile unsigned int*)(sys_timer + 1)) -#define SYS_TIMER_CHI (* (volatile unsigned int*)(sys_timer + 2)) -#define SYS_TIMER_C0 (* (volatile unsigned int*)(sys_timer + 3)) -#define SYS_TIMER_C1 (* (volatile unsigned int*)(sys_timer + 4)) -#define SYS_TIMER_C2 (* (volatile unsigned int*)(sys_timer + 5)) -#define SYS_TIMER_C3 (* (volatile unsigned int*)(sys_timer + 6)) - -///////////////////////////////////////////////////////////////////// -// ARM Interrupt Registers -///////////////////////////////////////////////////////////////////// - -#define IRQ_PENDING_BASIC (* (volatile unsigned int *) (arm_timer + 128)) -#define IRQ_PENDING1 (* (volatile unsigned int *) (arm_timer + 129)) -#define IRQ_PENDING2 (* (volatile unsigned int *) (arm_timer + 130)) - -#define IRQ_ENABLE1 (* (volatile unsigned int *) (arm_timer + 132)) -#define IRQ_ENABLE2 (* (volatile unsigned int *) (arm_timer + 133)) -#define IRQ_ENABLE_BASIC (* (volatile unsigned int *) (arm_timer + 134)) -#define IRQ_DISABLE1 (* (volatile unsigned int *) (arm_timer + 135)) -#define IRQ_DISABLE2 (* (volatile unsigned int *) (arm_timer + 136)) -#define IRQ_DISABLE_BASIC (* (volatile unsigned int *) (arm_timer + 137)) - -///////////////////////////////////////////////////////////////////// -// ARM Timer Registers -///////////////////////////////////////////////////////////////////// - -#define ARM_TIMER_LOAD (* (volatile unsigned int *) (arm_timer + 256)) -//TODO: make timer control struct -#define ARM_TIMER_CONTROL (* (volatile unsigned int *) (arm_timer + 258)) -#define ARM_TIMER_IRQCLR (* (volatile unsigned int*) (arm_timer + 259)) -#define ARM_TIMER_RAWIRQ (* (volatile unsigned int *) (arm_timer + 260)) -#define ARM_TIMER_RELOAD (* (volatile unsigned int *) (arm_timer + 262)) -#define ARM_TIMER_DIV (* (volatile unsigned int *) (arm_timer + 263)) - -///////////////////////////////////////////////////////////////////// -// UART Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned DATA : 8; - unsigned FE : 1; - unsigned PE : 1; - unsigned BE : 1; - unsigned OE : 1; - unsigned : 20; -} uart_drbits; -#define UART_DRbits (* (volatile uart_drbits*) (uart + 0)) -#define UART_DR (*(volatile unsigned int *) (uart + 0)) - -typedef struct -{ - unsigned int CTS : 1; - unsigned int DSR : 1; - unsigned int DCD : 1; - unsigned int BUSY : 1; - unsigned int RXFE : 1; - unsigned int TXFF : 1; - unsigned int RXFF : 1; - unsigned int TXFE : 1; - unsigned int RI : 1; - unsigned int : 24; -} uart_frbits; -#define UART_FRbits (*(volatile uart_frbits*) (uart + 6)) -#define UART_FR (*(volatile unsigned int *) (uart + 6)) - -typedef struct -{ - unsigned int IBRD : 16; - unsigned int : 16; -} uart_ibrdbits; -#define UART_IBRDbits (*(volatile uart_ibrdbits*) (uart + 9)) -#define UART_IBRD (*(volatile unsigned int *) (uart + 9)) - -typedef struct -{ - unsigned int FBRD : 6; - unsigned int : 26; -} uart_fbrdbits; -#define UART_FBRDbits (*(volatile uart_fbrdbits*) (uart + 10)) -#define UART_FBRD (*(volatile unsigned int *) (uart + 10)) - -typedef struct -{ - unsigned int BRK : 1; - unsigned int PEN : 1; - unsigned int EPS : 1; - unsigned int STP2 : 1; - unsigned int FEN : 1; - unsigned int WLEN : 2; - unsigned int SPS : 1; - unsigned int : 24; -} uart_lcrhbits; -#define UART_LCRHbits (* (volatile uart_lcrhbits*) (uart + 11)) -#define UART_LCRH (*(volatile unsigned int *) (uart + 11)) - -typedef struct -{ - unsigned int UARTEN : 1; - unsigned int SIREN : 1; - unsigned int SIRLP : 1; - unsigned int : 4; - unsigned int LBE : 1; - unsigned int TXE : 1; - unsigned int RXE : 1; - unsigned int DTR : 1; - unsigned int RTS : 1; - unsigned int OUT1 : 1; - unsigned int OUT2 : 1; - unsigned int RTSEN : 1; - unsigned int CTSEN : 1; - unsigned int : 16; -} uart_crbits; -#define UART_CRbits (* (volatile uart_crbits*) (uart + 12)) -#define UART_CR (*(volatile unsigned int *) (uart + 12)) - - -typedef struct -{ - unsigned int RIRMIS : 1; - unsigned int CTSRMIS : 1; - unsigned int DCDRMIS : 1; - unsigned int DSRRMIS : 1; - unsigned int RXRIS : 1; - unsigned int TXRIS : 1; - unsigned int RTRIS : 1; - unsigned int FERIS : 1; - unsigned int PERIS : 1; - unsigned int BERIS : 1; - unsigned int OERIS : 1; - unsigned int : 21; -} uart_risbits; -#define UART_RISbits (* (volatile uart_risbits*) (uart + 15)) -#define UART_RIS (*(volatile unsigned int *) (uart + 15)) - -///////////////////////////////////////////////////////////////////// -// PWM Registers -///////////////////////////////////////////////////////////////////// -typedef struct -{ - unsigned PWEN1 :1; - unsigned MODE1 :1; - unsigned RPTL1 :1; - unsigned SBIT1 :1; - unsigned POLA1 :1; - unsigned USEF1 :1; - unsigned CLRF1 :1; - unsigned MSEN1 :1; - unsigned PWEN2 :1; - unsigned MODE2 :1; - unsigned RPTL2 :1; - unsigned SBIT2 :1; - unsigned POLA2 :1; - unsigned USEF2 :1; - unsigned :1; - unsigned MSEN2 :1; - unsigned :16; -} pwm_ctlbits; -#define PWM_CTLbits (* (volatile pwm_ctlbits *) (pwm + 0)) -#define PWM_CTL (*(volatile unsigned int *) (pwm + 0)) - -#define PWM_RNG1 (*(volatile unsigned int *) (pwm + 4)) -#define PWM_DAT1 (*(volatile unsigned int *)(pwm + 5)) - -///////////////////////////////////////////////////////////////////// -// Clock Manager Registers -///////////////////////////////////////////////////////////////////// - -typedef struct -{ - unsigned SRC :4; - unsigned ENAB :1; - unsigned KILL :1; - unsigned :1; - unsigned BUSY :1; - unsigned FLIP :1; - unsigned MASH :2; - unsigned :13; - unsigned PASSWD :8; -}cm_pwmctl_bits; -#define CM_PWMCTLbits (* (volatile cm_pwmctl_bits *) (cm_pwm + 40)) -#define CM_PWMCTL (* (volatile unsigned int*) (cm_pwm + 40)) - -typedef struct -{ - unsigned DIVF :12; - unsigned DIVI :12; - unsigned PASSWD :8; -} cm_pwmdivbits; -#define CM_PWMDIVbits (* (volatile cm_pwmdivbits *) (cm_pwm + 41)) -#define CM_PWMDIV (*(volatile unsigned int *)(cm_pwm + 41)) - -///////////////////////////////////////////////////////////////////// -// Interrupt Functions -///////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////// -// GPIO Functions -///////////////////////////////////////////////////////////////////// -#define HIGH 1 -#define LOW 0 - -void pioInit(); - -void noInterrupts(void); -void interrupts(void); - -void pinMode(int pin, int function); -void digitalWrite(int pin, int val); - -int digitalRead(int pin); -void pinsMode(int pins[], int numPins, int fxn); -void digitalWrites(int pins[], int numPins, int val); -int digitalReads(int pins[], int numPins); -void delay_us(int micros); -void delay_ms(int millis); - -///////////////////////////////////////////////////////////////////// -// SPI Functions -///////////////////////////////////////////////////////////////////// -void spiInit(int freq, int settings); -char spiSendReceive(char send); -short spiSendReceive16(short send) ; - -///////////////////////////////////////////////////////////////////// -// UART Functions -///////////////////////////////////////////////////////////////////// - -void uartInit(int baud); - -char getCharSerial(void); - - -void putCharSerial(char c); - -void pwmInit(); -void setPWM(float freq, float dut); - -void analogWrite(int val); -unsigned long get_microsecond_timestamp(); - - - -#endif \ No newline at end of file diff --git a/SPI_Camera/src/ov2640_regs.h b/SPI_Camera/src/ov2640_regs.h deleted file mode 100644 index 4acb4f4..0000000 --- a/SPI_Camera/src/ov2640_regs.h +++ /dev/null @@ -1,859 +0,0 @@ -#ifndef OV2640_REGS_H -#define OV2640_REGS_H -#include "ArduCAM.h" -#define OV2640_CHIPID_HIGH 0x0A -#define OV2640_CHIPID_LOW 0x0B -const struct sensor_reg OV2640_QVGA[] = -{ - {0xff, 0x0}, - {0x2c, 0xff}, - {0x2e, 0xdf}, - {0xff, 0x1}, - {0x3c, 0x32}, - {0x11, 0x0}, - {0x9, 0x2}, - {0x4, 0xa8}, - {0x13, 0xe5}, - {0x14, 0x48}, - {0x2c, 0xc}, - {0x33, 0x78}, - {0x3a, 0x33}, - {0x3b, 0xfb}, - {0x3e, 0x0}, - {0x43, 0x11}, - {0x16, 0x10}, - {0x39, 0x2}, - {0x35, 0x88}, - - {0x22, 0xa}, - {0x37, 0x40}, - {0x23, 0x0}, - {0x34, 0xa0}, - {0x6, 0x2}, - {0x6, 0x88}, - {0x7, 0xc0}, - {0xd, 0xb7}, - {0xe, 0x1}, - {0x4c, 0x0}, - {0x4a, 0x81}, - {0x21, 0x99}, - {0x24, 0x40}, - {0x25, 0x38}, - {0x26, 0x82}, - {0x5c, 0x0}, - {0x63, 0x0}, - {0x46, 0x22}, - {0xc, 0x3a}, - {0x5d, 0x55}, - {0x5e, 0x7d}, - {0x5f, 0x7d}, - {0x60, 0x55}, - {0x61, 0x70}, - {0x62, 0x80}, - {0x7c, 0x5}, - {0x20, 0x80}, - {0x28, 0x30}, - {0x6c, 0x0}, - {0x6d, 0x80}, - {0x6e, 0x0}, - {0x70, 0x2}, - {0x71, 0x94}, - {0x73, 0xc1}, - {0x3d, 0x34}, - {0x12, 0x4}, - {0x5a, 0x57}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0xff, 0x0}, - {0xe5, 0x7f}, - {0xf9, 0xc0}, - {0x41, 0x24}, - {0xe0, 0x14}, - {0x76, 0xff}, - {0x33, 0xa0}, - {0x42, 0x20}, - {0x43, 0x18}, - {0x4c, 0x0}, - {0x87, 0xd0}, - {0x88, 0x3f}, - {0xd7, 0x3}, - {0xd9, 0x10}, - {0xd3, 0x82}, - {0xc8, 0x8}, - {0xc9, 0x80}, - {0x7c, 0x0}, - {0x7d, 0x0}, - {0x7c, 0x3}, - {0x7d, 0x48}, - {0x7d, 0x48}, - {0x7c, 0x8}, - {0x7d, 0x20}, - {0x7d, 0x10}, - {0x7d, 0xe}, - {0x90, 0x0}, - {0x91, 0xe}, - {0x91, 0x1a}, - {0x91, 0x31}, - {0x91, 0x5a}, - {0x91, 0x69}, - {0x91, 0x75}, - {0x91, 0x7e}, - {0x91, 0x88}, - {0x91, 0x8f}, - {0x91, 0x96}, - {0x91, 0xa3}, - {0x91, 0xaf}, - {0x91, 0xc4}, - {0x91, 0xd7}, - {0x91, 0xe8}, - {0x91, 0x20}, - {0x92, 0x0}, - - {0x93, 0x6}, - {0x93, 0xe3}, - {0x93, 0x3}, - {0x93, 0x3}, - {0x93, 0x0}, - {0x93, 0x2}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x93, 0x0}, - {0x96, 0x0}, - {0x97, 0x8}, - {0x97, 0x19}, - {0x97, 0x2}, - {0x97, 0xc}, - {0x97, 0x24}, - {0x97, 0x30}, - {0x97, 0x28}, - {0x97, 0x26}, - {0x97, 0x2}, - {0x97, 0x98}, - {0x97, 0x80}, - {0x97, 0x0}, - {0x97, 0x0}, - {0xa4, 0x0}, - {0xa8, 0x0}, - {0xc5, 0x11}, - {0xc6, 0x51}, - {0xbf, 0x80}, - {0xc7, 0x10}, - {0xb6, 0x66}, - {0xb8, 0xa5}, - {0xb7, 0x64}, - {0xb9, 0x7c}, - {0xb3, 0xaf}, - {0xb4, 0x97}, - {0xb5, 0xff}, - {0xb0, 0xc5}, - {0xb1, 0x94}, - {0xb2, 0xf}, - {0xc4, 0x5c}, - {0xa6, 0x0}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x1b}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x19}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0xa7, 0x20}, - {0xa7, 0xd8}, - {0xa7, 0x19}, - {0xa7, 0x31}, - {0xa7, 0x0}, - {0xa7, 0x18}, - {0x7f, 0x0}, - {0xe5, 0x1f}, - {0xe1, 0x77}, - {0xdd, 0x7f}, - {0xc2, 0xe}, - - {0xff, 0x0}, - {0xe0, 0x4}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x0}, - {0x54, 0x0}, - {0x55, 0x88}, - {0x57, 0x0}, - - {0x50, 0x92}, - {0x5a, 0x50}, - {0x5b, 0x3c}, - {0x5c, 0x0}, - {0xd3, 0x4}, - {0xe0, 0x0}, - - {0xff, 0x0}, - {0x5, 0x0}, - - {0xda, 0x8}, - {0xd7, 0x3}, - {0xe0, 0x0}, - - {0x5, 0x0}, - - - {0xff,0xff}, -}; - -const struct sensor_reg OV2640_JPEG_INIT[] = -{ - { 0xff, 0x00 }, - { 0x2c, 0xff }, - { 0x2e, 0xdf }, - { 0xff, 0x01 }, - { 0x3c, 0x32 }, - { 0x11, 0x00 }, - { 0x09, 0x02 }, - { 0x04, 0x28 }, - { 0x13, 0xe5 }, - { 0x14, 0x48 }, - { 0x2c, 0x0c }, - { 0x33, 0x78 }, - { 0x3a, 0x33 }, - { 0x3b, 0xfB }, - { 0x3e, 0x00 }, - { 0x43, 0x11 }, - { 0x16, 0x10 }, - { 0x39, 0x92 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0x48, 0x00 }, - { 0x5B, 0x00 }, - { 0x42, 0x03 }, - { 0x4a, 0x81 }, - { 0x21, 0x99 }, - { 0x24, 0x40 }, - { 0x25, 0x38 }, - { 0x26, 0x82 }, - { 0x5c, 0x00 }, - { 0x63, 0x00 }, - { 0x61, 0x70 }, - { 0x62, 0x80 }, - { 0x7c, 0x05 }, - { 0x20, 0x80 }, - { 0x28, 0x30 }, - { 0x6c, 0x00 }, - { 0x6d, 0x80 }, - { 0x6e, 0x00 }, - { 0x70, 0x02 }, - { 0x71, 0x94 }, - { 0x73, 0xc1 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x37, 0xc0 }, - { 0x4f, 0x60 }, - { 0x50, 0xa8 }, - { 0x6d, 0x00 }, - { 0x3d, 0x38 }, - { 0x46, 0x3f }, - { 0x4f, 0x60 }, - { 0x0c, 0x3c }, - { 0xff, 0x00 }, - { 0xe5, 0x7f }, - { 0xf9, 0xc0 }, - { 0x41, 0x24 }, - { 0xe0, 0x14 }, - { 0x76, 0xff }, - { 0x33, 0xa0 }, - { 0x42, 0x20 }, - { 0x43, 0x18 }, - { 0x4c, 0x00 }, - { 0x87, 0xd5 }, - { 0x88, 0x3f }, - { 0xd7, 0x03 }, - { 0xd9, 0x10 }, - { 0xd3, 0x82 }, - { 0xc8, 0x08 }, - { 0xc9, 0x80 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7c, 0x03 }, - { 0x7d, 0x48 }, - { 0x7d, 0x48 }, - { 0x7c, 0x08 }, - { 0x7d, 0x20 }, - { 0x7d, 0x10 }, - { 0x7d, 0x0e }, - { 0x90, 0x00 }, - { 0x91, 0x0e }, - { 0x91, 0x1a }, - { 0x91, 0x31 }, - { 0x91, 0x5a }, - { 0x91, 0x69 }, - { 0x91, 0x75 }, - { 0x91, 0x7e }, - { 0x91, 0x88 }, - { 0x91, 0x8f }, - { 0x91, 0x96 }, - { 0x91, 0xa3 }, - { 0x91, 0xaf }, - { 0x91, 0xc4 }, - { 0x91, 0xd7 }, - { 0x91, 0xe8 }, - { 0x91, 0x20 }, - { 0x92, 0x00 }, - { 0x93, 0x06 }, - { 0x93, 0xe3 }, - { 0x93, 0x05 }, - { 0x93, 0x05 }, - { 0x93, 0x00 }, - { 0x93, 0x04 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x93, 0x00 }, - { 0x96, 0x00 }, - { 0x97, 0x08 }, - { 0x97, 0x19 }, - { 0x97, 0x02 }, - { 0x97, 0x0c }, - { 0x97, 0x24 }, - { 0x97, 0x30 }, - { 0x97, 0x28 }, - { 0x97, 0x26 }, - { 0x97, 0x02 }, - { 0x97, 0x98 }, - { 0x97, 0x80 }, - { 0x97, 0x00 }, - { 0x97, 0x00 }, - { 0xc3, 0xed }, - { 0xa4, 0x00 }, - { 0xa8, 0x00 }, - { 0xc5, 0x11 }, - { 0xc6, 0x51 }, - { 0xbf, 0x80 }, - { 0xc7, 0x10 }, - { 0xb6, 0x66 }, - { 0xb8, 0xA5 }, - { 0xb7, 0x64 }, - { 0xb9, 0x7C }, - { 0xb3, 0xaf }, - { 0xb4, 0x97 }, - { 0xb5, 0xFF }, - { 0xb0, 0xC5 }, - { 0xb1, 0x94 }, - { 0xb2, 0x0f }, - { 0xc4, 0x5c }, - { 0xc0, 0x64 }, - { 0xc1, 0x4B }, - { 0x8c, 0x00 }, - { 0x86, 0x3D }, - { 0x50, 0x00 }, - { 0x51, 0xC8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x5a, 0xC8 }, - { 0x5b, 0x96 }, - { 0x5c, 0x00 }, - { 0xd3, 0x00 }, //{ 0xd3, 0x7f }, - { 0xc3, 0xed }, - { 0x7f, 0x00 }, - { 0xda, 0x00 }, - { 0xe5, 0x1f }, - { 0xe1, 0x67 }, - { 0xe0, 0x00 }, - { 0xdd, 0x7f }, - { 0x05, 0x00 }, - - { 0x12, 0x40 }, - { 0xd3, 0x04 }, //{ 0xd3, 0x7f }, - { 0xc0, 0x16 }, - { 0xC1, 0x12 }, - { 0x8c, 0x00 }, - { 0x86, 0x3d }, - { 0x50, 0x00 }, - { 0x51, 0x2C }, - { 0x52, 0x24 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x5A, 0x2c }, - { 0x5b, 0x24 }, - { 0x5c, 0x00 }, - { 0xff, 0xff }, -}; - -const struct sensor_reg OV2640_YUV422[] = -{ - { 0xFF, 0x00 }, - { 0x05, 0x00 }, - { 0xDA, 0x10 }, - { 0xD7, 0x03 }, - { 0xDF, 0x00 }, - { 0x33, 0x80 }, - { 0x3C, 0x40 }, - { 0xe1, 0x77 }, - { 0x00, 0x00 }, - { 0xff, 0xff }, -}; - -const struct sensor_reg OV2640_JPEG[] = -{ - { 0xe0, 0x14 }, - { 0xe1, 0x77 }, - { 0xe5, 0x1f }, - { 0xd7, 0x03 }, - { 0xda, 0x10 }, - { 0xe0, 0x00 }, - { 0xFF, 0x01 }, - { 0x04, 0x08 }, - { 0xff, 0xff }, -}; - -/* JPG 160x120 */ -const struct sensor_reg OV2640_160x120_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x92 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x28 }, - { 0x5b, 0x1e }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG, 0x176x144 */ - -const struct sensor_reg OV2640_176x144_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x92 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x2c }, - { 0x5b, 0x24 }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 320x240 */ - -const struct sensor_reg OV2640_320x240_JPEG[] = -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x89 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x50 }, - { 0x5b, 0x3c }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 352x288 */ - -const struct sensor_reg OV2640_352x288_JPEG[] = - -{ - { 0xff, 0x01 }, - { 0x12, 0x40 }, - { 0x17, 0x11 }, - { 0x18, 0x43 }, - { 0x19, 0x00 }, - { 0x1a, 0x4b }, - { 0x32, 0x09 }, - { 0x4f, 0xca }, - { 0x50, 0xa8 }, - { 0x5a, 0x23 }, - { 0x6d, 0x00 }, - { 0x39, 0x12 }, - { 0x35, 0xda }, - { 0x22, 0x1a }, - { 0x37, 0xc3 }, - { 0x23, 0x00 }, - { 0x34, 0xc0 }, - { 0x36, 0x1a }, - { 0x06, 0x88 }, - { 0x07, 0xc0 }, - { 0x0d, 0x87 }, - { 0x0e, 0x41 }, - { 0x4c, 0x00 }, - { 0xff, 0x00 }, - { 0xe0, 0x04 }, - { 0xc0, 0x64 }, - { 0xc1, 0x4b }, - { 0x86, 0x35 }, - { 0x50, 0x89 }, - { 0x51, 0xc8 }, - { 0x52, 0x96 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x57, 0x00 }, - { 0x5a, 0x58 }, - { 0x5b, 0x48 }, - { 0x5c, 0x00 }, - { 0xe0, 0x00 }, - { 0xff, 0xff }, -}; - -/* JPG 640x480 */ -const struct sensor_reg OV2640_640x480_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x89}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0xa0}, - {0x5b, 0x78}, - {0x5c, 0x00}, - {0xd3, 0x04}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - -/* JPG 800x600 */ -const struct sensor_reg OV2640_800x600_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x35}, - {0x50, 0x89}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0xc8}, - {0x5b, 0x96}, - {0x5c, 0x00}, - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - -/* JPG 1024x768 */ -const struct sensor_reg OV2640_1024x768_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xc0, 0xC8}, - {0xc1, 0x96}, - {0x8c, 0x00}, - {0x86, 0x3D}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2C}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x5a, 0x00}, - {0x5b, 0xC0}, - {0x5c, 0x01}, - {0xd3, 0x02}, - - - {0xff, 0xff}, -}; - - /* JPG 1280x1024 */ -const struct sensor_reg OV2640_1280x1024_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0x40}, - {0x5b, 0xf0}, - {0x5c, 0x01}, - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; - - /* JPG 1600x1200 */ -const struct sensor_reg OV2640_1600x1200_JPEG[] = -{ - {0xff, 0x01}, - {0x11, 0x01}, - {0x12, 0x00}, // Bit[6:4]: Resolution selection//0x02Ϊ²ÊÌõ - {0x17, 0x11}, // HREFST[10:3] - {0x18, 0x75}, // HREFEND[10:3] - {0x32, 0x36}, // Bit[5:3]: HREFEND[2:0]; Bit[2:0]: HREFST[2:0] - {0x19, 0x01}, // VSTRT[9:2] - {0x1a, 0x97}, // VEND[9:2] - {0x03, 0x0f}, // Bit[3:2]: VEND[1:0]; Bit[1:0]: VSTRT[1:0] - {0x37, 0x40}, - {0x4f, 0xbb}, - {0x50, 0x9c}, - {0x5a, 0x57}, - {0x6d, 0x80}, - {0x3d, 0x34}, - {0x39, 0x02}, - {0x35, 0x88}, - {0x22, 0x0a}, - {0x37, 0x40}, - {0x34, 0xa0}, - {0x06, 0x02}, - {0x0d, 0xb7}, - {0x0e, 0x01}, - - {0xff, 0x00}, - {0xe0, 0x04}, - {0xc0, 0xc8}, - {0xc1, 0x96}, - {0x86, 0x3d}, - {0x50, 0x00}, - {0x51, 0x90}, - {0x52, 0x2c}, - {0x53, 0x00}, - {0x54, 0x00}, - {0x55, 0x88}, - {0x57, 0x00}, - {0x5a, 0x90}, - {0x5b, 0x2C}, - {0x5c, 0x05}, //bit2->1;bit[1:0]->1 - {0xd3, 0x02}, - {0xe0, 0x00}, - - {0xff, 0xff}, -}; -#endif - diff --git a/SPI_Camera/src/ov5640_regs.h b/SPI_Camera/src/ov5640_regs.h deleted file mode 100644 index f8f1583..0000000 --- a/SPI_Camera/src/ov5640_regs.h +++ /dev/null @@ -1,715 +0,0 @@ -#ifndef OV5640_REGS_H -#define OV5640_REGS_H -#include "ArduCAM.h" - -#define OV5640_CHIPID_HIGH 0x300a -#define OV5640_CHIPID_LOW 0x300b - -const struct sensor_reg OV5640YUV_Sensor_Dvp_Init[] = -{ - { 0x4740, 0x20 }, - - { 0x4050, 0x6e }, - { 0x4051, 0x8f }, - - { 0x3008, 0x42 }, - { 0x3103, 0x03 }, - { 0x3017, 0x7f }, - { 0x3018, 0xff }, - { 0x302c, 0x02 }, - { 0x3108, 0x01 }, - { 0x3630, 0x2e },//2e - { 0x3632, 0xe2 }, - { 0x3633, 0x23 },//23 - { 0x3621, 0xe0 }, - { 0x3704, 0xa0 }, - { 0x3703, 0x5a }, - { 0x3715, 0x78 }, - { 0x3717, 0x01 }, - { 0x370b, 0x60 }, - { 0x3705, 0x1a }, - { 0x3905, 0x02 }, - { 0x3906, 0x10 }, - { 0x3901, 0x0a }, - { 0x3731, 0x12 }, - { 0x3600, 0x08 }, - { 0x3601, 0x33 }, - { 0x302d, 0x60 }, - { 0x3620, 0x52 }, - { 0x371b, 0x20 }, - { 0x471c, 0x50 }, - - { 0x3a18, 0x00 }, - { 0x3a19, 0xf8 }, - - { 0x3635, 0x1c },//1c - { 0x3634, 0x40 }, - { 0x3622, 0x01 }, - - { 0x3c04, 0x28 }, - { 0x3c05, 0x98 }, - { 0x3c06, 0x00 }, - { 0x3c07, 0x08 }, - { 0x3c08, 0x00 }, - { 0x3c09, 0x1c }, - { 0x3c0a, 0x9c }, - { 0x3c0b, 0x40 }, - - { 0x3820, 0x41 }, - { 0x3821, 0x01 }, //07 - - //windows setup - { 0x3800, 0x00 }, - { 0x3801, 0x00 }, - { 0x3802, 0x00 }, - { 0x3803, 0x04 }, - { 0x3804, 0x0a }, - { 0x3805, 0x3f }, - { 0x3806, 0x07 }, - { 0x3807, 0x9b }, - { 0x3808, 0x05 }, - { 0x3809, 0x00 }, - { 0x380a, 0x03 }, - { 0x380b, 0xc0 }, - { 0x3810, 0x00 }, - { 0x3811, 0x10 }, - { 0x3812, 0x00 }, - { 0x3813, 0x06 }, - { 0x3814, 0x31 }, - { 0x3815, 0x31 }, - - { 0x3034, 0x1a }, - { 0x3035, 0x21 }, //15fps - { 0x3036, 0x46 }, - { 0x3037, 0x13 }, - { 0x3038, 0x00 }, - { 0x3039, 0x00 }, - - { 0x380c, 0x07 }, - { 0x380d, 0x68 }, - { 0x380e, 0x03 }, //03 - { 0x380f, 0xd8 }, //d8 - - { 0x3c01, 0xb4 }, - { 0x3c00, 0x04 }, - { 0x3a08, 0x00 }, - { 0x3a09, 0x93 }, - { 0x3a0e, 0x06 }, - { 0x3a0a, 0x00 }, - { 0x3a0b, 0x7b }, - { 0x3a0d, 0x08 }, - - { 0x3a00, 0x3c }, //15fps-10fps - { 0x3a02, 0x05 }, - { 0x3a03, 0xc4 }, - { 0x3a14, 0x05 }, - { 0x3a15, 0xc4 }, - - { 0x3618, 0x00 }, - { 0x3612, 0x29 }, - { 0x3708, 0x64 }, - { 0x3709, 0x52 }, - { 0x370c, 0x03 }, - - { 0x4001, 0x02 }, - { 0x4004, 0x02 }, - { 0x3000, 0x00 }, - { 0x3002, 0x1c }, - { 0x3004, 0xff }, - { 0x3006, 0xc3 }, - { 0x300e, 0x58 }, - { 0x302e, 0x00 }, - { 0x4300, 0x30 }, - { 0x501f, 0x00 }, - { 0x4713, 0x03 }, - { 0x4407, 0x04 }, - { 0x460b, 0x35 }, - { 0x460c, 0x22 },//add by bright - { 0x3824, 0x01 },//add by bright - { 0x5001, 0xa3 }, - - { 0x3406, 0x01 },//awbinit - { 0x3400, 0x06 }, - { 0x3401, 0x80 }, - { 0x3402, 0x04 }, - { 0x3403, 0x00 }, - { 0x3404, 0x06 }, - { 0x3405, 0x00 }, - //awb - { 0x5180, 0xff }, - { 0x5181, 0xf2 }, - { 0x5182, 0x00 }, - { 0x5183, 0x14 }, - { 0x5184, 0x25 }, - { 0x5185, 0x24 }, - { 0x5186, 0x16 }, - { 0x5187, 0x16 }, - { 0x5188, 0x16 }, - { 0x5189, 0x62 }, - { 0x518a, 0x62 }, - { 0x518b, 0xf0 }, - { 0x518c, 0xb2 }, - { 0x518d, 0x50 }, - { 0x518e, 0x30 }, - { 0x518f, 0x30 }, - { 0x5190, 0x50 }, - { 0x5191, 0xf8 }, - { 0x5192, 0x04 }, - { 0x5193, 0x70 }, - { 0x5194, 0xf0 }, - { 0x5195, 0xf0 }, - { 0x5196, 0x03 }, - { 0x5197, 0x01 }, - { 0x5198, 0x04 }, - { 0x5199, 0x12 }, - { 0x519a, 0x04 }, - { 0x519b, 0x00 }, - { 0x519c, 0x06 }, - { 0x519d, 0x82 }, - { 0x519e, 0x38 }, - //color matrix - { 0x5381, 0x1e }, - { 0x5382, 0x5b }, - { 0x5383, 0x14 }, - { 0x5384, 0x06 }, - { 0x5385, 0x82 }, - { 0x5386, 0x88 }, - { 0x5387, 0x7c }, - { 0x5388, 0x60 }, - { 0x5389, 0x1c }, - { 0x538a, 0x01 }, - { 0x538b, 0x98 }, - //sharp&noise - { 0x5300, 0x08 }, - { 0x5301, 0x30 }, - { 0x5302, 0x3f }, - { 0x5303, 0x10 }, - { 0x5304, 0x08 }, - { 0x5305, 0x30 }, - { 0x5306, 0x18 }, - { 0x5307, 0x28 }, - { 0x5309, 0x08 }, - { 0x530a, 0x30 }, - { 0x530b, 0x04 }, - { 0x530c, 0x06 }, - //gamma - { 0x5480, 0x01 }, - { 0x5481, 0x06 }, - { 0x5482, 0x12 }, - { 0x5483, 0x24 }, - { 0x5484, 0x4a }, - { 0x5485, 0x58 }, - { 0x5486, 0x65 }, - { 0x5487, 0x72 }, - { 0x5488, 0x7d }, - { 0x5489, 0x88 }, - { 0x548a, 0x92 }, - { 0x548b, 0xa3 }, - { 0x548c, 0xb2 }, - { 0x548d, 0xc8 }, - { 0x548e, 0xdd }, - { 0x548f, 0xf0 }, - { 0x5490, 0x15 }, - //UV adjust - { 0x5580, 0x06 }, - { 0x5583, 0x40 }, - { 0x5584, 0x20 }, - { 0x5589, 0x10 }, - { 0x558a, 0x00 }, - { 0x558b, 0xf8 }, - //lens shading - { 0x5000, 0xa7 }, - { 0x5800, 0x20 }, - { 0x5801, 0x19 }, - { 0x5802, 0x17 }, - { 0x5803, 0x16 }, - { 0x5804, 0x18 }, - { 0x5805, 0x21 }, - { 0x5806, 0x0F }, - { 0x5807, 0x0A }, - { 0x5808, 0x07 }, - { 0x5809, 0x07 }, - { 0x580a, 0x0A }, - { 0x580b, 0x0C }, - { 0x580c, 0x0A }, - { 0x580d, 0x03 }, - { 0x580e, 0x01 }, - { 0x580f, 0x01 }, - { 0x5810, 0x03 }, - { 0x5811, 0x09 }, - { 0x5812, 0x0A }, - { 0x5813, 0x03 }, - { 0x5814, 0x01 }, - { 0x5815, 0x01 }, - { 0x5816, 0x03 }, - { 0x5817, 0x08 }, - { 0x5818, 0x10 }, - { 0x5819, 0x0A }, - { 0x581a, 0x06 }, - { 0x581b, 0x06 }, - { 0x581c, 0x08 }, - { 0x581d, 0x0E }, - { 0x581e, 0x22 }, - { 0x581f, 0x18 }, - { 0x5820, 0x13 }, - { 0x5821, 0x12 }, - { 0x5822, 0x16 }, - { 0x5823, 0x1E }, - { 0x5824, 0x64 }, - { 0x5825, 0x2A }, - { 0x5826, 0x2C }, - { 0x5827, 0x2A }, - { 0x5828, 0x46 }, - { 0x5829, 0x2A }, - { 0x582a, 0x26 }, - { 0x582b, 0x24 }, - { 0x582c, 0x26 }, - { 0x582d, 0x2A }, - { 0x582e, 0x28 }, - { 0x582f, 0x42 }, - { 0x5830, 0x40 }, - { 0x5831, 0x42 }, - { 0x5832, 0x08 }, - { 0x5833, 0x28 }, - { 0x5834, 0x26 }, - { 0x5835, 0x24 }, - { 0x5836, 0x26 }, - { 0x5837, 0x2A }, - { 0x5838, 0x44 }, - { 0x5839, 0x4A }, - { 0x583a, 0x2C }, - { 0x583b, 0x2a }, - { 0x583c, 0x46 }, - { 0x583d, 0xCE }, - - { 0x5688, 0x22 }, - { 0x5689, 0x22 }, - { 0x568a, 0x42 }, - { 0x568b, 0x24 }, - { 0x568c, 0x42 }, - { 0x568d, 0x24 }, - { 0x568e, 0x22 }, - { 0x568f, 0x22 }, - - { 0x5025, 0x00 }, - - { 0x3a0f, 0x30 }, - { 0x3a10, 0x28 }, - { 0x3a1b, 0x30 }, - { 0x3a1e, 0x28 }, - { 0x3a11, 0x61 }, - { 0x3a1f, 0x10 }, - - { 0x4005, 0x1a }, - { 0x3406, 0x00 },//awbinit - { 0x3503, 0x00 },//awbinit - { 0x3008, 0x02 }, - { 0xffff, 0xff }, -}; - - - -const struct sensor_reg ov5640_vga_preview[] = -{ - // YUV VGA 30fps, night mode 5fps - // Input Clock = 24Mhz, PCLK = 56MHz - { 0x3035, 0x11 }, // PLL - { 0x3036, 0x46 }, // PLL - { 0x3c07, 0x08 }, // light meter 1 threshold [7:0] - { 0x3820, 0x41 }, // Sensor flip off, ISP flip on - { 0x3821, 0x01 }, // Sensor mirror on, ISP mirror on, H binning on - { 0x3814, 0x31 }, // X INC - { 0x3815, 0x31 }, // Y INC - { 0x3800, 0x00 }, // HS - { 0x3801, 0x00 }, // HS - { 0x3802, 0x00 }, // VS - { 0x3803, 0x04 }, // VS - { 0x3804, 0x0a }, // HW (HE) - { 0x3805, 0x3f }, // HW (HE) - { 0x3806, 0x07 }, // VH (VE) - { 0x3807, 0x9b }, // VH (VE) - { 0x3808, 0x02 }, // DVPHO - { 0x3809, 0x80 }, // DVPHO - { 0x380a, 0x01 }, // DVPVO - { 0x380b, 0xe0 }, // DVPVO - { 0x380c, 0x07 }, // HTS - { 0x380d, 0x68 }, // HTS - { 0x380e, 0x03 }, // VTS - { 0x380f, 0xd8 }, // VTS - { 0x3813, 0x06 }, // Timing Voffset - { 0x3618, 0x00 }, - { 0x3612, 0x29 }, - { 0x3709, 0x52 }, - { 0x370c, 0x03 }, - { 0x3a02, 0x17 }, // 60Hz max exposure, night mode 5fps - { 0x3a03, 0x10 }, // 60Hz max exposure - // banding filters are calculated automatically in camera driver - //{ 0x3a08, 0x01 }, // B50 step - //{ 0x3a09, 0x27 }, // B50 step - //{ 0x3a0a, 0x00 }, // B60 step - //{ 0x3a0b, 0xf6 }, // B60 step - //{ 0x3a0e, 0x03 }, // 50Hz max band - //{ 0x3a0d, 0x04 }, // 60Hz max band - { 0x3a14, 0x17 }, // 50Hz max exposure, night mode 5fps - { 0x3a15, 0x10 }, // 50Hz max exposure - { 0x4004, 0x02 }, // BLC 2 lines - { 0x3002, 0x1c }, // reset JFIFO, SFIFO, JPEG - { 0x3006, 0xc3 }, // disable clock of JPEG2x, JPEG - { 0x4713, 0x03 }, // JPEG mode 3 - { 0x4407, 0x04 }, // Quantization scale - { 0x460b, 0x35 }, - { 0x460c, 0x22 }, - { 0x4837, 0x22 }, // DVP CLK divider - { 0x3824, 0x02 }, // DVP CLK divider - { 0x5001, 0xa3 }, // SDE on, scale on, UV average off, color matrix on, AWB on - { 0x3503, 0x00 }, // AEC/AGC on - -}; - -const struct sensor_reg OV5640_RGB_QVGA[] = -{ - {0x3008, 0x02}, - {0x3035, 0x41}, - {0x4740, 0x21}, - {0x4300, 0x61}, - {0x3808, 0x01}, - {0x3809, 0x40}, - {0x380a, 0x00}, - {0x380b, 0xf0}, - {0x501f, 0x01}, - {0xffff, 0xff}, -}; - -//2592x1944 QSXGA -const struct sensor_reg OV5640_JPEG_QSXGA[] = -{ - {0x3820 ,0x40}, - {0x3821 ,0x26}, - {0x3814 ,0x11}, - {0x3815 ,0x11}, - {0x3803 ,0x00}, - {0x3807 ,0x9f}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0b}, - {0x380d ,0x1c}, - {0x380e ,0x07}, - {0x380f ,0xb0}, - {0x3813 ,0x04}, - {0x3618 ,0x04}, - {0x3612 ,0x4b}, - {0x3708 ,0x64}, - {0x3709 ,0x12}, - {0x370c ,0x00}, - {0x3a02 ,0x07}, - {0x3a03 ,0xb0}, - {0x3a0e ,0x06}, - {0x3a0d ,0x08}, - {0x3a14 ,0x07}, - {0x3a15 ,0xb0}, - {0x4001 ,0x02}, - {0x4004 ,0x06}, - {0x3002 ,0x00}, - {0x3006 ,0xff}, - {0x3824 ,0x04}, - {0x5001 ,0x83}, - {0x3036 ,0x69}, - {0x3035 ,0x31}, - {0x4005 ,0x1A}, - {0xffff, 0xff}, -}; - -//5MP -const struct sensor_reg OV5640_5MP_JPEG[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0xA }, - {0x3809 ,0x20}, - {0x380a ,0x7 }, - {0x380b ,0x98}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//320x240 QVGA -const struct sensor_reg OV5640_QSXGA2QVGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xf0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//640x480 VGA -const struct sensor_reg OV5640_QSXGA2VGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x2 }, - {0x3809 ,0x80}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//800x480 WVGA -const struct sensor_reg OV5640_QSXGA2WVGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x3 }, - {0x3809 ,0x20}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x3810, 0x00}, - {0x3811, 0x10}, - {0x3812, 0x01}, - {0x3813, 0x48}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//352x288 CIF -const struct sensor_reg OV5640_QSXGA2CIF[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x1 }, - {0x3809 ,0x60}, - {0x380a ,0x1 }, - {0x380b ,0x20}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x3810, 0x00}, - {0x3811, 0x10}, - {0x3812, 0x00}, - {0x3813, 0x70}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//1280x960 SXGA -const struct sensor_reg OV5640_QSXGA2SXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x5 }, - {0x3809 ,0x0 }, - {0x380a ,0x3 }, - {0x380b ,0xc0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, - -}; - -//2048x1536 QXGA -const struct sensor_reg OV5640_QSXGA2QXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x8 }, - {0x3809 ,0x0 }, - {0x380a ,0x6 }, - {0x380b ,0x0 }, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - -//1600x1200 UXGA -const struct sensor_reg OV5640_QSXGA2UXGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x6 }, - {0x3809 ,0x40}, - {0x380a ,0x4 }, - {0x380b ,0xb0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -//1024x768 XGA -const struct sensor_reg OV5640_QSXGA2XGA[] = -{ - {0x3800 ,0x00}, - {0x3801 ,0x00}, - {0x3802 ,0x00}, - {0x3803 ,0x00}, - {0x3804 ,0xA }, - {0x3805 ,0x3f}, - {0x3806 ,0x7 }, - {0x3807 ,0x9f}, - {0x3808 ,0x4 }, - {0x3809 ,0x0 }, - {0x380a ,0x3 }, - {0x380b ,0x0 }, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0xa3}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - -#endif - diff --git a/SPI_Camera/src/ov5642_regs.h b/SPI_Camera/src/ov5642_regs.h deleted file mode 100644 index 3740efc..0000000 --- a/SPI_Camera/src/ov5642_regs.h +++ /dev/null @@ -1,2528 +0,0 @@ -#ifndef OV5642_REGS_H -#define OV5642_REGS_H -#include "ArduCAM.h" - -#define OV5642_CHIPID_HIGH 0x300a -#define OV5642_CHIPID_LOW 0x300b -const struct sensor_reg ov5642_RAW[] = -{ -{0x3103,0x03}, -{0x3008,0x82}, -{0x3017,0x7f}, -{0x3018,0xfc}, -{0x3810,0xc2}, -{0x3615,0xf0}, -{0x3000,0x00}, -{0x3001,0x00}, -{0x3002,0x00}, -{0x3003,0x00}, -{0x3011,0x08}, -{0x3010,0x30}, -{0x3604,0x60}, -{0x3622,0x08}, -{0x3621,0x17}, -{0x3709,0x00}, -{0x4000,0x21}, -{0x401d,0x02}, -{0x3600,0x54}, -{0x3605,0x04}, -{0x3606,0x3f}, -{0x3c01,0x80}, -{0x300d,0x21}, -{0x3623,0x22}, -{0x5000,0xcf}, -{0x5001,0xFF}, -{0x5020,0x04}, -{0x5181,0x79}, -{0x5182,0x00}, -{0x5185,0x22}, -{0x5197,0x01}, -{0x5500,0x0a}, -{0x5504,0x00}, -{0x5505,0x7f}, -{0x5080,0x08}, -{0x300e,0x18}, -{0x4610,0x00}, -{0x471d,0x05}, -{0x4708,0x06}, -{0x3710,0x10}, -{0x370d,0x06}, -{0x3632,0x41}, -{0x3702,0x40}, -{0x3620,0x37}, -{0x3631,0x01}, -{0x370c,0xa0}, -{0x3808,0x0a}, -{0x3809,0x20}, -{0x380a,0x07}, -{0x380b,0x98}, -{0x380c,0x0c}, -{0x380d,0x80}, -{0x380e,0x07}, -{0x380f,0xd0}, -{0x5000,0x06}, -{0x501f,0x03}, -{0x3503,0x07}, -{0x3501,0x73}, -{0x3502,0x80}, -{0x350b,0x00}, -{0x3818,0xc0}, -{0x3621,0x27}, -{0x3801,0x8a}, -{0x3a00,0x78}, -{0x3a1a,0x04}, -{0x3a13,0x30}, -{0x3a18,0x00}, -{0x3a19,0x7c}, -{0x3a08,0x12}, -{0x3a09,0xc0}, -{0x3a0a,0x0f}, -{0x3a0b,0xa0}, -{0x3004,0xff}, -{0x350c,0x07}, -{0x350d,0xd0}, -{0x3a0d,0x08}, -{0x3a0e,0x06}, -{0x3500,0x00}, -{0x3501,0x00}, -{0x3502,0x00}, -{0x350a,0x00}, -{0x350b,0x00}, -{0x3503,0x00}, -{0x3030,0x2b}, -{0x3a02,0x00}, -{0x3a03,0x7d}, -{0x3a04,0x00}, -{0x3a14,0x00}, -{0x3a15,0x7d}, -{0x3a16,0x00}, -{0x3a00,0x78}, -{0x3a08,0x09}, -{0x3a09,0x60}, -{0x3a0a,0x07}, -{0x3a0b,0xd0}, -{0x3a0d,0x10}, -{0x3a0e,0x0d}, -{0x3620,0x57}, -{0x3703,0x98}, -{0x3704,0x1c}, -{0x589b,0x00}, -{0x589a,0xc0}, -{0x3633,0x07}, -{0x3702,0x10}, -{0x3703,0xb2}, -{0x3704,0x18}, -{0x370b,0x40}, -{0x370d,0x02}, -{0x3620,0x52}, -{0x5000,0x06}, -{0x5001,0xff}, -{0x5005,0x00}, -{0x3818,0x80}, -{0x3621,0x17}, -{0x3801,0xb4}, -{0x3001,0x40}, -{0x3002,0x1c}, -{0x3810,0x00}, -{0x3818,0x00}, -{0x460c,0x20}, -{0x501f,0x03}, -{0x4300,0xf8}, - -{0xffff,0xff}, -}; - - - -const struct sensor_reg OV5642_1280x960_RAW[] = -{ -{0x3103,0x93}, -{0x3008,0x02}, -{0x3017,0x7f}, -{0x3018,0xf0}, -{0x3615,0xf0}, -{0x3000,0xF8}, -{0x3001,0x48}, -{0x3002,0x5c}, -{0x3003,0x02}, -{0x3005,0xB7}, -{0x3006,0x43}, -{0x3007,0x37}, -{0x300f,0x06}, -{0x3011,0x08}, -{0x3010,0x20}, -{0x3012,0x00}, -{0x460c,0x22}, -{0x3815,0x04}, -{0x370c,0xA0}, -{0x3602,0xFC}, -{0x3612,0xFF}, -{0x3634,0xC0}, -{0x3613,0x00}, -{0x3622,0x00}, -{0x3603,0x27}, -{0x4000,0x21}, -{0x401D,0x02}, -{0x3600,0x54}, -{0x3605,0x04}, -{0x3606,0x3F}, -{0x5020,0x04}, -{0x5197,0x01}, -{0x5001,0xFF}, -{0x5500,0x10}, -{0x5502,0x00}, -{0x5503,0x04}, -{0x5504,0x00}, -{0x5505,0x7F}, -{0x5080,0x08}, -{0x300E,0x18}, -{0x4610,0x00}, -{0x471D,0x05}, -{0x4708,0x06}, -{0x3710,0x10}, -{0x3632,0x41}, -{0x3631,0x01}, -{0x501F,0x03}, -{0x3604,0x40}, -{0x4300,0x00}, -{0x3824,0x11}, -{0x5000,0x4F}, -{0x3818,0xC1}, -{0x3705,0xDB}, -{0x370A,0x81}, -{0x3621,0xC7}, -{0x3800,0x03}, -{0x3801,0xE8}, -{0x3802,0x03}, -{0x3803,0xE8}, -{0x3804,0x38}, -{0x3805,0x00}, -{0x3806,0x03}, -{0x3807,0xC0}, -{0x3808,0x05}, -{0x3809,0x00}, -{0x380A,0x03}, -{0x380B,0xC0}, -{0x380C,0x0A}, -{0x380D,0xF0}, -{0x380E,0x03}, -{0x380F,0xE8}, -{0x3827,0x08}, -{0x3810,0xC0}, -{0x5683,0x00}, -{0x5686,0x03}, -{0x5687,0xC0}, -{0x3A1A,0x04}, -{0x3A13,0x30}, -{0x3004,0xDF}, -{0x350C,0x07}, -{0x350D,0xD0}, -{0x3500,0x35}, -{0x3501,0x00}, -{0x3502,0x00}, -{0x350A,0x00}, -{0x350B,0x00}, -{0x3503,0x00}, -{0x5682,0x05}, -{0x3A0F,0x78}, -{0x3A11,0xD0}, -{0x3A1B,0x7A}, -{0x3A1E,0x66}, -{0x3A1F,0x40}, -{0x3A10,0x68}, -{0x3030,0x0B}, -{0x3A01,0x04}, -{0x3A02,0x00}, -{0x3A03,0x78}, -{0x3A04,0x00}, -{0x3A05,0x30}, -{0x3A14,0x00}, -{0x3A15,0x64}, -{0x3A16,0x00}, -{0x3A17,0x89}, -{0x3A18,0x00}, -{0x3A19,0x70}, -{0x3A00,0x78}, -{0x3A08,0x12}, -{0x3A09,0xC0}, -{0x3A0A,0x0F}, -{0x3A0B,0xA0}, -{0x3A0D,0x04}, -{0x3A0E,0x03}, -{0x3C00,0x04}, -{0x3C01,0xB4}, -{0x5688,0xFD}, -{0x5689,0xDF}, -{0x568A,0xFE}, -{0x568B,0xEF}, -{0x568C,0xFE}, -{0x568D,0xEF}, -{0x568E,0xAA}, -{0x568F,0xAA}, -{0x589B,0x04}, -{0x589A,0xC5}, -{0x528A,0x00}, -{0x528B,0x02}, -{0x528C,0x08}, -{0x528D,0x10}, -{0x528E,0x20}, -{0x528F,0x28}, -{0x5290,0x30}, -{0x5292,0x00}, -{0x5293,0x00}, -{0x5294,0x00}, -{0x5295,0x02}, -{0x5296,0x00}, -{0x5297,0x08}, -{0x5298,0x00}, -{0x5299,0x10}, -{0x529A,0x00}, -{0x529B,0x20}, -{0x529C,0x00}, -{0x529D,0x28}, -{0x529E,0x00}, -{0x5282,0x00}, -{0x529F,0x30}, -{0x5300,0x00}, -{0x5302,0x00}, -{0x5303,0x7C}, -{0x530C,0x00}, -{0x530D,0x0C}, -{0x530E,0x20}, -{0x530F,0x80}, -{0x5310,0x20}, -{0x5311,0x80}, -{0x5308,0x20}, -{0x5309,0x40}, -{0x5304,0x00}, -{0x5305,0x30}, -{0x5306,0x00}, -{0x5307,0x80}, -{0x5314,0x08}, -{0x5315,0x20}, -{0x5319,0x30}, -{0x5316,0x10}, -{0x5317,0x08}, -{0x5318,0x02}, -{0x5380,0x01}, -{0x5381,0x20}, -{0x5382,0x00}, -{0x5383,0x4E}, -{0x5384,0x00}, -{0x5385,0x0F}, -{0x5386,0x00}, -{0x5387,0x00}, -{0x5388,0x01}, -{0x5389,0x15}, -{0x538A,0x00}, -{0x538B,0x31}, -{0x538C,0x00}, -{0x538D,0x00}, -{0x538E,0x00}, -{0x538F,0x0F}, -{0x5390,0x00}, -{0x5391,0xAB}, -{0x5392,0x00}, -{0x5393,0xA2}, -{0x5394,0x08}, -{0x5301,0x20}, -{0x5480,0x14}, -{0x5482,0x03}, -{0x5483,0x57}, -{0x5484,0x65}, -{0x5485,0x71}, -{0x5481,0x21}, -{0x5486,0x7D}, -{0x5487,0x87}, -{0x5488,0x91}, -{0x5489,0x9A}, -{0x548A,0xAA}, -{0x548B,0xB8}, -{0x548C,0xCD}, -{0x548D,0xDD}, -{0x548E,0xEA}, -{0x548F,0x10}, -{0x5490,0x05}, -{0x5491,0x00}, -{0x5492,0x04}, -{0x5493,0x20}, -{0x5494,0x03}, -{0x5495,0x60}, -{0x5496,0x02}, -{0x5497,0xB8}, -{0x5498,0x02}, -{0x5499,0x86}, -{0x549A,0x02}, -{0x549B,0x5B}, -{0x549C,0x02}, -{0x549D,0x3B}, -{0x549E,0x02}, -{0x549F,0x1C}, -{0x54A0,0x02}, -{0x54A1,0x04}, -{0x54A2,0x01}, -{0x54A3,0xED}, -{0x54A4,0x01}, -{0x54A5,0xC5}, -{0x54A6,0x01}, -{0x54A7,0xA5}, -{0x54A8,0x01}, -{0x54A9,0x6C}, -{0x54AA,0x01}, -{0x54AB,0x41}, -{0x54AC,0x01}, -{0x54AD,0x20}, -{0x54AE,0x00}, -{0x54AF,0x16}, -{0x3406,0x00}, -{0x5192,0x04}, -{0x5191,0xF8}, -{0x5193,0x70}, -{0x5194,0xF0}, -{0x5195,0xF0}, -{0x518D,0x3D}, -{0x518F,0x54}, -{0x518E,0x3D}, -{0x5190,0x54}, -{0x518B,0xC0}, -{0x518C,0xBD}, -{0x5187,0x18}, -{0x5188,0x18}, -{0x5189,0x6E}, -{0x518A,0x68}, -{0x5186,0x1C}, -{0x5181,0x50}, -{0x5182,0x11}, -{0x5183,0x14}, -{0x5184,0x25}, -{0x5185,0x24}, -{0x5025,0x82}, -{0x5583,0x40}, -{0x5584,0x40}, -{0x5580,0x02}, -{0x3633,0x07}, -{0x3702,0x10}, -{0x3703,0xB2}, -{0x3704,0x18}, -{0x370B,0x40}, -{0x370D,0x02}, -{0x3620,0x52}, - -{0xffff,0xff}, -}; - -const struct sensor_reg OV5642_1920x1080_RAW[] = -{ - -{0x3808,0x07}, -{0x3809,0x80}, -{0x380A,0x04}, -{0x380B,0x38}, -{0xffff,0xff}, -}; - -const struct sensor_reg OV5642_640x480_RAW[] = -{ - /* -{0x3800,0x03}, -{0x3801,0xE8}, -{0x3802,0x03}, -{0x3803,0xE8}, -{0x3804,0x38}, -{0x3805,0x00}, -{0x3806,0x03}, -{0x3807,0xC0}, -*/ -{0x3808,0x02}, -{0x3809,0x80}, -{0x380A,0x01}, -{0x380B,0xe0}, -{0xffff,0xff}, -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const struct sensor_reg ov5642_320x240[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xa8}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xF0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0x3801, 0xb0}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_640x480[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xa8}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x2 }, - {0x3809 ,0x80}, - {0x380a ,0x1 }, - {0x380b ,0xe0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0x3801, 0xb0}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1280x960[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x5 }, - {0x3809 ,0x00}, - {0x380a ,0x3 }, - {0x380b ,0xC0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1600x1200[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x6 }, - {0x3809 ,0x40}, - {0x380a ,0x4 }, - {0x380b ,0xB0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_1024x768[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0x4 }, - {0x3809 ,0x0}, - {0x380a ,0x3 }, - {0x380b ,0x0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - - - - -const struct sensor_reg ov5642_2048x1536[] = -{ - {0x3800 ,0x01}, - {0x3801 ,0xb0}, - {0x3802 ,0x00}, - {0x3803 ,0x0a}, - {0x3804 ,0x0a}, - {0x3805 ,0x20}, - {0x3806 ,0x07}, - {0x3807 ,0x98}, - - {0x3808 ,0x08}, - {0x3809 ,0x00}, - {0x380a ,0x06}, - {0x380b ,0x00}, - - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x3810 ,0xc2}, - {0x3815 ,0x44}, - {0x3818 ,0xa8}, - {0x3824 ,0x01}, - {0x3827 ,0x0a}, - {0x3a00 ,0x78}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x3a00 ,0x78}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x471c ,0x50}, - {0x5682 ,0x0a}, - {0x5683 ,0x20}, - {0x5686 ,0x07}, - {0x5687 ,0x98}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4300 ,0x32}, - {0x460b ,0x35}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x02}, - {0x4600 ,0x80}, - {0x4721 ,0x02}, - {0x471c ,0x40}, - {0x4408 ,0x00}, - {0x460c ,0x22}, - {0x3815 ,0x04}, - {0x3818 ,0xc8}, - {0x501f ,0x00}, - {0x5002 ,0xe0}, - {0x440a ,0x01}, - {0x4402 ,0x90}, - {0x3811 ,0xf0}, - {0x3818, 0xa8}, - {0x3621, 0x10}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_2592x1944[] = -{ - {0x3800 ,0x1 }, - {0x3801 ,0xB0}, - {0x3802 ,0x0 }, - {0x3803 ,0xA }, - {0x3804 ,0xA }, - {0x3805 ,0x20}, - {0x3806 ,0x7 }, - {0x3807 ,0x98}, - {0x3808 ,0xA }, - {0x3809 ,0x20}, - {0x380a ,0x7 }, - {0x380b ,0x98}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0xA }, - {0x5683 ,0x20}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x7 }, - {0x5687 ,0x98}, - {0xffff, 0xff}, -}; - -const struct sensor_reg ov5642_dvp_zoom8[] = -{ - - {0x3800 ,0x5 }, - {0x3801 ,0xf8}, - {0x3802 ,0x3 }, - {0x3803 ,0x5c}, - {0x3804 ,0x1 }, - {0x3805 ,0x44}, - {0x3806 ,0x0 }, - {0x3807 ,0xf0}, - {0x3808 ,0x1 }, - {0x3809 ,0x40}, - {0x380a ,0x0 }, - {0x380b ,0xf0}, - {0x380c ,0xc }, - {0x380d ,0x80}, - {0x380e ,0x7 }, - {0x380f ,0xd0}, - - {0x5001 ,0x7f}, - {0x5680 ,0x0 }, - {0x5681 ,0x0 }, - {0x5682 ,0x1 }, - {0x5683 ,0x44}, - {0x5684 ,0x0 }, - {0x5685 ,0x0 }, - {0x5686 ,0x0 }, - {0x5687 ,0xf3}, - /* - {0x381c ,0x21}, - {0x3524 ,0x0 }, - {0x3825 ,0x0 }, - {0x3826 ,0x0 }, - {0x3827 ,0x0 }, - {0x3010 ,0x70}, -*/ - - {0xffff, 0xff}, -}; - -const struct sensor_reg OV5642_QVGA_Preview[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x5c}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3005 ,0xff}, - {0x3006 ,0x43}, - {0x3007 ,0x37}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x460c ,0x22}, - {0x3815 ,0x04}, - {0x370c ,0xa0}, - {0x3602 ,0xfc}, - {0x3612 ,0xff}, - {0x3634 ,0xc0}, - {0x3613 ,0x00}, - {0x3605 ,0x7c}, - {0x3621 ,0x09}, - {0x3622 ,0x60}, - {0x3604 ,0x40}, - {0x3603 ,0xa7}, - {0x3603 ,0x27}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5001 ,0xff}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x3808 ,0x02}, - {0x3809 ,0x80}, - {0x380a ,0x01}, - {0x380b ,0xe0}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x4300 ,0x30}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3503 ,0x07}, - {0x3824 ,0x11}, - {0x3501 ,0x1e}, - {0x3502 ,0x80}, - {0x350b ,0x7f}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x03}, - {0x380f ,0xe8}, - {0x3a0d ,0x04}, - {0x3a0e ,0x03}, - {0x3818 ,0xc1}, - {0x3705 ,0xdb}, - {0x370a ,0x81}, - {0x3801 ,0x80}, - {0x3621 ,0x87}, - {0x3801 ,0x50}, - {0x3803 ,0x08}, - {0x3827 ,0x08}, - {0x3810 ,0x40}, - {0x3804 ,0x05}, - {0x3805 ,0x00}, - {0x5682 ,0x05}, - {0x5683 ,0x00}, - {0x3806 ,0x03}, - {0x3807 ,0xc0}, - {0x5686 ,0x03}, - {0x5687 ,0xbc}, - {0x3a00 ,0x78}, - {0x3a1a ,0x05}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x528a ,0x02}, - {0x528b ,0x04}, - {0x528c ,0x08}, - {0x528d ,0x08}, - {0x528e ,0x08}, - {0x528f ,0x10}, - {0x5290 ,0x10}, - {0x5292 ,0x00}, - {0x5293 ,0x02}, - {0x5294 ,0x00}, - {0x5295 ,0x02}, - {0x5296 ,0x00}, - {0x5297 ,0x02}, - {0x5298 ,0x00}, - {0x5299 ,0x02}, - {0x529a ,0x00}, - {0x529b ,0x02}, - {0x529c ,0x00}, - {0x529d ,0x02}, - {0x529e ,0x00}, - {0x529f ,0x02}, - {0x3030 ,0x0b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x5193 ,0x70}, - {0x589b ,0x04}, - {0x589a ,0xc5}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x04}, - {0x528a ,0x01}, - {0x528b ,0x04}, - {0x528c ,0x08}, - {0x528d ,0x10}, - {0x528e ,0x20}, - {0x528f ,0x28}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x01}, - {0x5294 ,0x00}, - {0x5295 ,0x04}, - {0x5296 ,0x00}, - {0x5297 ,0x08}, - {0x5298 ,0x00}, - {0x5299 ,0x10}, - {0x529a ,0x00}, - {0x529b ,0x20}, - {0x529c ,0x00}, - {0x529d ,0x28}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x0c}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x06}, - {0x5187 ,0x08}, - {0x5188 ,0x08}, - {0x5189 ,0x7c}, - {0x518a ,0x60}, - {0x518b ,0xb2}, - {0x518c ,0xb2}, - {0x518d ,0x44}, - {0x518e ,0x3d}, - {0x518f ,0x58}, - {0x5190 ,0x46}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x04}, - {0x5199 ,0x12}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0x82}, - {0x519e ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3808 ,0x01}, - {0x3809 ,0x40}, - {0x380a ,0x00}, - {0x380b ,0xf0}, - {0x3a00 ,0x78}, - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - - - - {0xffff,0xff}, -}; - -const struct sensor_reg OV5642_JPEG_Capture_QSXGA[] = -{ - // OV5642_ QSXGA _YUV7.5 fps - // 24 MHz input clock, 24Mhz pclk - // jpeg mode 7.5fps - - {0x3503 ,0x07}, //AEC Manual Mode Control - {0x3000 ,0x00}, //SYSTEM RESET00 - {0x3001 ,0x00}, //Reset for Individual Block - {0x3002 ,0x00}, //Reset for Individual Block - {0x3003 ,0x00}, //Reset for Individual Block - {0x3005 ,0xff}, //Clock Enable Control - {0x3006 ,0xff}, //Clock Enable Control - {0x3007 ,0x3f}, //Clock Enable Control - {0x350c ,0x07}, //AEC VTS Output high bits - {0x350d ,0xd0}, //AEC VTS Output low bits - {0x3602 ,0xe4}, //Analog Control Registers - {0x3612 ,0xac}, //Analog Control Registers - {0x3613 ,0x44}, //Analog Control Registers - {0x3621 ,0x27}, //Array Control 01 - {0x3622 ,0x08}, //Analog Control Registers - {0x3623 ,0x22}, //Analog Control Registers - {0x3604 ,0x60}, //Analog Control Registers - {0x3705 ,0xda}, //Analog Control Registers - {0x370a ,0x80}, //Analog Control Registers - {0x3801 ,0x8a}, //HS - {0x3803 ,0x0a}, //VS - {0x3804 ,0x0a}, //HW - {0x3805 ,0x20}, //HW - {0x3806 ,0x07}, //VH - {0x3807 ,0x98}, //VH - {0x3808 ,0x0a}, //DVPHO - {0x3809 ,0x20}, //DVPHO - {0x380a ,0x07}, //DVPVO - {0x380b ,0x98}, //DVPVO - {0x380c ,0x0c}, //HTS - {0x380d ,0x80}, //HTS - {0x380e ,0x07}, //VTS - {0x380f ,0xd0}, //VTS - {0x3810 ,0xc2}, - {0x3815 ,0x44}, - {0x3818 ,0xc8}, //Mirror NO, Compression enable - {0x3824 ,0x01}, //RSV - {0x3827 ,0x0a}, //RSV - {0x3a00 ,0x78}, //AEC System Control 0 - {0x3a0d ,0x10}, //60 Hz Max Bands in One Frame - {0x3a0e ,0x0d}, //50 Hz Max Bands in One Frame - {0x3a10 ,0x32}, //Stable Range Low Limit (enter) - {0x3a1b ,0x3c}, //Stable Range High Limit (go out) - {0x3a1e ,0x32}, //Stable Range Low Limit (go out) - {0x3a11 ,0x80}, //Step Manual Mode, Fast Zone High Limit - {0x3a1f ,0x20}, //Step Manual Mode, Fast Zone Low Limit - {0x3a00 ,0x78}, //AEC System Control 0 - {0x460b ,0x35}, //RSV VFIFO Control 0B - {0x471d ,0x00}, //DVP CONTROL 1D - {0x4713 ,0x03}, //COMPRESSION MODE SELECT mode3 - {0x471c ,0x50}, //RSV - {0x5682 ,0x0a}, //AVG X END - {0x5683 ,0x20}, //AVG X END - {0x5686 ,0x07}, //AVG Y END - {0x5687 ,0x98}, //AVG Y END - {0x5001 ,0x4f}, //ISP CONTROL 01, UV adjust/Line stretch/UV average/Color matrix/AWB enable - {0x589b ,0x00}, //RSV - {0x589a ,0xc0}, //RSV - {0x4407 ,0x08}, //COMPRESSION CTRL07 Bit[5:0]: Quantization scale 0x02 - {0x589b ,0x00}, //RSV - {0x589a ,0xc0}, //RSV - {0x3002 ,0x0c}, //Reset for Individual Block, Reset SFIFO/compression - {0x3002 ,0x00}, //Reset for Individual Block - {0x3503 ,0x00}, //AEC Manual Mode Control, Auto enable - //{0x3818, 0xa8}, - //{0x3621, 0x17}, - //{0x3801, 0xb0}, - {0x5025, 0x80}, - {0x3a0f, 0x48}, - {0x3a10, 0x40}, - {0x3a1b, 0x4a}, - {0x3a1e, 0x3e}, - {0x3a11, 0x70}, - {0x3a1f, 0x20}, - {0xffff, 0xff}, - -}; - - -const struct sensor_reg OV5642_1080P_Video_setting[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x00}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3030 ,0x0b}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x3604 ,0x60}, - {0x3622 ,0x60}, - {0x3621 ,0x09}, - {0x3709 ,0x00}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x300d ,0x22}, - {0x3623 ,0x22}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x370c ,0xa0}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x5687 ,0x94}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x5001 ,0xcf}, - {0x4300 ,0x30}, - {0x4300 ,0x30}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x03}, - {0x471c ,0x50}, - {0x4721 ,0x02}, - {0x4402 ,0x90}, - {0x460c ,0x22}, - {0x3815 ,0x44}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3818 ,0xc8}, - {0x3801 ,0x88}, - {0x3824 ,0x11}, - {0x3a00 ,0x78}, - {0x3a1a ,0x04}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x3030 ,0x0b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x4407 ,0x04}, - {0x5193 ,0x70}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x06}, - {0x3825 ,0xac}, - {0x3827 ,0x0c}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x06}, - {0x5187 ,0x08}, - {0x5188 ,0x08}, - {0x5189 ,0x7c}, - {0x518a ,0x60}, - {0x518b ,0xb2}, - {0x518c ,0xb2}, - {0x518d ,0x44}, - {0x518e ,0x3d}, - {0x518f ,0x58}, - {0x5190 ,0x46}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x04}, - {0x5199 ,0x12}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0x82}, - {0x519e ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3503 ,0x07}, - {0x3011 ,0x07}, - {0x350c ,0x04}, - {0x350d ,0x58}, - {0x3801 ,0x8a}, - {0x3803 ,0x0a}, - {0x3804 ,0x07}, - {0x3805 ,0x80}, - {0x3806 ,0x04}, - {0x3807 ,0x38}, - {0x3808 ,0x07}, - {0x3809 ,0x80}, - {0x380a ,0x04}, - {0x380b ,0x38}, - {0x380c ,0x09}, - {0x380d ,0xd6}, - {0x380e ,0x04}, - {0x380f ,0x58}, - {0x381c ,0x11}, - {0x381d ,0xba}, - {0x381e ,0x04}, - {0x381f ,0x48}, - {0x3820 ,0x04}, - {0x3821 ,0x18}, - {0x3a08 ,0x14}, - {0x3a09 ,0xe0}, - {0x3a0a ,0x11}, - {0x3a0b ,0x60}, - {0x3a0d ,0x04}, - {0x3a0e ,0x03}, - {0x5682 ,0x07}, - {0x5683 ,0x60}, - {0x5686 ,0x04}, - {0x5687 ,0x1c}, - {0x5001 ,0x7f}, - {0x3503 ,0x00}, - {0x3010 ,0x10}, - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - {0x3010, 0x00}, - {0x3818, 0xa8}, - {0x3621, 0x27}, - - {0xffff, 0xff}, -}; - -const struct sensor_reg OV5642_720P_Video_setting[] = -{ - {0x3103 ,0x93}, - {0x3008 ,0x82}, - {0x3017 ,0x7f}, - {0x3018 ,0xfc}, - {0x3810 ,0xc2}, - {0x3615 ,0xf0}, - {0x3000 ,0x00}, - {0x3001 ,0x00}, - {0x3002 ,0x00}, - {0x3003 ,0x00}, - {0x3004 ,0xff}, - {0x3030 ,0x2b}, - {0x3011 ,0x08}, - {0x3010 ,0x10}, - {0x3604 ,0x60}, - {0x3622 ,0x60}, - {0x3621 ,0x09}, - {0x3709 ,0x00}, - {0x4000 ,0x21}, - {0x401d ,0x22}, - {0x3600 ,0x54}, - {0x3605 ,0x04}, - {0x3606 ,0x3f}, - {0x3c01 ,0x80}, - {0x300d ,0x22}, - {0x3623 ,0x22}, - {0x5000 ,0x4f}, - {0x5020 ,0x04}, - {0x5181 ,0x79}, - {0x5182 ,0x00}, - {0x5185 ,0x22}, - {0x5197 ,0x01}, - {0x5500 ,0x0a}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - {0x5080 ,0x08}, - {0x300e ,0x18}, - {0x4610 ,0x00}, - {0x471d ,0x05}, - {0x4708 ,0x06}, - {0x370c ,0xa0}, - {0x3808 ,0x0a}, - {0x3809 ,0x20}, - {0x380a ,0x07}, - {0x380b ,0x98}, - {0x380c ,0x0c}, - {0x380d ,0x80}, - {0x380e ,0x07}, - {0x380f ,0xd0}, - {0x5687 ,0x94}, - {0x501f ,0x00}, - {0x5000 ,0x4f}, - {0x5001 ,0xcf}, - {0x4300 ,0x30}, - {0x4300 ,0x30}, - {0x460b ,0x35}, - {0x471d ,0x00}, - {0x3002 ,0x0c}, - {0x3002 ,0x00}, - {0x4713 ,0x03}, - {0x471c ,0x50}, - {0x4721 ,0x02}, - {0x4402 ,0x90}, - {0x460c ,0x22}, - {0x3815 ,0x44}, - {0x3503 ,0x07}, - {0x3501 ,0x73}, - {0x3502 ,0x80}, - {0x350b ,0x00}, - {0x3818 ,0xc8}, - {0x3801 ,0x88}, - {0x3824 ,0x11}, - {0x3a00 ,0x78}, - {0x3a1a ,0x04}, - {0x3a13 ,0x30}, - {0x3a18 ,0x00}, - {0x3a19 ,0x7c}, - {0x3a08 ,0x12}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x0f}, - {0x3a0b ,0xa0}, - {0x350c ,0x07}, - {0x350d ,0xd0}, - {0x3a0d ,0x08}, - {0x3a0e ,0x06}, - {0x3500 ,0x00}, - {0x3501 ,0x00}, - {0x3502 ,0x00}, - {0x350a ,0x00}, - {0x350b ,0x00}, - {0x3503 ,0x00}, - {0x3030 ,0x2b}, - {0x3a02 ,0x00}, - {0x3a03 ,0x7d}, - {0x3a04 ,0x00}, - {0x3a14 ,0x00}, - {0x3a15 ,0x7d}, - {0x3a16 ,0x00}, - {0x3a00 ,0x78}, - {0x3a08 ,0x09}, - {0x3a09 ,0x60}, - {0x3a0a ,0x07}, - {0x3a0b ,0xd0}, - {0x3a0d ,0x10}, - {0x3a0e ,0x0d}, - {0x4407 ,0x04}, - {0x5193 ,0x70}, - {0x589b ,0x00}, - {0x589a ,0xc0}, - {0x401e ,0x20}, - {0x4001 ,0x42}, - {0x401c ,0x06}, - {0x3825 ,0xac}, - {0x3827 ,0x0c}, - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - {0x3406 ,0x00}, - {0x5025 ,0x80}, - {0x5583 ,0x40}, - {0x5584 ,0x40}, - {0x5580 ,0x02}, - {0x5000 ,0xcf}, - {0x3710 ,0x10}, - {0x3632 ,0x51}, - {0x3702 ,0x10}, - {0x3703 ,0xb2}, - {0x3704 ,0x18}, - {0x370b ,0x40}, - {0x370d ,0x03}, - {0x3631 ,0x01}, - {0x3632 ,0x52}, - {0x3606 ,0x24}, - {0x3620 ,0x96}, - {0x5785 ,0x07}, - {0x3a13 ,0x30}, - {0x3600 ,0x52}, - {0x3604 ,0x48}, - {0x3606 ,0x1b}, - {0x370d ,0x0b}, - {0x370f ,0xc0}, - {0x3709 ,0x01}, - {0x3823 ,0x00}, - {0x5007 ,0x00}, - {0x5009 ,0x00}, - {0x5011 ,0x00}, - {0x5013 ,0x00}, - {0x519e ,0x00}, - {0x5086 ,0x00}, - {0x5087 ,0x00}, - {0x5088 ,0x00}, - {0x5089 ,0x00}, - {0x302b ,0x00}, - {0x3503 ,0x07}, - {0x3011 ,0x08}, - {0x350c ,0x02}, - {0x350d ,0xe4}, - {0x3621 ,0xc9}, - {0x370a ,0x81}, - {0x3803 ,0x08}, - {0x3804 ,0x05}, - {0x3805 ,0x00}, - {0x3806 ,0x02}, - {0x3807 ,0xd0}, - {0x3808 ,0x05}, - {0x3809 ,0x00}, - {0x380a ,0x02}, - {0x380b ,0xd0}, - {0x380c ,0x08}, - {0x380d ,0x72}, - {0x380e ,0x02}, - {0x380f ,0xe4}, - {0x3810 ,0xc0}, - {0x3818 ,0xc9}, - {0x381c ,0x10}, - {0x381d ,0xa0}, - {0x381e ,0x05}, - {0x381f ,0xb0}, - {0x3820 ,0x00}, - {0x3821 ,0x00}, - {0x3824 ,0x11}, - {0x3a08 ,0x1b}, - {0x3a09 ,0xc0}, - {0x3a0a ,0x17}, - {0x3a0b ,0x20}, - {0x3a0d ,0x02}, - {0x3a0e ,0x01}, - {0x401c ,0x04}, - {0x5682 ,0x05}, - {0x5683 ,0x00}, - {0x5686 ,0x02}, - {0x5687 ,0xcc}, - {0x5001 ,0x7f}, - {0x589b ,0x06}, - {0x589a ,0xc5}, - {0x3503 ,0x00}, - {0x3010 ,0x10}, - - {0x5001 ,0xFF}, - {0x5583 ,0x50}, - {0x5584 ,0x50}, - {0x5580 ,0x02}, - - {0x3c01 ,0x80}, - {0x3c00 ,0x04}, - - {0x5800 ,0x48}, - {0x5801 ,0x31}, - {0x5802 ,0x21}, - {0x5803 ,0x1b}, - {0x5804 ,0x1a}, - {0x5805 ,0x1e}, - {0x5806 ,0x29}, - {0x5807 ,0x38}, - {0x5808 ,0x26}, - {0x5809 ,0x17}, - {0x580a ,0x11}, - {0x580b ,0xe }, - {0x580c ,0xd }, - {0x580d ,0xe }, - {0x580e ,0x13}, - {0x580f ,0x1a}, - {0x5810 ,0x15}, - {0x5811 ,0xd }, - {0x5812 ,0x8 }, - {0x5813 ,0x5 }, - {0x5814 ,0x4 }, - {0x5815 ,0x5 }, - {0x5816 ,0x9 }, - {0x5817 ,0xd }, - {0x5818 ,0x11}, - {0x5819 ,0xa }, - {0x581a ,0x4 }, - {0x581b ,0x0 }, - {0x581c ,0x0 }, - {0x581d ,0x1 }, - {0x581e ,0x6 }, - {0x581f ,0x9 }, - {0x5820 ,0x12}, - {0x5821 ,0xb }, - {0x5822 ,0x4 }, - {0x5823 ,0x0 }, - {0x5824 ,0x0 }, - {0x5825 ,0x1 }, - {0x5826 ,0x6 }, - {0x5827 ,0xa }, - {0x5828 ,0x17}, - {0x5829 ,0xf }, - {0x582a ,0x9 }, - {0x582b ,0x6 }, - {0x582c ,0x5 }, - {0x582d ,0x6 }, - {0x582e ,0xa }, - {0x582f ,0xe }, - {0x5830 ,0x28}, - {0x5831 ,0x1a}, - {0x5832 ,0x11}, - {0x5833 ,0xe }, - {0x5834 ,0xe }, - {0x5835 ,0xf }, - {0x5836 ,0x15}, - {0x5837 ,0x1d}, - {0x5838 ,0x6e}, - {0x5839 ,0x39}, - {0x583a ,0x27}, - {0x583b ,0x1f}, - {0x583c ,0x1e}, - {0x583d ,0x23}, - {0x583e ,0x2f}, - {0x583f ,0x41}, - {0x5840 ,0xe }, - {0x5841 ,0xc }, - {0x5842 ,0xd }, - {0x5843 ,0xc }, - {0x5844 ,0xc }, - {0x5845 ,0xc }, - {0x5846 ,0xc }, - {0x5847 ,0xc }, - {0x5848 ,0xd }, - {0x5849 ,0xe }, - {0x584a ,0xe }, - {0x584b ,0xa }, - {0x584c ,0xe }, - {0x584d ,0xe }, - {0x584e ,0x10}, - {0x584f ,0x10}, - {0x5850 ,0x11}, - {0x5851 ,0xa }, - {0x5852 ,0xf }, - {0x5853 ,0xe }, - {0x5854 ,0x10}, - {0x5855 ,0x10}, - {0x5856 ,0x10}, - {0x5857 ,0xa }, - {0x5858 ,0xe }, - {0x5859 ,0xe }, - {0x585a ,0xf }, - {0x585b ,0xf }, - {0x585c ,0xf }, - {0x585d ,0xa }, - {0x585e ,0x9 }, - {0x585f ,0xd }, - {0x5860 ,0xc }, - {0x5861 ,0xb }, - {0x5862 ,0xd }, - {0x5863 ,0x7 }, - {0x5864 ,0x17}, - {0x5865 ,0x14}, - {0x5866 ,0x18}, - {0x5867 ,0x18}, - {0x5868 ,0x16}, - {0x5869 ,0x12}, - {0x586a ,0x1b}, - {0x586b ,0x1a}, - {0x586c ,0x16}, - {0x586d ,0x16}, - {0x586e ,0x18}, - {0x586f ,0x1f}, - {0x5870 ,0x1c}, - {0x5871 ,0x16}, - {0x5872 ,0x10}, - {0x5873 ,0xf }, - {0x5874 ,0x13}, - {0x5875 ,0x1c}, - {0x5876 ,0x1e}, - {0x5877 ,0x17}, - {0x5878 ,0x11}, - {0x5879 ,0x11}, - {0x587a ,0x14}, - {0x587b ,0x1e}, - {0x587c ,0x1c}, - {0x587d ,0x1c}, - {0x587e ,0x1a}, - {0x587f ,0x1a}, - {0x5880 ,0x1b}, - {0x5881 ,0x1f}, - {0x5882 ,0x14}, - {0x5883 ,0x1a}, - {0x5884 ,0x1d}, - {0x5885 ,0x1e}, - {0x5886 ,0x1a}, - {0x5887 ,0x1a}, - - {0x5180 ,0xff}, - {0x5181 ,0x52}, - {0x5182 ,0x11}, - {0x5183 ,0x14}, - {0x5184 ,0x25}, - {0x5185 ,0x24}, - {0x5186 ,0x14}, - {0x5187 ,0x14}, - {0x5188 ,0x14}, - {0x5189 ,0x69}, - {0x518a ,0x60}, - {0x518b ,0xa2}, - {0x518c ,0x9c}, - {0x518d ,0x36}, - {0x518e ,0x34}, - {0x518f ,0x54}, - {0x5190 ,0x4c}, - {0x5191 ,0xf8}, - {0x5192 ,0x04}, - {0x5193 ,0x70}, - {0x5194 ,0xf0}, - {0x5195 ,0xf0}, - {0x5196 ,0x03}, - {0x5197 ,0x01}, - {0x5198 ,0x05}, - {0x5199 ,0x2f}, - {0x519a ,0x04}, - {0x519b ,0x00}, - {0x519c ,0x06}, - {0x519d ,0xa0}, - {0x519e ,0xa0}, - - {0x528a ,0x00}, - {0x528b ,0x01}, - {0x528c ,0x04}, - {0x528d ,0x08}, - {0x528e ,0x10}, - {0x528f ,0x20}, - {0x5290 ,0x30}, - {0x5292 ,0x00}, - {0x5293 ,0x00}, - {0x5294 ,0x00}, - {0x5295 ,0x01}, - {0x5296 ,0x00}, - {0x5297 ,0x04}, - {0x5298 ,0x00}, - {0x5299 ,0x08}, - {0x529a ,0x00}, - {0x529b ,0x10}, - {0x529c ,0x00}, - {0x529d ,0x20}, - {0x529e ,0x00}, - {0x529f ,0x30}, - {0x5282 ,0x00}, - {0x5300 ,0x00}, - {0x5301 ,0x20}, - {0x5302 ,0x00}, - {0x5303 ,0x7c}, - {0x530c ,0x00}, - {0x530d ,0x10}, - {0x530e ,0x20}, - {0x530f ,0x80}, - {0x5310 ,0x20}, - {0x5311 ,0x80}, - {0x5308 ,0x20}, - {0x5309 ,0x40}, - {0x5304 ,0x00}, - {0x5305 ,0x30}, - {0x5306 ,0x00}, - {0x5307 ,0x80}, - {0x5314 ,0x08}, - {0x5315 ,0x20}, - {0x5319 ,0x30}, - {0x5316 ,0x10}, - {0x5317 ,0x00}, - {0x5318 ,0x02}, - - {0x5380 ,0x01}, - {0x5381 ,0x00}, - {0x5382 ,0x00}, - {0x5383 ,0x1f}, - {0x5384 ,0x00}, - {0x5385 ,0x06}, - {0x5386 ,0x00}, - {0x5387 ,0x00}, - {0x5388 ,0x00}, - {0x5389 ,0xE1}, - {0x538A ,0x00}, - {0x538B ,0x2B}, - {0x538C ,0x00}, - {0x538D ,0x00}, - {0x538E ,0x00}, - {0x538F ,0x10}, - {0x5390 ,0x00}, - {0x5391 ,0xB3}, - {0x5392 ,0x00}, - {0x5393 ,0xA6}, - {0x5394 ,0x08}, - - {0x5480 ,0x0c}, - {0x5481 ,0x18}, - {0x5482 ,0x2f}, - {0x5483 ,0x55}, - {0x5484 ,0x64}, - {0x5485 ,0x71}, - {0x5486 ,0x7d}, - {0x5487 ,0x87}, - {0x5488 ,0x91}, - {0x5489 ,0x9a}, - {0x548A ,0xaa}, - {0x548B ,0xb8}, - {0x548C ,0xcd}, - {0x548D ,0xdd}, - {0x548E ,0xea}, - {0x548F ,0x1d}, - {0x5490 ,0x05}, - {0x5491 ,0x00}, - {0x5492 ,0x04}, - {0x5493 ,0x20}, - {0x5494 ,0x03}, - - {0x5495 ,0x60}, - {0x5496 ,0x02}, - {0x5497 ,0xB8}, - {0x5498 ,0x02}, - {0x5499 ,0x86}, - {0x549A ,0x02}, - {0x549B ,0x5B}, - {0x549C ,0x02}, - {0x549D ,0x3B}, - {0x549E ,0x02}, - {0x549F ,0x1C}, - {0x54A0 ,0x02}, - {0x54A1 ,0x04}, - {0x54A2 ,0x01}, - {0x54A3 ,0xED}, - {0x54A4 ,0x01}, - {0x54A5 ,0xC5}, - {0x54A6 ,0x01}, - {0x54A7 ,0xA5}, - {0x54A8 ,0x01}, - {0x54A9 ,0x6C}, - {0x54AA ,0x01}, - {0x54AB ,0x41}, - {0x54AC ,0x01}, - {0x54AD ,0x20}, - {0x54AE ,0x00}, - {0x54AF ,0x16}, - {0x54B0 ,0x01}, - {0x54B1 ,0x20}, - {0x54B2 ,0x00}, - {0x54B3 ,0x10}, - {0x54B4 ,0x00}, - {0x54B5 ,0xf0}, - {0x54B6 ,0x00}, - {0x54B7 ,0xDF}, - - {0x5402 ,0x3f}, - {0x5403 ,0x00}, - - {0x5500 ,0x10}, - {0x5502 ,0x00}, - {0x5503 ,0x06}, - {0x5504 ,0x00}, - {0x5505 ,0x7f}, - - {0x5025 ,0x80}, - {0x3a0f ,0x30}, - {0x3a10 ,0x28}, - {0x3a1b ,0x30}, - {0x3a1e ,0x28}, - {0x3a11 ,0x61}, - {0x3a1f ,0x10}, - {0x5688 ,0xfd}, - {0x5689 ,0xdf}, - {0x568a ,0xfe}, - {0x568b ,0xef}, - {0x568c ,0xfe}, - {0x568d ,0xef}, - {0x568e ,0xaa}, - {0x568f ,0xaa}, - {0x3818, 0xa8}, - {0x3621, 0x27}, - {0xffff, 0xff}, - -}; - -#endif - diff --git a/SPI_Camera/src/sccb_bus.c b/SPI_Camera/src/sccb_bus.c deleted file mode 100644 index 1dd9f00..0000000 --- a/SPI_Camera/src/sccb_bus.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "sccb_bus.h" -#include "bcm283x_board_driver.h" -#define SCCB_SIC_H() digitalWrite(scl_port,HIGH) //SCL H -#define SCCB_SIC_L() digitalWrite(scl_port,LOW) //SCL H - -#define SCCB_SID_H() digitalWrite(sda_port,HIGH) //SDA H -#define SCCB_SID_L() digitalWrite(sda_port,LOW) //SDA H - - -#define SCCB_DATA_IN pinMode(sda_port, INPUT); -#define SCCB_DATA_OUT pinMode(sda_port, OUTPUT); - -#define SCCB_SID_STATE digitalRead(sda_port) - - -unsigned char I2C_TIM = 30; -void sccb_bus_init(void) -{ - pinMode(sda_port, OUTPUT); - pinMode(scl_port, OUTPUT); - digitalWrite(sda_port, HIGH); - digitalWrite(scl_port, HIGH); -} - -void sccb_bus_start(void) -{ - SCCB_SID_H(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); -} - -void sccb_bus_stop(void) -{ - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SID_H(); - delay_us(I2C_TIM); -} - -void sccb_bus_send_noack(void) -{ - SCCB_SID_H(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); -} - -void sccb_bus_send_ack(void) -{ - SCCB_SID_L(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - SCCB_SIC_L(); - delay_us(I2C_TIM); - SCCB_SID_L(); - delay_us(I2C_TIM); -} - -unsigned char sccb_bus_write_byte(unsigned char data) -{ - unsigned char i; - unsigned char tem; - for(i = 0; i < 8; i++) - { - if((data< 0; i--) - { - delay_us(I2C_TIM); - SCCB_SIC_H(); - delay_us(I2C_TIM); - read = read << 1; - if(SCCB_SID_STATE) - { - read += 1; - } - SCCB_SIC_L(); - delay_us(I2C_TIM); - } - SCCB_DATA_OUT; - return read; -} - diff --git a/SPI_Camera/src/sccb_bus.h b/SPI_Camera/src/sccb_bus.h deleted file mode 100644 index 54b44b9..0000000 --- a/SPI_Camera/src/sccb_bus.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef _SCCB_BUS_H_ -#define _SCCB_BUS_H_ - -#define sda_port 2 -#define scl_port 3 - - - - - -#define SCCB_SIC_H() digitalWrite(scl_port,HIGH) //SCL H -#define SCCB_SIC_L() digitalWrite(scl_port,LOW) //SCL H - -#define SCCB_SID_H() digitalWrite(sda_port,HIGH) //SDA H -#define SCCB_SID_L() digitalWrite(sda_port,LOW) //SDA H - - -#define SCCB_DATA_IN pinMode(sda_port, INPUT); -#define SCCB_DATA_OUT pinMode(sda_port, OUTPUT); - -#define SCCB_SID_STATE digitalRead(sda_port) - -void sccb_bus_init(void); -void sccb_bus_start(void); -void sccb_bus_stop(void); -void sccb_bus_send_noack(void); -void sccb_bus_send_ack(void); -unsigned char sccb_bus_write_byte(unsigned char data); -unsigned char sccb_bus_read_byte(void); - -extern unsigned char I2C_TIM; -#endif /* _SCCB_BUS_H_ */ - -/******************* (C) COPYRIGHT 2015 WangBao *****END OF FILE****/