File tree 1 file changed +12
-2
lines changed
ports/mimxrt10xx/common-hal/busio
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,13 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
153
153
mp_raise_ValueError (translate ("Supply at least one UART pin" ));
154
154
}
155
155
156
+ if (rx && !self -> rx ) {
157
+ mp_raise_ValueError_varg (translate ("Invalid %q pin" ), MP_QSTR_RX );
158
+ }
159
+ if (tx && !self -> tx ) {
160
+ mp_raise_ValueError_varg (translate ("Invalid %q pin" ), MP_QSTR_TX );
161
+ }
162
+
156
163
if (uart_taken ) {
157
164
mp_raise_ValueError (translate ("Hardware in use, try alternative pins" ));
158
165
}
@@ -188,7 +195,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
188
195
}
189
196
}
190
197
if (self -> rts == NULL ) {
191
- mp_raise_ValueError (translate ("Selected RTS pin not valid" ) );
198
+ mp_raise_ValueError_varg (translate ("Invalid %q pin" ), MP_QSTR_RTS );
192
199
}
193
200
}
194
201
@@ -202,16 +209,19 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
202
209
}
203
210
}
204
211
if (self -> cts == NULL ) {
205
- mp_raise_ValueError (translate ("Selected CTS pin not valid" ) );
212
+ mp_raise_ValueError_varg (translate ("Invalid %q pin" ), MP_QSTR_CTS );
206
213
}
207
214
}
208
215
209
216
if (self -> rx ) {
210
217
self -> uart = mcu_uart_banks [self -> rx -> bank_idx - 1 ];
211
218
} else {
219
+ assert (self -> rx );
212
220
self -> uart = mcu_uart_banks [self -> tx -> bank_idx - 1 ];
213
221
}
214
222
223
+ assert (self -> uart );
224
+
215
225
if (self -> rx ) {
216
226
config_periph_pin (self -> rx );
217
227
}
You can’t perform that action at this time.
0 commit comments