⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fpc1010.c

📁 基于dsp55系列的指纹识别系统。已调试通过
💻 C
字号:




/****************************************************************************
*
*              
*             TEXAS INSTRUMENTS PROPRIETARY INFORMATION
*
*  (c) Copyright, Texas Instruments Incorporated Ltd, 2003.
*      All Rights Reserved.
*
*  Property of Texas Instruments Incorporated. Restricted Rights -
*  Use, duplication, or disclosure is subject to restrictions set
*  forth in TI's program license agreement and associated documentation.
*
***************************************************************************** 
*****************************************************************************
*
* NAME: fpc1010.c
*   
*
* DESCRIPTION: file describing different function to read image from FPC1010 sensor.
*   
*
*   CREATED:       05/20/2002 
*   MODIFIED:      06/13/2003 
*                
*   
*
* 
*   
*
****************************************************************************/

/* include files */
#include <csl.h>
#include <csl_mcbsp.h>
#include <stdio.h>

#include "fpc1010.h"
#include "spi.h"

/*
 * Function name :  Sensor_init
 * Arguments     :  void 
 * Return value  :  void
 * Exceptions    : 
 * Description   :  Initialize the Sensor  
 */ 
    
void sensorInit(void)
{
	
	/* Hardware ware Reset  for 1 micor sec.*/
	
	SPI_RESET;
    SPI_SET;    
        
   	/* Initialization (part1) */
	SPI_ENABLE;
	SPI_txChar(RESET);
	SPI_DISABLE;
	SPI_ENABLE;
	SPI_txChar(SENSX);
	SPI_txChar(0x01);
	SPI_DISABLE;
	/* Initialization (part2) */
	SPI_ENABLE;
	SPI_txChar(SENSY);
	SPI_txChar(0x01);
	SPI_DISABLE;
	SPI_ENABLE;
	SPI_txChar(COMMAND);
	SPI_txChar(0x08);
	SPI_DISABLE;
}

/*
 * Function name :  Read_Image
 * Arguments     :  pointer, Address to store the image. 
 * Return value  :  void
 * Exceptions    : 
 * Description   :  Read the complete image 
 */
void readImage(unsigned char *image_ptr)  
{
	
	int numRows,numCols,i,j;
	unsigned char pix1, temp;
	unsigned volatile char dummy[6];
	unsigned char *temp_ptr;
	/* Read all 200 Rows */
	for(numRows=0;numRows<MAXROW  ;numRows++)
	{
    	temp_ptr = image_ptr;   
       	for(j=0;j<3;j++)
       	{
       		image_ptr = temp_ptr;
         	SPI_ENABLE;
	        SPI_txChar(READ_SHFTX);
            /* Ignore 32 clocks */
            for(i=0;i<5;i++) 
			    dummy[i]=SPI_rxChar();
            /* Capture 152 8bit pixel in each row */    	
            for(numCols=0; numCols<MAXCOLUMN;numCols++)
            {
            	pix1 = SPI_rxChar();
            	if(j==0)
            	{
	                *image_ptr++ = pix1;   /* image define in globally TODO */
    			}
    			else if(j==1)
    			{
	                *image_ptr++ += pix1;   /* image define in globally TODO */
    			}			
    			if(j==2)
    			{
    				temp = *image_ptr + pix1;
    				*image_ptr++ = ~temp;				
    			}	
    		}
    		
                    /* Ignore 16 clocks */
            for(i=0;i<2;i++) 
	            dummy[i]=SPI_rxChar();
	        SPI_DISABLE;
	    }
        SPI_ENABLE;
        SPI_txChar(READ_SHFTY);
        SPI_DISABLE;           
	}       
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -