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

📄 ms_power.c

📁 MatLab图像传感器网络仿真平台WiSNAP
💻 C
字号:
/*******************************************************************************
 * Mouse sensor power up/down.                                                 *
 * Syntax: Status = Ms_Power(Port, State)                                      *
 *                                                                             *
 *    Input Parameters:                                                        *
 *    ================                                                         *
 *                                                                             *
 *       Port --------> Parallel port base address decimal (positive integer). *
 *       State -------> Mouse sensor power state (integer):                    *
 *                      0 - power down.                                        *
 *                      1 - power up.                                          *
 *                                                                             *
 *    Output Parameters:                                                       *
 *    =================                                                        *
 *                                                                             *
 *       Status ------> Success status (-1 = error, +1 = success).             *
 *                                                                             *
 *    See also Ms_Frame(), Ms_Reset().                                         *
 *                                                                             *
 * Compile: mex -v ms_power.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;
	int         state, status;
	short	      port;

	/* get the value(s) of the input variable(s) */
	port 			= (short) mxGetScalar(prhs[0]);
	state		   = (short) mxGetScalar(prhs[1]);

	/* call the respective subroutine(s) */
   status     	= ms_power(port, state);

	/* set the value(s) of the output variable(s) */
	plhs[0] 		= mxCreateDoubleMatrix(1, 1, mxREAL);
   result		= mxGetPr(plhs[0]);
	*result		= status;

	/* show debug information */
	if (nrhs == 3)
	{
		printf("Debug Information\n");
		printf("port      = %d\n", port);
		printf("state     = %d\n", state);
		printf("status    = %d\n", status);
	}

	/* clean exit */
	return;
}

⌨️ 快捷键说明

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