Then I had 2 doubts:
1. How to use the UART interface inside a device driver?
Do you mean the apps/netutils/esp8266 code? That is not a device
driver, it is an application. It uses the serial driver interface
/dev/ttySx: open(), close(), read(), write(), etc.
Inside of the OS under nuttx/drivers, you can open the serial driver
using file_open(), file_read(), file_write(), file_close(). These are
driver/file system interfaces for use inside of the OS where there may
not be consistent file descriptors.
2. Is it ok to duplicate the AT commands? Maybe this question was answered :-)
INVIOLABLES.md:
99 ### Sometimes Code Duplication is OK
100
101 - Sometimes is better to duplicate some logic than to
introduce coupling.