diff options
| author | Damien George | 2014-02-08 18:17:23 +0000 |
|---|---|---|
| committer | Damien George | 2014-02-08 18:17:23 +0000 |
| commit | 698ec21e46564ff0c2c71bf11d7eb4ef349c88d9 (patch) | |
| tree | 3d0eac21ec784f970f9f5586dfbd28c66f0774e5 /stm | |
| parent | 23177088d255bec6c0bf93470aeac77194aa8258 (diff) | |
Make mp_obj_str_get_data return char* instead of byte*.
Can't decide which is better for string type, char or byte pointer.
Changing to char removes a few casts. Really need to do proper unicode.
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/file.c | 2 | ||||
| -rw-r--r-- | stm/lcd.c | 4 | ||||
| -rw-r--r-- | stm/usart.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/stm/file.c b/stm/file.c index 84f7251fe..36658e7a6 100644 --- a/stm/file.c +++ b/stm/file.c @@ -29,7 +29,7 @@ mp_obj_t file_obj_read(mp_obj_t self_in, mp_obj_t arg) { mp_obj_t file_obj_write(mp_obj_t self_in, mp_obj_t arg) { pyb_file_obj_t *self = self_in; uint l; - const byte *s = mp_obj_str_get_data(arg, &l); + const char *s = mp_obj_str_get_data(arg, &l); UINT n_out; FRESULT res = f_write(&self->fp, s, l, &n_out); if (res != FR_OK) { @@ -202,8 +202,8 @@ mp_obj_t lcd_pix_show(void) { mp_obj_t lcd_print(mp_obj_t text) { uint len; - const byte *data = mp_obj_str_get_data(text, &len); - lcd_print_strn((const char*)data, len); + const char *data = mp_obj_str_get_data(text, &len); + lcd_print_strn(data, len); return mp_const_none; } diff --git a/stm/usart.c b/stm/usart.c index d9de599c4..306284d5a 100644 --- a/stm/usart.c +++ b/stm/usart.c @@ -159,7 +159,7 @@ void usart_tx_str(pyb_usart_t usart_id, const char *str) { } } -void usart_tx_bytes(pyb_usart_t usart_id, const byte *data, uint len) { +void usart_tx_bytes(pyb_usart_t usart_id, const char *data, uint len) { for (; len > 0; data++, len--) { usart_tx_char(usart_id, *data); } @@ -216,7 +216,7 @@ static mp_obj_t usart_obj_tx_str(mp_obj_t self_in, mp_obj_t s) { if (self->is_enabled) { if (MP_OBJ_IS_STR(s)) { uint len; - const byte *data = mp_obj_str_get_data(s, &len); + const char *data = mp_obj_str_get_data(s, &len); usart_tx_bytes(self->usart_id, data, len); } } |
