SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.53k stars 491 forks source link

how can I perform custom uart0 #533

Closed ashareye closed 6 years ago

ashareye commented 6 years ago

Hi

I want to write a special uart driver with some equipments. But I cannot find any way to change ISR of uart 0, just like lib-driver in the original esp-rtos-sdk.

Please give me some advice thank you!

Your sincerely

doragasu commented 6 years ago

As a starting point, you can have a look to extras/stdin_uart_interrupt/stdin_uart_interrupt.c. It has code to configure, set an interrupt handler and enable the receive interrupt for UART 0.

ashareye commented 6 years ago

thank you for reply, yes I saw the "extras/stdin_uart_interrupt/stdin_uart_interrupt.c", but when I try to turn off the all system printf function like #400, it didn't work, even I redefine "#define printf(...) ets_printf(__VA_ARGS__)" in plamform.h. how can I do then? Any suggestion is appreciated.

thanks again.

ashareye commented 6 years ago

for example, I compiled the examples/simple and changed it to run in AP mode with DHCP, when pc connected the AP-wifi, it always printed "station: 68:db:ca:4c:e2:74 join/leave, AID = 1" & "rm match", but I couldn't find the string "station:" in any source code, where does it come from and how can I git rid of it ???

ashareye commented 6 years ago

I found the way but not sure it always work.

  1. add printf sdk_printf & ets_printf sdk_ets_printf in lib/allsymbols.rename
  2. define sdk_printf & sdk_ets_printf func in main.c like this: int sdk_ets_printf(const char *format, ...) { return 0; } int sdk_printf(const char *format, ...) { return 0; }
  3. #define printf sdk_printf in main.c if you want turn off printf at all
  4. release your own printf that you need

then it print nothing with uart