There has also been a pull request to the API HardwareSerial.h file to allow for 9N1. These changes effectively put the UART into 9-bit mode and allow transmitting from the UART TDRHL 16-bit register with and without the 9th bit (wake bit) being set.
The second argument allows for turning on or off the wake bit. TRUE = wake bit set to 1 FALSE = wake bit set to 0
Example command use:
Serial1.begin(19200, SERIAL_9N1);
Serial1.write_9bit(temp[0], true);
Serial1.write_9bit(&temp[1], false, len - 1);
UPDATE:
Removed the write_9bit commands in favor of using the native write command in byte array mode:
The new UNO R4 WIFI supports 9-bit operations on the hardware UART as per page 28.2.6 of the Renesas RA4M1 Groups: User Manual: Hardware.
https://forum.arduino.cc/t/9-bit-uart-is-built-in-to-the-new-ra4m1-chips/1310858
There has also been a pull request to the API HardwareSerial.h file to allow for 9N1. These changes effectively put the UART into 9-bit mode and allow transmitting from the UART TDRHL 16-bit register with and without the 9th bit (wake bit) being set.
The second argument allows for turning on or off the wake bit. TRUE = wake bit set to 1 FALSE = wake bit set to 0
Example command use: Serial1.begin(19200, SERIAL_9N1); Serial1.write_9bit(temp[0], true); Serial1.write_9bit(&temp[1], false, len - 1);
UPDATE: Removed the write_9bit commands in favor of using the native write command in byte array mode:
uint16_t d[] = {0xFF01, 0xFC8A, 0xFC00, 0xFC23}; Serial1.write((uint8_t *)d, sizeof(d));