Skip to content

Commit 42ba1b3

Browse files
committed
fixes some more errors.
1 parent 621b904 commit 42ba1b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

micropy_updates/esp32/machine_i2c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
233233

234234
// Get I2C bus
235-
uint8_t i2c_id = (uint8_t)args[ARG_host].u_int;
235+
int i2c_id = (int)args[ARG_host].u_int;
236236
if (!(I2C_NUM_0 <= i2c_id && i2c_id < I2C_NUM_MAX)) {
237237
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%u) doesn't exist"), i2c_id);
238238
}
@@ -245,7 +245,7 @@
245245
}
246246
// Created for the first time, set default pins
247247
self->base.type = &mp_machine_hw_i2c_bus_type;
248-
self->port = i2c_id;
248+
self->port = (uint8_t)i2c_id;
249249
self->active = 0;
250250
self->device_count = 0;
251251

@@ -426,7 +426,7 @@
426426
uint32_t memaddr = 0;
427427

428428
for (int i=(int)(self->reg_bits / 8) - 1;i>-1;i--) {
429-
memaddr |= (uint32_t)(((uint8_t *)write_bufinfo.buf[i]) << ((~i + (self->reg_bits / 8)) * 8));
429+
memaddr |= (uint32_t)(((uint8_t *)write_bufinfo.buf)[i]) << (uint8_t)((~i + (int)(self->reg_bits / 8)) * 8);
430430
}
431431

432432
int ret = device_read(self, self->device_id, memaddr, self->reg_bits, (uint8_t *)read_bufinfo.buf, read_bufinfo.len);

0 commit comments

Comments
 (0)