mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
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
This commit is contained in:
@@ -1179,7 +1179,7 @@ cJSON * spiconfig_cb(){
|
|||||||
static void register_spiconfig(void)
|
static void register_spiconfig(void)
|
||||||
{
|
{
|
||||||
spiconfig_args.clear = arg_lit0(NULL, "clear", "Clear configuration");
|
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.data = arg_int0("d","data", "<n>","Data GPIO");
|
||||||
spiconfig_args.dc = arg_int0("c","dc", "<n>", "DC GPIO");
|
spiconfig_args.dc = arg_int0("c","dc", "<n>", "DC GPIO");
|
||||||
spiconfig_args.host= arg_int0("h", "host", "int", "SPI Host Number");
|
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.clear = arg_lit0(NULL, "clear", "Clear configuration");
|
||||||
i2cconfig_args.port = arg_int0("p", "port", "0|1", "Port");
|
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.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.scl = arg_int0("c", "scl", "<n>", "SCL GPIO. e.g. 18");
|
||||||
i2cconfig_args.load = arg_lit0("l", "load", "Load Existing Configuration");
|
i2cconfig_args.load = arg_lit0("l", "load", "Load Existing Configuration");
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ esp_err_t config_i2c_set(const i2c_config_t * config, int port){
|
|||||||
}
|
}
|
||||||
return ESP_OK;
|
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");
|
cJSON * val = cJSON_GetObjectItem(gpio_entry,"gpio");
|
||||||
if(val){
|
if(val){
|
||||||
(*gpio)->gpio= (int)val->valuedouble;
|
(*gpio)->gpio= (int)val->valuedouble;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ESP_LOGE(TAG,"gpio pin not found");
|
ESP_LOGE(TAG,"gpio pin not found");
|
||||||
err=ESP_FAIL;
|
err=ESP_FAIL;
|
||||||
}
|
}
|
||||||
val = cJSON_GetObjectItem(gpio_entry,"name");
|
val = cJSON_GetObjectItem(gpio_entry,"name");
|
||||||
if(val){
|
if(val){
|
||||||
(*gpio)->name= strdup(cJSON_GetStringValue(val));
|
(*gpio)->name= strdup(cJSON_GetStringValue(val));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ESP_LOGE(TAG,"gpio name value not found");
|
ESP_LOGE(TAG,"gpio name value not found");
|
||||||
err=ESP_FAIL;
|
err=ESP_FAIL;
|
||||||
}
|
}
|
||||||
val = cJSON_GetObjectItem(gpio_entry,"group");
|
val = cJSON_GetObjectItem(gpio_entry,"group");
|
||||||
if(val){
|
if(val){
|
||||||
(*gpio)->group= strdup(cJSON_GetStringValue(val));
|
(*gpio)->group= strdup(cJSON_GetStringValue(val));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ESP_LOGE(TAG,"gpio group value not found");
|
ESP_LOGE(TAG,"gpio group value not found");
|
||||||
err=ESP_FAIL;
|
err=ESP_FAIL;
|
||||||
}
|
}
|
||||||
val = cJSON_GetObjectItem(gpio_entry,"fixed");
|
val = cJSON_GetObjectItem(gpio_entry,"fixed");
|
||||||
if(val){
|
if(val){
|
||||||
(*gpio)->fixed= cJSON_IsTrue(val);
|
(*gpio)->fixed= cJSON_IsTrue(val);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ESP_LOGE(TAG,"gpio fixed indicator not found");
|
ESP_LOGE(TAG,"gpio fixed indicator not found");
|
||||||
err=ESP_FAIL;
|
err=ESP_FAIL;
|
||||||
}
|
}
|
||||||
@@ -357,8 +354,7 @@ cJSON * get_gpio_list() {
|
|||||||
if (bat_config) {
|
if (bat_config) {
|
||||||
char *p;
|
char *p;
|
||||||
int channel;
|
int channel;
|
||||||
if ((p = strcasestr(bat_config, "channel") ) != NULL)
|
if ((p = strcasestr(bat_config, "channel") ) != NULL) {
|
||||||
{
|
|
||||||
channel = atoi(strchr(p, '=') + 1);
|
channel = atoi(strchr(p, '=') + 1);
|
||||||
if(channel != -1){
|
if(channel != -1){
|
||||||
if(adc1_pad_get_io_num(channel,&gpio_num )==ESP_OK){
|
if(adc1_pad_get_io_num(channel,&gpio_num )==ESP_OK){
|
||||||
|
|||||||
Reference in New Issue
Block a user