﻿/* Macros and variables are made in the form of a structure for easy folding. */

struct{ // Variables. Must be initialized before use.
	int cnt;
}vars;

struct{ // Macros.
	#define SPIDER_ADDR 1
	#define OUTPUT_1	1
	#define OUTPUT_2	2
	#define OUTPUT_3	3
	#define OUTPUT_4	4
	#define INPUT_1		10001
	#define INPUT_2		10002
	#define INPUT_3		10003
	#define INPUT_4		10004
	#define NULL  ((void*)0x00000000)
}defs;

/******************************************************************************************
* Do not change the prototype of the main function, do not put the closing parenthesis '}' at the end of the function body *
******************************************************************************************/
void main(
	int *pTmpInt, // System variables, do not use
	float *pTmpFlt, // System variables, do not use
  	int (*pInts), /* Pointer to an array of integer variables, accessible via ModBus, 32 bit */
	float (*pFloats), /* Pointer to an array of floating point variables, accessible via ModBus, 32 bit */
	int (pKeyH), /* High 32 bits of 1-wire key */
	int (pKeyL), /* Lowest 32 bits of 1-wire key */
	int (*pGetNodeVar)( unsigned short dev_addr, unsigned short reg_addr ), /* Reading a variable from a node  */
	int (*pSetNodeVar)( unsigned short dev_addr, unsigned short reg_addr, unsigned short val ), /* Writing a variable value to a node */
	int (*pGetTimer)( unsigned short TimerNum ), /* Returns the timer value, (-1) -> off */
	int (*pSetTimer)( unsigned short TimerNum, int TimerVal ), /* Raises timer, (-1) -> off */
	int (*pReceiveSMS)( const char *smsnum, const char *smstext, int *parInt, float *parFlt ),/* Receive SMS */
	int (*pSendSMS)( const char *smsnum, const char *smstext, int *parInt, float *parFlt ), /* Send sms */
	int (*pSendCom2)( const char *TxData, unsigned short TxLen, const char *RxData, unsigned short RxLen), /* Send data over Com2 */
	int (*pTimeCmp)( unsigned char date, unsigned char month, unsigned char year, unsigned char hour, unsigned char minute, unsigned char second, unsigned char day, unsigned char act ), /* Compares time, act: 1'==', 2'!=', 3'>', 4'<' , 5'>=' , 6'<=' */
	float (*pSinf)(float _X),
	float (*pCosf)(float _X),
	float (*pLogf)(float _X),
	float (*pExpf)(float _X),
	float (*pPowf)(float _X1, float _X2),
	float (*pSqrtf)(float _X)
)
{
/* Function body   */


