📄 ms_frame.c
字号:
/*******************************************************************************
* Mouse sensor frame capture. *
* Syntax: Imager = Ms_Frame(Port) *
* *
* Input Parameters: *
* ================ *
* *
* Port --------> Parallel port base address decimal (positive integer). *
* *
* Output Parameters: *
* ================= *
* *
* Imager ------> Image array, 30x30 pixels, 6 bit grayscale (array). *
* *
* See also Ms_Power(), Ms_Reset(). *
* *
* Compile: mex -v ms_frame.c ms_spi.c inpout32.lib *
* Version: 02-02-2005 *
* *
* (C) 2005 Stephan Hengstler, Stanford Wireless Sensor Networks Lab *
*******************************************************************************/
#include <stdio.h>
#include <windows.h>
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
{
double *result;
short port;
/* define mouse sensor parameters */
const int MS_IMG_WIDTH = 30; // Image array: Width.
const int MS_IMG_HEIGHT = 30; // Image array: Height.
/* get the value(s) of the input variable(s) */
port = (short) mxGetScalar(prhs[0]);
/* set the value(s) of the output variable(s) */
plhs[0] = mxCreateDoubleMatrix(MS_IMG_WIDTH, MS_IMG_HEIGHT, mxREAL);
result = mxGetPr(plhs[0]);
/* call the respective subroutine(s) */
ms_frame(port, result);
/* show debug information */
if (nrhs == 2)
{
printf("Debug Information\n");
printf("port = %d\n", port);
}
/* clean exit */
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -