Skip to content

samd/machine_uart.c: Add full support for 9bit data. #15787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

robert-hh
Copy link
Contributor

Before, 9bit data could be specified in the constructor and was transmitted, but the 9th bit was set to 0 when sending, and ignored when receiving. This PR completes 9 bit support in that the 9th bit is taken from the data.

9 bit data has to be provided with uart.write() and and read with uart.read() as two bytes for each transmitted item, low order byte first. The data length supplied with uart.write() and requested by uart.read() has to be even, which is checked. The size of the UART buffers will be transparently doubled to cater for 9bit data.

Copy link

github-actions bot commented Sep 4, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:  +168 +0.063% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Prior to this commit, 9-bit UART data could be specified in the constructor
and was transmitted, but the 9th bit was set to 0 when sending, and ignored
when receiving.  This commit completes 9-bit support in that the 9th bit is
taken from the data.

9-bit data has to be provided with `uart.write()` and and read with
`uart.read()` as two bytes for each transmitted item, low order byte first.
The data length supplied with `uart.write()` and requested by `uart.read()`
has to be even, which is checked.  The size of the UART buffers will be
transparently doubled to cater for 9-bit data.

Signed-off-by: robert-hh <robert@hammelrath.com>
@dpgeorge dpgeorge merged commit 5a70850 into micropython:master Nov 18, 2024
8 checks passed
@dpgeorge
Copy link
Member

Thank you!

@robert-hh
Copy link
Contributor Author

And you.

@robert-hh robert-hh deleted the samd_9bit branch November 19, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy