Go Down

Topic: 9 bit Hardware Serial for SAMD21 available (Read 1 time) previous topic - next topic


Dec 09, 2017, 05:47 pm Last Edit: Dec 09, 2017, 05:56 pm by pju38

Hardware Serial 9 bit  for SAMD21

if anyone else interested to use/test/enhance:

https://github.com/PhiJu5/HWSerial9BitSamD21 (click 'compare' to view changes)

- By default Hardware Serial 9 is not active
- The change in board.txt is an example how to add the needed global compile
define (-D__HWSERIAL9BIT) by duplicate and modify an existing board.
Perhaps Aduino IDE will have a feature 'add custom a global define' per .ino file some day.
- Use write9bit(uint8_t data) for 9th bit set (use write(uint8_t data) for 9th bit not set).
This keeps exiting code with standard write(uint8_t data) compatible.
- set_tx_mode()  set_rx_mode() experimental (half duplex)
- yes, rx/tx buffers memory footprint are doubled

Example attached (for "Arduino M0 HWSERIAL9BIT" Arduino IDE board entry).

Go Up