📄 camera.c
字号:
/*
* MX21 Camera Library API
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2004 Motorola Semiconductors Hong Kong.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <asm/mman.h>
#include <sys/mman.h>
#include <string.h>
#include "csi.h"
#include "csilib.h"
#include "im8012.h"
#include "im8012lib.h"
#include "camera.h"
static CSI_CFG g_csi_cfg;
static IM8012_CFG g_im8012_cfg;
extern void im8012_get_config(IM8012_CFG * _cfg, FILE * _fp);
void camera_run(void)
{
im8012_standby(0);
return;
}
void camera_stop(void)
{
im8012_standby(1);
return;
}
int camera_init(FILE * _sensor_cfg_file)
{
//csi config
csi_open();
csi_select_config(TIMING_IMAGIC_RGB_PRP, &g_csi_cfg);
csi_config(&g_csi_cfg);
csi_dump_config();
//sensor config
im8012_open();
im8012_i2c_test();
im8012_select_config(IM8012_RGB_QVGA, &g_im8012_cfg);
if(_sensor_cfg_file)
//in case using config file
im8012_get_config(&g_im8012_cfg, _sensor_cfg_file);
im8012_config(&g_im8012_cfg);
//printf("camera init done\n");
return 0;
}
void camera_exit(void)
{
im8012_close();
csi_close();
//printf("camera exit\n");
return;
}
void camera_set_preview_mode(void)
{
im8012_set_preview_mode();
//elapse for 1 frame
csi_poll_sof();
return;
}
void camera_set_capture_mode(void)
{
im8012_set_capture_mode();
//elapse for 1 frame
csi_poll_sof();
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -