Serial
UART0 port of TWELITE (mwx::serial_jen)
Implement mwx::stream
and input/output with UART0 of TWELITE.
The
Serial
object is initialized at system startup with UART0, 115200 bps, and the initialization process is performed in the library. On the user code, it is available fromsetup()
.The
Serial1
object is provided in the library, but no initialization process is performed; to enable UART1, perform the necessary initialization proceduresSerial1.setup(), Serial1.begin()
.
Output may become unstable during setup(), wakeup()
just after startup or flush
process just before sleep.
setup()
Initialize objects.
Allocate memory for FIFO buffers for TX/RX
Allocating memory for TWE_tsFILE structure
Serial
(UART0) will automatically call setup()
in the library. There is no need for a user call.
Also, the buffer size of Serial
(UART0) is determined at compile time. You can change it by the macro MWX_SER_TX_BUFF
(768 if not specified) or MWX_SER_RX_BUFF
(256 if not specified).
Parameter | Description |
---|---|
| FIFO buffer size for TX |
| FIFO buffer size for RX |
begin()
Initialize hardware.
The Serial
(UART0) has an automatic begin()
call in the library. No user call is required.
Parameters | Description |
---|---|
| Specifies the baud rate of the UART. |
| When the |
The last two digits of the specified baud rate are rounded to zero. Also, due to hardware limitations, there may be an error from the specified baud rate.
When specifying 9600, 38400, or 115200, the baud rate is calculated without division. See constexpr uint16_t _serial_get_hect_baud(uint32_t baud)
for details of processing.
end()
(Not implemented) Stop using hardware.
get_tsFile()
Get a structure in the TWE_tsFILE*
format used in the C library.
In Serial (UART), the _sSerial
structure is defined.
最終更新