Ethernet + AirPlay fixes

This commit is contained in:
Philippe G
2021-10-30 12:05:46 -07:00
parent 1e45348e4a
commit a98b1d00b0
6 changed files with 131 additions and 6 deletions

View File

@@ -142,6 +142,23 @@ const i2s_platform_config_t * config_get_i2s_from_str(char * dac_config ){
return &i2s_dac_pin;
}
/****************************************************************************************
* Get eth config structure from config string
*/
const eth_config_t * config_get_eth_from_str(char * eth_config ){
static eth_config_t eth_pin = {
.mdc = -1,
.mdio = -1,
.rst = -1,
};
char * p=NULL;
if ((p = strcasestr(eth_config, "mdc")) != NULL) eth_pin.mdc = atoi(strchr(p, '=') + 1);
if ((p = strcasestr(eth_config, "mdio")) != NULL) eth_pin.mdio = atoi(strchr(p, '=') + 1);
if ((p = strcasestr(eth_config, "rst")) != NULL) eth_pin.rst = atoi(strchr(p, '=') + 1);
return &eth_pin;
}
/****************************************************************************************
* Get spdif config structure
*/
@@ -164,6 +181,18 @@ const i2s_platform_config_t * config_dac_get(){
return &i2s_dac_config;
}
/****************************************************************************************
* Get ethernet config structure
*/
const eth_config_t * config_eth_get( ){
char * config = config_alloc_get_str("eth_config", CONFIG_ETH_CONFIG, "mdc=" STR(CONFIG_MDC_IO)
",mdio=" STR(CONFIG_MDIO_IO) ",do=" STR(CONFIG_PHY_RST_IO));
static eth_config_t eth_config;
memcpy(&eth_config, config_get_eth_from_str(config), sizeof(eth_config));
free(config);
return &eth_config;
}
/****************************************************************************************
*
*/

View File

@@ -30,6 +30,12 @@ typedef struct {
bool rotate;
} display_config_t;
typedef struct {
int mdc;
int mdio;
int rst;
} eth_config_t;
typedef struct {
i2s_pin_config_t pin;
char model[32];
@@ -75,6 +81,7 @@ typedef struct {
} gpio_entry_t;
const display_config_t * config_display_get();
const eth_config_t * config_eth_get( );
esp_err_t config_display_set(const display_config_t * config);
esp_err_t config_i2c_set(const i2c_config_t * config, int port);
esp_err_t config_i2s_set(const i2s_platform_config_t * config, const char * nvs_name);