claudeheintz/LXESP32DMX

Possibility to use the library with the M5stamp C3U

Opened this issue · 1 comments

Hello,
Thanks again for the amazing work you did, creating these wonderful sets of libraries,
For a project, I need a very small controller with a RS485 dmx receiver.
I was planning to use the M5stamp C3U
With the RS485 module
I make a little try with the modules (connecting the RX of the modules), a DMX Enttec pro MK2 and the LXESP32DMX library. To make it compile I had to make small changes in the LXHardwareSerial.cpp
here,
line 62
// ********************** MODIF JULIEN #ifdef CONFIG_IDF_TARGET_ESP32C3 asm volatile ("rdcycle x1" : "=r" (ccount) ); #else __asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) ); #endif if(ccount < lccount){ //********************* MODIF JULIEN #ifdef CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ overflow += UINT32_MAX / CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ; #else overflow += UINT32_MAX / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; #endif } lccount = ccount; portEXIT_CRITICAL_ISR(&privateMicrosMux); //********* MODIF JULIEN #ifdef CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ return overflow + (ccount / CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ); #else return overflow + (ccount / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ); #endif

line 176
// ******** MODIFICATION JULIEN #ifdef UART2 return &UART2; #else return &UART1; #endif
line361
} else if( _uart_nr == 2 ) { // ******* MODIFICATION JULIEN: #ifdef U2TXD_OUT_IDX gpioSig = U2TXD_OUT_IDX; #else gpioSig = U1TXD_OUT_IDX; #endif

Then the program compile. But obviously it didn't work, because I was thought to be used with the UART2 and the modified_uart. I tried to make it receive Artnet... it work for fews frames and then reboot.
But before digging deeper, do you think it could possibly work, tweaking the original code? Do you think there is still a lot of work ? Thanks for your advice,
Julien