File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -133,19 +133,17 @@ pub(crate) fn read_raw<'b, D: UartDevice>(
133133
134134 let read = device. uartdr . read ( ) ;
135135
136+ // If multiple status bits are set, report
137+ // the most serious or most specific condition,
138+ // in the following order of precedence:
139+ // overrun > break > parity > framing
136140 if read. oe ( ) . bit_is_set ( ) {
137141 error = Some ( ReadErrorType :: Overrun ) ;
138- }
139-
140- if read. be ( ) . bit_is_set ( ) {
142+ } else if read. be ( ) . bit_is_set ( ) {
141143 error = Some ( ReadErrorType :: Break ) ;
142- }
143-
144- if read. pe ( ) . bit_is_set ( ) {
144+ } else if read. pe ( ) . bit_is_set ( ) {
145145 error = Some ( ReadErrorType :: Parity ) ;
146- }
147-
148- if read. fe ( ) . bit_is_set ( ) {
146+ } else if read. fe ( ) . bit_is_set ( ) {
149147 error = Some ( ReadErrorType :: Framing ) ;
150148 }
151149
You can’t perform that action at this time.
0 commit comments