mwx::stream
and performs input/output on TWELITE’s UART0.- The
Serial
object is initialized at system startup with UART0 at 115200 bps, and the initialization process is handled within the library. It can be used fromsetup()
in user code. - The
Serial1
object is provided within the library but is not initialized. To enable UART1, perform the necessary initialization proceduresSerial1.setup(), Serial1.begin()
.
setup()
, wakeup()
, or just before sleep during flush
processing.setup()
void setup(uint16_t buf_tx, uint16_t buf_rx)
Initializes the object.
- Allocates memory for TX/RX FIFO buffers
- Allocates memory for the TWE_tsFILE structure
Serial
(UART0) automatically calls setup()
within the library. There is no need for the user to call it.
Also, the buffer size for Serial
(UART0) is determined at compile time. It can be changed by macros MWX_SER_TX_BUFF
(default 768) and MWX_SER_RX_BUFF
(default 256).
Parameter | Description |
---|---|
buf_tx | FIFO buffer size for TX |
buf_rx | FIFO buffer size for RX |
begin()
void begin(unsigned long speed = 115200, uint8_t config = 0x06)
Initializes the hardware.
Serial
(UART0) automatically calls begin()
within the library. There is no need for the user to call it.Parameter | Description |
---|---|
speed | Specifies the UART baud rate |
config | When the serial_jen::E_CONF::PORT_ALT bit is specified, UART1 is initialized on ~DIO14,15 instead of ~DIO11(TxD),9(RxD). If not specified, it initializes on ~DIO11(TxD),9(RxD) instead of ~DIO14(TxD),15(RxD). |
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.
Baud rate calculation involves division and may take processing time. When specifying 9600, 38400, or 115200, the calculation is done without division. For details, see constexpr uint16_t _serial_get_hect_baud(uint32_t baud)
.
end()
(Not implemented) Stops using the hardware.
get_tsFile()
TWE_tsFILE* get_tsFile();
Returns the structure in TWE_tsFILE*
format used by the C library.
_sSerial
structure is defined.