Skip to content

Commit ea3ead0

Browse files
authored
Merge pull request #11676 from maciejbocianski/nrf5X_fix_i2c_twi_sdk
nrf52 - fix i2c/twi driver
2 parents fb29999 + 7cc0b61 commit ea3ead0

File tree

1 file changed

+11
-11
lines changed
  • targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/drivers/src

1 file changed

+11
-11
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/drivers/src/nrfx_twi.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
NRF_GPIO_PIN_S0D1, \
8383
NRF_GPIO_PIN_NOSENSE)
8484

85-
#define HW_TIMEOUT 10000
85+
#define HW_TIMEOUT 100000
8686

8787
// Control block - driver instance local data.
8888
typedef struct
@@ -93,13 +93,13 @@ typedef struct
9393
nrfx_twi_xfer_desc_t xfer_desc;
9494
uint32_t flags;
9595
uint8_t * p_curr_buf;
96-
uint8_t curr_length;
96+
size_t curr_length;
9797
bool curr_no_stop;
9898
nrfx_drv_state_t state;
9999
bool error;
100100
volatile bool busy;
101101
bool repeated;
102-
uint8_t bytes_transferred;
102+
size_t bytes_transferred;
103103
bool hold_bus_uninit;
104104
} twi_control_block_t;
105105

@@ -254,8 +254,8 @@ void nrfx_twi_disable(nrfx_twi_t const * p_instance)
254254

255255
static bool twi_send_byte(NRF_TWI_Type * p_twi,
256256
uint8_t const * p_data,
257-
uint8_t length,
258-
uint8_t * p_bytes_transferred,
257+
size_t length,
258+
size_t * p_bytes_transferred,
259259
bool no_stop)
260260
{
261261
if (*p_bytes_transferred < length)
@@ -280,8 +280,8 @@ static bool twi_send_byte(NRF_TWI_Type * p_twi,
280280

281281
static void twi_receive_byte(NRF_TWI_Type * p_twi,
282282
uint8_t * p_data,
283-
uint8_t length,
284-
uint8_t * p_bytes_transferred)
283+
size_t length,
284+
size_t * p_bytes_transferred)
285285
{
286286
if (*p_bytes_transferred < length)
287287
{
@@ -304,9 +304,9 @@ static void twi_receive_byte(NRF_TWI_Type * p_twi,
304304

305305
static bool twi_transfer(NRF_TWI_Type * p_twi,
306306
bool * p_error,
307-
uint8_t * p_bytes_transferred,
307+
size_t * p_bytes_transferred,
308308
uint8_t * p_data,
309-
uint8_t length,
309+
size_t length,
310310
bool no_stop)
311311
{
312312
bool do_stop_check = ((*p_error) || ((*p_bytes_transferred) == length));
@@ -376,7 +376,7 @@ static bool twi_transfer(NRF_TWI_Type * p_twi,
376376
static nrfx_err_t twi_tx_start_transfer(twi_control_block_t * p_cb,
377377
NRF_TWI_Type * p_twi,
378378
uint8_t const * p_data,
379-
uint8_t length,
379+
size_t length,
380380
bool no_stop)
381381
{
382382
nrfx_err_t ret_code = NRFX_SUCCESS;
@@ -444,7 +444,7 @@ static nrfx_err_t twi_tx_start_transfer(twi_control_block_t * p_cb,
444444
static nrfx_err_t twi_rx_start_transfer(twi_control_block_t * p_cb,
445445
NRF_TWI_Type * p_twi,
446446
uint8_t const * p_data,
447-
uint8_t length)
447+
size_t length)
448448
{
449449
nrfx_err_t ret_code = NRFX_SUCCESS;
450450
volatile int32_t hw_timeout;

0 commit comments

Comments
 (0)