Skip to content

Commit d03c681

Browse files
committed
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.
1 parent c4d0868 commit d03c681

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

stmhal/lcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_light_obj, pyb_lcd_light);
389389
/// Write the string `str` to the screen. It will appear immediately.
390390
STATIC mp_obj_t pyb_lcd_write(mp_obj_t self_in, mp_obj_t str) {
391391
pyb_lcd_obj_t *self = self_in;
392-
uint len;
392+
mp_uint_t len;
393393
const char *data = mp_obj_str_get_data(str, &len);
394394
lcd_write_strn(self, data, len);
395395
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
461461
STATIC mp_obj_t pyb_lcd_text(mp_uint_t n_args, const mp_obj_t *args) {
462462
// extract arguments
463463
pyb_lcd_obj_t *self = args[0];
464-
uint len;
464+
mp_uint_t len;
465465
const char *data = mp_obj_str_get_data(args[1], &len);
466466
int x0 = mp_obj_get_int(args[2]);
467467
int y0 = mp_obj_get_int(args[3]);

stmhal/modpyb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ STATIC mp_obj_t pyb_info(mp_uint_t n_args, const mp_obj_t *args) {
126126
{
127127
mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
128128
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
129-
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);
129+
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);
130130
}
131131

132132
// GC info

stmhal/modtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime);
233233
/// the number of seconds since Jan 1, 2000.
234234
STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
235235

236-
uint len;
236+
mp_uint_t len;
237237
mp_obj_t *elem;
238238

239239
mp_obj_get_array(tuple, &len, &elem);

stmhal/printf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args);
5050

51-
STATIC void stdout_print_strn(void *dummy_env, const char *str, unsigned int len) {
51+
STATIC void stdout_print_strn(void *dummy_env, const char *str, mp_uint_t len) {
5252
stdout_tx_strn_cooked(str, len);
5353
}
5454

@@ -97,7 +97,7 @@ typedef struct _strn_pfenv_t {
9797
size_t remain;
9898
} strn_pfenv_t;
9999

100-
void strn_print_strn(void *data, const char *str, unsigned int len) {
100+
STATIC void strn_print_strn(void *data, const char *str, mp_uint_t len) {
101101
strn_pfenv_t *strn_pfenv = data;
102102
if (len > strn_pfenv->remain) {
103103
len = strn_pfenv->remain;

stmhal/pyexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ bool parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bo
101101
gc_collect();
102102
// qstr info
103103
{
104-
uint n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
104+
mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
105105
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
106-
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);
106+
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);
107107
}
108108

109109
// GC info

stmhal/timer.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,11 +1157,9 @@ STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_o
11571157
tim->callback = mp_const_none;
11581158
__HAL_TIM_DISABLE_IT(&tim->tim, irq_mask);
11591159
if (channel == 0) {
1160-
printf("Uncaught exception in Timer(" UINT_FMT
1161-
") interrupt handler\n", tim->tim_id);
1160+
printf("uncaught exception in Timer(%u) interrupt handler\n", tim->tim_id);
11621161
} else {
1163-
printf("Uncaught exception in Timer(" UINT_FMT ") channel "
1164-
UINT_FMT " interrupt handler\n", tim->tim_id, channel);
1162+
printf("uncaught exception in Timer(%u) channel %u interrupt handler\n", tim->tim_id, channel);
11651163
}
11661164
mp_obj_print_exception((mp_obj_t)nlr.ret_val);
11671165
}

0 commit comments

Comments
 (0)