mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11676 from maciejbocianski/nrf5X_fix_i2c_twi_sdk
nrf52 - fix i2c/twi driverpull/11691/head
commit
ea3ead0349
|
@ -82,7 +82,7 @@
|
||||||
NRF_GPIO_PIN_S0D1, \
|
NRF_GPIO_PIN_S0D1, \
|
||||||
NRF_GPIO_PIN_NOSENSE)
|
NRF_GPIO_PIN_NOSENSE)
|
||||||
|
|
||||||
#define HW_TIMEOUT 10000
|
#define HW_TIMEOUT 100000
|
||||||
|
|
||||||
// Control block - driver instance local data.
|
// Control block - driver instance local data.
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -93,13 +93,13 @@ typedef struct
|
||||||
nrfx_twi_xfer_desc_t xfer_desc;
|
nrfx_twi_xfer_desc_t xfer_desc;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint8_t * p_curr_buf;
|
uint8_t * p_curr_buf;
|
||||||
uint8_t curr_length;
|
size_t curr_length;
|
||||||
bool curr_no_stop;
|
bool curr_no_stop;
|
||||||
nrfx_drv_state_t state;
|
nrfx_drv_state_t state;
|
||||||
bool error;
|
bool error;
|
||||||
volatile bool busy;
|
volatile bool busy;
|
||||||
bool repeated;
|
bool repeated;
|
||||||
uint8_t bytes_transferred;
|
size_t bytes_transferred;
|
||||||
bool hold_bus_uninit;
|
bool hold_bus_uninit;
|
||||||
} twi_control_block_t;
|
} 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,
|
static bool twi_send_byte(NRF_TWI_Type * p_twi,
|
||||||
uint8_t const * p_data,
|
uint8_t const * p_data,
|
||||||
uint8_t length,
|
size_t length,
|
||||||
uint8_t * p_bytes_transferred,
|
size_t * p_bytes_transferred,
|
||||||
bool no_stop)
|
bool no_stop)
|
||||||
{
|
{
|
||||||
if (*p_bytes_transferred < length)
|
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,
|
static void twi_receive_byte(NRF_TWI_Type * p_twi,
|
||||||
uint8_t * p_data,
|
uint8_t * p_data,
|
||||||
uint8_t length,
|
size_t length,
|
||||||
uint8_t * p_bytes_transferred)
|
size_t * p_bytes_transferred)
|
||||||
{
|
{
|
||||||
if (*p_bytes_transferred < length)
|
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,
|
static bool twi_transfer(NRF_TWI_Type * p_twi,
|
||||||
bool * p_error,
|
bool * p_error,
|
||||||
uint8_t * p_bytes_transferred,
|
size_t * p_bytes_transferred,
|
||||||
uint8_t * p_data,
|
uint8_t * p_data,
|
||||||
uint8_t length,
|
size_t length,
|
||||||
bool no_stop)
|
bool no_stop)
|
||||||
{
|
{
|
||||||
bool do_stop_check = ((*p_error) || ((*p_bytes_transferred) == length));
|
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,
|
static nrfx_err_t twi_tx_start_transfer(twi_control_block_t * p_cb,
|
||||||
NRF_TWI_Type * p_twi,
|
NRF_TWI_Type * p_twi,
|
||||||
uint8_t const * p_data,
|
uint8_t const * p_data,
|
||||||
uint8_t length,
|
size_t length,
|
||||||
bool no_stop)
|
bool no_stop)
|
||||||
{
|
{
|
||||||
nrfx_err_t ret_code = NRFX_SUCCESS;
|
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,
|
static nrfx_err_t twi_rx_start_transfer(twi_control_block_t * p_cb,
|
||||||
NRF_TWI_Type * p_twi,
|
NRF_TWI_Type * p_twi,
|
||||||
uint8_t const * p_data,
|
uint8_t const * p_data,
|
||||||
uint8_t length)
|
size_t length)
|
||||||
{
|
{
|
||||||
nrfx_err_t ret_code = NRFX_SUCCESS;
|
nrfx_err_t ret_code = NRFX_SUCCESS;
|
||||||
volatile int32_t hw_timeout;
|
volatile int32_t hw_timeout;
|
||||||
|
|
Loading…
Reference in New Issue