//================================ // MCU2 Library // for G-4511 //================================ #ifndef MCU2LIB_H_ #define MCU2LIB_H_ #define MCU2_NOERROR 0 #define MCU2_TIMEOUT -1 #define MCU2_CMDERROR -2 #define MCU2_COMERROR -3 #ifdef __cplusplus extern "C" { #endif void MCU2_getLibVer(char* libVer); //== Get library Version //parameter: // libVer: a string of library version, format="V1.00 Jul 21 2010" int MCU2_init(void); //== MCU2 initial == // return: // 0: No Error // MCU2_CMDERROR: initial fail // MCU2_COMERROR: COM Port Error int MCU2_getFWVer(char* ver); //== get MCU2 Version == // return: // Ver: a string of MCU2 FW. version, format="2013/05/13 Ver100" int MCU2_setDo0(int status); //== set DO0 status == //parameter: // status: 0=OFF, 1=ON //return: // MCU2_NOERROR: No Error // MCU2_TIMEOUT: TIMEOUT Error int MCU2_getDioStatus(void); //== get DIO status == // return: // DI/O status: bit0=Di0, bit1=Do0 // MCU2_TIMEOUT: TIMEOUT ERROR int MCU2_Sleep(unsigned long ss); //== Sleep function == // Notice: precision of Timer in Sleep is +- 2/1000, for example: // MCU2_Sleep(1000) maybe sleep 1002 seconds // // parameter: // ss : seconds, 5~99999 seconds // return: // MCU2_NOERROR: No Error // MCU2_TIMEOUT: TIMEOUT Error // MCU2_CMDERROR: Command Error int MCU2_DeepSleep(unsigned long ss); //== Deep Sleep function == // Notice: precision of Timer in Sleep is +- 2/1000 // MCU2_DeepSleep(1000) maybe sleep 1002 second // // parameter: // ss : seconds, 5~99999 seconds // return: // MCU2_NOERROR: No Error // MCU2_TIMEOUT: TIMEOUT Error // MCU2_CMDERROR: Command Error float MCU2_getVBattery(void); //== Get Battery Voltage == // return: // Battery voltage: 10~15V // Error: 9999.0 int MCU2_EnableGSM(unsigned int en); //== Enable GSM power == // en=0 power off GSM module // en=1 power on GSM module // return: // MCU2_NOERROR: No Error // MCU2_TIMEOUT: TIMEOUT Error // MCU2_CMDERROR: Command Error int MCU2_BatteryProtect(unsigned int en); //== Enable Battery Protecting function == // this function will protect battery when battery's voltage is too low // when voltage of the battery is less then 11.1V, system power will shut down // until voltage of the battery is more than 12.6V // en=0 Disable Battery protecting // en=1 Enable Battery protecting // return: // MCU2_NOERROR: No Error // MCU2_TIMEOUT: TIMEOUT Error // MCU2_CMDERROR: Command Error #ifdef __cplusplus } #endif #endif //MCU2LIB_H_