@@ -27,9 +27,9 @@ const ethernet_config ethernetDevices[] = {
2727 // No Ethernet
2828 {
2929 },
30+ #if CONFIG_IDF_TARGET_ESP32
3031 // QuinLed-ESP32-Ethernet
3132 {
32-
3333 0 ,
3434 5 ,
3535 23 ,
@@ -102,39 +102,51 @@ const ethernet_config ethernetDevices[] = {
102102 ETH_PHY_LAN8720,
103103 ETH_CLOCK_GPIO0_OUT
104104 }
105+ #endif
106+ #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
107+
108+ #endif
109+
105110};
106111
107112/* *
108113 * Connect to ethernet
109114 * @param deviceNumber to use
110115 */
111116void EthManager::connectToEthernet (int8_t deviceNumber) {
117+ #if CONFIG_IDF_TARGET_ESP32
112118 ETH.begin (
119+ ethernetDevices[deviceNumber].type ,
113120 ethernetDevices[deviceNumber].address ,
114- ethernetDevices[deviceNumber].power ,
115121 ethernetDevices[deviceNumber].mdc ,
116122 ethernetDevices[deviceNumber].mdio ,
117- ethernetDevices[deviceNumber].type ,
123+ ethernetDevices[deviceNumber].power ,
118124 ethernetDevices[deviceNumber].clk_mode
119125 );
126+ #else
127+ // TODO fix this
128+ // ETH.begin(
129+ // ethernetDevices[deviceNumber].address,
130+ // ethernetDevices[deviceNumber].mdc,
131+ // ethernetDevices[deviceNumber].mdio,
132+ // ethernetDevices[deviceNumber].power
133+ // );
134+ #endif
120135}
121136
122137/* *
123138 * Deallocate ethernet pins
124139 * @param deviceNumber to deallocate
125140 */
126141void EthManager::deallocateEthernetPins (int8_t deviceNumber) {
127- const uint32_t MATRIX_DETACH_OUT_SIG = 0x100 ;
128- gpio_matrix_out (ethernetDevices[deviceNumber].address , MATRIX_DETACH_OUT_SIG, false , false );
129- gpio_matrix_out (ethernetDevices[deviceNumber].power , MATRIX_DETACH_OUT_SIG, false , false );
130- gpio_matrix_out (ethernetDevices[deviceNumber].mdc , MATRIX_DETACH_OUT_SIG, false , false );
131- gpio_matrix_out (ethernetDevices[deviceNumber].mdio , MATRIX_DETACH_OUT_SIG, false , false );
132- gpio_matrix_out (ethernetDevices[deviceNumber].clk_mode , MATRIX_DETACH_OUT_SIG, false , false );
133- pinMode (ethernetDevices[deviceNumber].address , INPUT);
134- pinMode (ethernetDevices[deviceNumber].power , INPUT);
135- pinMode (ethernetDevices[deviceNumber].mdc , INPUT);
136- pinMode (ethernetDevices[deviceNumber].mdio , INPUT);
137- pinMode (ethernetDevices[deviceNumber].clk_mode , INPUT);
142+ gpio_reset_pin ((gpio_num_t ) ethernetDevices[deviceNumber].address );
143+ gpio_reset_pin ((gpio_num_t ) ethernetDevices[deviceNumber].power );
144+ gpio_reset_pin ((gpio_num_t ) ethernetDevices[deviceNumber].mdc );
145+ gpio_reset_pin ((gpio_num_t ) ethernetDevices[deviceNumber].mdio );
146+ #if CONFIG_IDF_TARGET_ESP32
147+ gpio_reset_pin ((gpio_num_t ) ethernetDevices[deviceNumber].clk_mode );
148+ #endif
149+ delay (1 );
138150}
139151
140152#endif
0 commit comments