stmhal: Use mp_uint_t where appropriate.

Found these by compiling stmhal with mp_uint_t of type uint32_t instead
of unsigned int.  This actually makes a difference to the code, but just
a curiosity.
native-del-fast
Damien George 2014-10-05 21:51:54 +01:00
parent c4d0868df1
commit d03c681608
6 changed files with 10 additions and 12 deletions

View File

@ -389,7 +389,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_light_obj, pyb_lcd_light);
/// Write the string `str` to the screen. It will appear immediately.
STATIC mp_obj_t pyb_lcd_write(mp_obj_t self_in, mp_obj_t str) {
pyb_lcd_obj_t *self = self_in;
uint len;
mp_uint_t len;
const char *data = mp_obj_str_get_data(str, &len);
lcd_write_strn(self, data, len);
return mp_const_none;
@ -461,7 +461,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_lcd_pixel_obj, 4, 4, pyb_lcd_pixe
STATIC mp_obj_t pyb_lcd_text(mp_uint_t n_args, const mp_obj_t *args) {
// extract arguments
pyb_lcd_obj_t *self = args[0];
uint len;
mp_uint_t len;
const char *data = mp_obj_str_get_data(args[1], &len);
int x0 = mp_obj_get_int(args[2]);
int y0 = mp_obj_get_int(args[3]);

View File

@ -126,7 +126,7 @@ STATIC mp_obj_t pyb_info(mp_uint_t n_args, const mp_obj_t *args) {
{
mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
printf("qstr:\n n_pool=%u\n n_qstr=%u\n n_str_data_bytes=%u\n n_total_bytes=%u\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
}
// GC info

View File

@ -233,7 +233,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime);
/// the number of seconds since Jan 1, 2000.
STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
uint len;
mp_uint_t len;
mp_obj_t *elem;
mp_obj_get_array(tuple, &len, &elem);

View File

@ -48,7 +48,7 @@
int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args);
STATIC void stdout_print_strn(void *dummy_env, const char *str, unsigned int len) {
STATIC void stdout_print_strn(void *dummy_env, const char *str, mp_uint_t len) {
stdout_tx_strn_cooked(str, len);
}
@ -97,7 +97,7 @@ typedef struct _strn_pfenv_t {
size_t remain;
} strn_pfenv_t;
void strn_print_strn(void *data, const char *str, unsigned int len) {
STATIC void strn_print_strn(void *data, const char *str, mp_uint_t len) {
strn_pfenv_t *strn_pfenv = data;
if (len > strn_pfenv->remain) {
len = strn_pfenv->remain;

View File

@ -101,9 +101,9 @@ bool parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bo
gc_collect();
// qstr info
{
uint n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
printf("qstr:\n n_pool=%u\n n_qstr=%u\n n_str_data_bytes=%u\n n_total_bytes=%u\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
}
// GC info

View File

@ -1157,11 +1157,9 @@ STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_o
tim->callback = mp_const_none;
__HAL_TIM_DISABLE_IT(&tim->tim, irq_mask);
if (channel == 0) {
printf("Uncaught exception in Timer(" UINT_FMT
") interrupt handler\n", tim->tim_id);
printf("uncaught exception in Timer(%u) interrupt handler\n", tim->tim_id);
} else {
printf("Uncaught exception in Timer(" UINT_FMT ") channel "
UINT_FMT " interrupt handler\n", tim->tim_id, channel);
printf("uncaught exception in Timer(%u) channel %u interrupt handler\n", tim->tim_id, channel);
}
mp_obj_print_exception((mp_obj_t)nlr.ret_val);
}