123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- /*
- * Config.h
- *
- * Created on: 2020/01/15
- * Author: Eason Yang
- */
- #ifndef CONFIG_MAIN_H_
- #define CONFIG_MAIN_H_
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <dirent.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <termios.h>
- #include <errno.h>
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdint.h>
- #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
- #define ADC_AIN0 0
- #define ADC_AIN1 1
- #define ADC_AIN2 2
- #define ADC_AIN3 3
- typedef enum
- {
- GPIO_DIR_INPUT = 0,
- GPIO_DIR_OUTPUT
- }_GPIO_DIR;
- typedef enum
- {
- GPIO_IO_BD1_1 =0, // output
- GPIO_IO_BD1_2, // output
- GPIO_IO_BD2_1, // output
- GPIO_IO_BD2_2, // output
- GPIO_ID_BD1_1, // input
- GPIO_ID_BD1_2, // input
- GPIO_ID_BD2_1, // input
- GPIO_ID_BD2_2, // input
- GPIO_AM_RFID_RST, // output
- GPIO_AM_RFID_ICC, // output
- GPIO_BOARD1_PROXIMITY, // input
- GPIO_BOARD2_PROXIMITY, // input
- }_SYS_GPIO;
- #define SYS_GPIO_NUM 16
- #define PIN_IO_BD1_1 26
- #define PIN_IO_BD1_2 27
- #define PIN_IO_BD2_1 46
- #define PIN_IO_BD2_2 47
- #define PIN_ID_BD1_1 22
- #define PIN_ID_BD1_2 23
- #define PIN_ID_BD2_1 44
- #define PIN_ID_BD2_2 45
- #define PIN_AM_RFID_RST 19
- #define PIN_AM_RFID_ICC 20
- #define PIN_BOARD1_PROXIMITY 88
- #define PIN_BOARD2_PROXIMITY 86
- #define PIN_AM_DE_1 89
- #define PIN_AM_RE_1 87
- #define PIN_ENG_BNT 111
- extern int StoreLogMsg(const char *fmt, ...);
- enum
- {
- POLLING_STEP_0=0,
- POLLING_STEP_1,
- POLLING_STEP_2,
- POLLING_STEP_3,
- POLLING_STEP_4,
- POLLING_STEP_END
- };
- enum
- {
- ChargerSystemStatus_Booting=0,
- ChargerSystemStatus_Idle,
- ChargerSystemStatus_Authorizing,
- ChargerSystemStatus_Preparing,
- ChargerSystemStatus_Charging,
- ChargerSystemStatus_Terminating,
- ChargerSystemStatus_Alarm,
- ChargerSystemStatus_Fault
- };
- enum
- {
- RUN_STEP_0=0,
- RUN_STEP_1,
- RUN_STEP_2,
- RUN_STEP_3,
- RUN_STEP_4,
- RUN_STEP_END
- };
- void gpio_set_direction(int pin, unsigned char dir);
- void gpio_write(int pin, unsigned char value);
- int gpio_read(int pin);
- void InitIO(void);
- #define Relay1_on gpio_write(PIN_ID_BD1_1, 1);
- #define Relay1_off gpio_write(PIN_ID_BD1_1, 0);
- #define Relay2_on gpio_write(PIN_IO_BD1_1, 1);
- #define Relay2_off gpio_write(PIN_IO_BD1_1, 0);
- #define Relay3_on gpio_write(PIN_ID_BD2_1, 1);
- #define Relay3_off gpio_write(PIN_ID_BD2_1, 0);
- #define Relay4_on gpio_write(PIN_ID_BD1_2, 1);
- #define Relay4_off gpio_write(PIN_ID_BD1_2, 0);
- #define FAN1_on gpio_write(PIN_AM_RFID_RST, 1);
- #define FAN1_off gpio_write(PIN_AM_RFID_RST, 0);
- #define FAN2_on gpio_write(PIN_AM_RFID_ICC, 1);
- #define FAN2_off gpio_write(PIN_AM_RFID_ICC, 0);
- #define FAN3_on gpio_write(PIN_IO_BD2_2, 1);
- #define FAN3_off gpio_write(PIN_IO_BD2_2, 0);
- #define AIR_on gpio_write(PIN_IO_BD2_1, 1);
- #define AIR_off gpio_write(PIN_IO_BD2_1, 0);
- #define Battery_Start_charging system("/root/WebService startCharging 820 30"); //for TEST 10A
- #define Battery_Stop_charging system("/root/WebService stopCharging");
- #define ACTODC_Start_charging system("/root/WebService startCharging 750 200"); //for TEST 10A
- #define ACTODC_Stop_charging system("/root/WebService stopCharging");
- #define Read_EMSS_INFO system("/root/WebService readCharging");
- #define Default_Speed 1000
- #define Charging_Speed 6600
- #define MAX_Speed 12000
- #define TemperatureMax 1200
- #define TemperatureRecovery 900
- #define Temperature_20 1400
- #define Temperature_30 1447
- #define Temperature_40 1493
- #define Temperature_50 1541
- #define Temperature_60 1586
- typedef unsigned char UBYTE;
- typedef unsigned short UWORD;
- typedef unsigned int ULONG;
- typedef signed char SBYTE;
- typedef signed short SWORD;
- typedef signed int SLONG;
- typedef unsigned char byte;
- #endif /* CONFIG_MAIN_H_ */
|