diff options
author | mux <freelancer.c@gmail.com> | 2014-02-17 21:49:07 +0200 |
---|---|---|
committer | mux <freelancer.c@gmail.com> | 2014-02-17 21:49:07 +0200 |
commit | d0ffda91cc06075c2c13b58b648986376b4ca625 (patch) | |
tree | 27c1f91bf28e64acbc4091bb6bc6c19571e7e787 | |
parent | f34947703ad0d793477042027d605c13962362db (diff) | |
download | micropython-d0ffda91cc06075c2c13b58b648986376b4ca625.tar.gz micropython-d0ffda91cc06075c2c13b58b648986376b4ca625.zip |
Fix usart_obj_tx_char
-rw-r--r-- | stm/usart.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/stm/usart.c b/stm/usart.c index 6478f01152..78d9a0fee4 100644 --- a/stm/usart.c +++ b/stm/usart.c @@ -205,8 +205,10 @@ static mp_obj_t usart_obj_rx_char(mp_obj_t self_in) { static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) { pyb_usart_obj_t *self = self_in; - if (self->is_enabled) { - usart_tx_char(self->usart_id, mp_obj_get_int(c)); + uint len; + const char *str = mp_obj_str_get_data(c, &len); + if (len == 1 && self->is_enabled) { + usart_tx_char(self->usart_id, str[0]); } return mp_const_none; } |