Browse Source

2020.08.11 / Folus Wen

Actions:
1. RFID polling add ICC pin check to condition.

Files:
1. As follow commit history

Image version: D0.27.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 years ago
parent
commit
fc8718dbed
1 changed files with 54 additions and 2 deletions
  1. 54 2
      EVSE/Projects/AW-CCS/Apps/main.c

+ 54 - 2
EVSE/Projects/AW-CCS/Apps/main.c

@@ -671,6 +671,10 @@ void InitGPIO()
 	sleep(3);
 	system("echo 0 > /sys/class/gpio/gpio114/value");
 
+	/*RFID ICC:GPIO0_20 => H:ON; L:OFF*/
+	system("echo 20 > /sys/class/gpio/export");
+	system("echo \"in\" > /sys/class/gpio/gpio20/direction");
+
 	DEBUG_INFO("Initial GPIO OK\r\n");
 }
 
@@ -1164,6 +1168,54 @@ unsigned char isModeChange(unsigned char gun_index)
 	return result;
 }
 
+void gpio_set_value(unsigned int gpio, unsigned int value)
+{
+	int fd;
+	char buf[256];
+
+	sprintf(buf, "/sys/class/gpio%d/value", gpio);
+	fd = open(buf, O_WRONLY);
+	if (fd < 0)
+	{
+		DEBUG_ERROR("GPIO-%d set %d fail.\n", gpio, value);
+	    return;
+	}
+
+	if (value)
+		write(fd, "1", 2);
+	else
+	    write(fd, "0", 2);
+
+	close(fd);
+}
+
+int gpio_get_value(unsigned int gpio)
+{
+    int fd;
+    char buf[256];
+    char ch;
+    int8_t result = FAIL;
+
+    sprintf(buf, "/sys/class/gpio%d/value", gpio);
+
+    fd = open(buf, O_RDONLY);
+    if (fd < 0)
+    {
+        DEBUG_ERROR("GPIO-%d get fail\n", gpio);
+        return result;
+    }
+
+    read(fd, &ch, 1);
+    if (ch != '0')
+        result = 1;
+    else
+        result = 0;
+
+    close(fd);
+
+    return result;
+}
+
 //===============================================
 // Get firmware version
 //===============================================
@@ -1196,7 +1248,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.26.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.27.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)
@@ -2160,7 +2212,7 @@ int main(void)
 		//==========================================
 		// Check RFID
 		//==========================================
-		if(!ShmCharger->gun_info[ShmCharger->gun_selectd].rfidReq)
+		if(!ShmCharger->gun_info[ShmCharger->gun_selectd].rfidReq && (gpio_get_value(20) == ON))
 		{
 			if(GetCardSerialNumber()!= FAIL)
 			{