nrf5/hal: Updating hal_twi.c with tx function which partly works. Bytes are clocked out a bit out of order.
This commit is contained in:
parent
0629abac53
commit
fed06e278b
@ -56,7 +56,22 @@ void hal_twi_master_tx(NRF_TWI_Type * p_instance,
|
|||||||
uint16_t transfer_size,
|
uint16_t transfer_size,
|
||||||
const uint8_t * tx_data,
|
const uint8_t * tx_data,
|
||||||
bool stop) {
|
bool stop) {
|
||||||
|
|
||||||
|
uint16_t number_of_txd_bytes = 0;
|
||||||
|
|
||||||
p_instance->ADDRESS = addr;
|
p_instance->ADDRESS = addr;
|
||||||
|
|
||||||
|
while (number_of_txd_bytes < transfer_size) {
|
||||||
|
p_instance->TXD = (uint32_t)(tx_data[number_of_txd_bytes]);
|
||||||
|
p_instance->EVENTS_TXDSENT = 0;
|
||||||
|
p_instance->TASKS_STARTTX = 1;
|
||||||
|
|
||||||
|
// wait for the transaction complete
|
||||||
|
while (p_instance->EVENTS_TXDSENT == 0) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
number_of_txd_bytes++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hal_twi_master_rx(NRF_TWI_Type * p_instance,
|
void hal_twi_master_rx(NRF_TWI_Type * p_instance,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user