2 parents f349477 + d0ffda9 commit ff77dc5Copy full SHA for ff77dc5
1 file changed
stm/usart.c
@@ -205,8 +205,10 @@ static mp_obj_t usart_obj_rx_char(mp_obj_t self_in) {
205
206
static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) {
207
pyb_usart_obj_t *self = self_in;
208
- if (self->is_enabled) {
209
- usart_tx_char(self->usart_id, mp_obj_get_int(c));
+ uint len;
+ const char *str = mp_obj_str_get_data(c, &len);
210
+ if (len == 1 && self->is_enabled) {
211
+ usart_tx_char(self->usart_id, str[0]);
212
}
213
return mp_const_none;
214
0 commit comments