Porting a library from ATMega to ESP8266 (UART issue)
Posted: Sat Oct 21, 2017 1:19 pm
I'm working on a project in which I want to replace an Arduino Nano with an ESP8266. The one and only library I'm using uses some direct UART controlling using calls like:
Since the ESP8266 doesn't have the same registers, this obviously ain't going to work (it doesn't compile). Is there a simple way to convert this to ESP8266-specific code? Or will this be a very tedious and error-prone task?
Code: Select all
UBRRH = 0;
UBRRL = 0x0F;
UCSRA = 0;
UCSRB = (1<<RXEN) | (1<<TXEN) | (1<<RXCIE) | (1<<UCSZ2);
UCSRC = (1<<UCSZ1) | (1<<UCSZ0);
Since the ESP8266 doesn't have the same registers, this obviously ain't going to work (it doesn't compile). Is there a simple way to convert this to ESP8266-specific code? Or will this be a very tedious and error-prone task?