nrf5/i2c: Making use of hal twi tx function in writeto function.

This commit is contained in:
Glenn Ruben Bakke 2017-01-31 22:48:07 +01:00
parent 4b38644531
commit 9e6acda85c
1 changed files with 6 additions and 1 deletions

View File

@ -121,6 +121,8 @@ mp_obj_t machine_hard_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz
"I2C SDA Pin not set"));
}
self->i2c->init.freq = HAL_TWI_FREQ_100_Kbps;
hal_twi_master_init(self->i2c->instance, &self->i2c->init);
return MP_OBJ_FROM_PTR(self);
@ -134,7 +136,10 @@ int machine_hard_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t *de
}
int machine_hard_i2c_writeto(mp_obj_base_t *self_in, uint16_t addr, const uint8_t *src, size_t len, bool stop) {
printf("machine_hard_i2c_writeto called\n");
machine_hard_i2c_obj_t *self = (machine_hard_i2c_obj_t *)self_in;
hal_twi_master_tx(self->i2c->instance, addr, len, src, stop);
return 0;
}