/      日本語

Serial

UART0 port (mwx::serial_jen)
Implements 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 from setup() in user code.
  • The Serial1 object is provided within the library but is not initialized. To enable UART1, perform the necessary initialization procedures Serial1.setup(), Serial1.begin().

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
ParameterDescription
buf_txFIFO buffer size for TX
buf_rxFIFO buffer size for RX

begin()

void begin(unsigned long speed = 115200, uint8_t config = 0x06)

Initializes the hardware.

ParameterDescription
speedSpecifies the UART baud rate
configWhen 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).

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.