Skip to content

Commit

Permalink
nrf5x - fix i2c/twi driver
Browse files Browse the repository at this point in the history
Sync TWI driver to sdk version 15.3.0 to get rid of data length limitation
  • Loading branch information
maciejbocianski committed Oct 12, 2019
1 parent 1798c24 commit 4369743
Showing 1 changed file with 11 additions and 11 deletions.
Expand Up @@ -82,7 +82,7 @@
NRF_GPIO_PIN_S0D1, \
NRF_GPIO_PIN_NOSENSE)

#define HW_TIMEOUT 10000
#define HW_TIMEOUT 100000

// Control block - driver instance local data.
typedef struct
Expand All @@ -93,13 +93,13 @@ typedef struct
nrfx_twi_xfer_desc_t xfer_desc;
uint32_t flags;
uint8_t * p_curr_buf;
uint8_t curr_length;
size_t curr_length;
bool curr_no_stop;
nrfx_drv_state_t state;
bool error;
volatile bool busy;
bool repeated;
uint8_t bytes_transferred;
size_t bytes_transferred;
bool hold_bus_uninit;
} twi_control_block_t;

Expand Down Expand Up @@ -254,8 +254,8 @@ void nrfx_twi_disable(nrfx_twi_t const * p_instance)

static bool twi_send_byte(NRF_TWI_Type * p_twi,
uint8_t const * p_data,
uint8_t length,
uint8_t * p_bytes_transferred,
size_t length,
size_t * p_bytes_transferred,
bool no_stop)
{
if (*p_bytes_transferred < length)
Expand All @@ -280,8 +280,8 @@ static bool twi_send_byte(NRF_TWI_Type * p_twi,

static void twi_receive_byte(NRF_TWI_Type * p_twi,
uint8_t * p_data,
uint8_t length,
uint8_t * p_bytes_transferred)
size_t length,
size_t * p_bytes_transferred)
{
if (*p_bytes_transferred < length)
{
Expand All @@ -304,9 +304,9 @@ static void twi_receive_byte(NRF_TWI_Type * p_twi,

static bool twi_transfer(NRF_TWI_Type * p_twi,
bool * p_error,
uint8_t * p_bytes_transferred,
size_t * p_bytes_transferred,
uint8_t * p_data,
uint8_t length,
size_t length,
bool no_stop)
{
bool do_stop_check = ((*p_error) || ((*p_bytes_transferred) == length));
Expand Down Expand Up @@ -376,7 +376,7 @@ static bool twi_transfer(NRF_TWI_Type * p_twi,
static nrfx_err_t twi_tx_start_transfer(twi_control_block_t * p_cb,
NRF_TWI_Type * p_twi,
uint8_t const * p_data,
uint8_t length,
size_t length,
bool no_stop)
{
nrfx_err_t ret_code = NRFX_SUCCESS;
Expand Down Expand Up @@ -444,7 +444,7 @@ static nrfx_err_t twi_tx_start_transfer(twi_control_block_t * p_cb,
static nrfx_err_t twi_rx_start_transfer(twi_control_block_t * p_cb,
NRF_TWI_Type * p_twi,
uint8_t const * p_data,
uint8_t length)
size_t length)
{
nrfx_err_t ret_code = NRFX_SUCCESS;
volatile int32_t hw_timeout;
Expand Down

0 comments on commit 4369743

Please sign in to comment.