2
0
Эх сурвалжийг харах

fix a couple of gpio names (SPI/I2C)

Also a few "style" consistency changes so that within each file, look is the same, although different files can have different styles
Philippe G 4 жил өмнө
parent
commit
762c529563

+ 2 - 2
components/platform_console/cmd_i2ctools.c

@@ -1179,7 +1179,7 @@ cJSON * spiconfig_cb(){
 static void register_spiconfig(void)
 {
 	spiconfig_args.clear = arg_lit0(NULL, "clear", "Clear configuration");
-	spiconfig_args.clk = arg_int0("k", "clock", "<n>", "Clock GPIO");
+	spiconfig_args.clk = arg_int0("k", "clk", "<n>", "Clock GPIO");
 	spiconfig_args.data = arg_int0("d","data", "<n>","Data GPIO");
 	spiconfig_args.dc = arg_int0("c","dc", "<n>", "DC GPIO");
 	spiconfig_args.host= arg_int0("h", "host", "int", "SPI Host Number");
@@ -1198,7 +1198,7 @@ static void register_i2cconfig(void)
 {
 	i2cconfig_args.clear = arg_lit0(NULL, "clear", "Clear configuration");
     i2cconfig_args.port = arg_int0("p", "port", "0|1", "Port");
-    i2cconfig_args.freq = arg_int0("f", "freq", "int", "Frequency (Hz) e.g. 100000");
+    i2cconfig_args.freq = arg_int0("f", "speed", "int", "Frequency (Hz) e.g. 100000");
     i2cconfig_args.sda = arg_int0("d", "sda", "<n>", "SDA GPIO. e.g. 19");
     i2cconfig_args.scl = arg_int0("c", "scl", "<n>", "SCL GPIO. e.g. 18");
     i2cconfig_args.load = arg_lit0("l", "load", "Load Existing Configuration");

+ 6 - 10
components/services/accessors.c

@@ -47,6 +47,7 @@ esp_err_t config_i2c_set(const i2c_config_t * config, int port){
 	}
 	return ESP_OK;
 }
+
 /****************************************************************************************
  *
  */
@@ -259,32 +260,28 @@ esp_err_t get_gpio_structure(cJSON * gpio_entry, gpio_entry_t ** gpio){
 	cJSON * val = cJSON_GetObjectItem(gpio_entry,"gpio");
 	if(val){
 		(*gpio)->gpio= (int)val->valuedouble;
-	}
-	else {
+	} else {
 		ESP_LOGE(TAG,"gpio pin not found");
 		err=ESP_FAIL;
 	}
 	val = cJSON_GetObjectItem(gpio_entry,"name");
 	if(val){
 		(*gpio)->name= strdup(cJSON_GetStringValue(val));
-	}
-	else {
+	} else {
 		ESP_LOGE(TAG,"gpio name value not found");
 		err=ESP_FAIL;
 	}
 	val = cJSON_GetObjectItem(gpio_entry,"group");
 	if(val){
 		(*gpio)->group= strdup(cJSON_GetStringValue(val));
-	}
-	else {
+	} else {
 		ESP_LOGE(TAG,"gpio group value not found");
 		err=ESP_FAIL;
 	}
 	val = cJSON_GetObjectItem(gpio_entry,"fixed");
 	if(val){
 		(*gpio)->fixed= cJSON_IsTrue(val);
-	}
-	else {
+	} else {
 		ESP_LOGE(TAG,"gpio fixed indicator not found");
 		err=ESP_FAIL;
 	}
@@ -357,8 +354,7 @@ cJSON * get_gpio_list() {
 	if (bat_config) {
 		char *p;
 		int channel;
-		if ((p = strcasestr(bat_config, "channel") ) != NULL)
-		{
+		if ((p = strcasestr(bat_config, "channel") ) != NULL) {
 			channel = atoi(strchr(p, '=') + 1);
 			if(channel != -1){
 				if(adc1_pad_get_io_num(channel,&gpio_num )==ESP_OK){