Merge pull request #11676 from maciejbocianski/nrf5X_fix_i2c_twi_sdk

nrf52 - fix i2c/twi driver
pull/11691/head
Martin Kojtal 2019-10-15 22:16:19 +08:00 committed by GitHub
commit ea3ead0349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -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
@ -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;
@ -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)
@ -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)
{
@ -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));
@ -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;
@ -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;