|
41 | 41 | // all TWI instances have the same max size
|
42 | 42 | // 16 bits for 840, 10 bits for 810, 8 bits for 832
|
43 | 43 | #define I2C_MAX_XFER_LEN MIN(((1UL << TWIM0_EASYDMA_MAXCNT_SIZE) - 1), 1024)
|
44 |
| -#define I2C_TIMEOUT 1000 //1 second timeout |
| 44 | +#define I2C_TIMEOUT 1000 // 1 second timeout |
45 | 45 |
|
46 | 46 | STATIC twim_peripheral_t twim_peripherals[] = {
|
47 | 47 | #if NRFX_CHECK(NRFX_TWIM0_ENABLED)
|
@@ -103,9 +103,9 @@ static uint8_t twi_error_to_mp(const nrfx_err_t err) {
|
103 | 103 | return 0;
|
104 | 104 | }
|
105 | 105 |
|
106 |
| -static void twim_event_handler(nrfx_twim_evt_t const * p_event, void *p_context) { |
| 106 | +static void twim_event_handler(nrfx_twim_evt_t const *p_event, void *p_context) { |
107 | 107 | // this is the callback handler - sets transferring to false and records the most recent event.
|
108 |
| - twim_peripheral_t *peripheral = (twim_peripheral_t *) p_context; |
| 108 | + twim_peripheral_t *peripheral = (twim_peripheral_t *) p_context; |
109 | 109 | peripheral->last_event_type = p_event->type;
|
110 | 110 | peripheral->transferring = false;
|
111 | 111 | }
|
@@ -254,7 +254,7 @@ void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
|
254 | 254 | self->has_lock = false;
|
255 | 255 | }
|
256 | 256 |
|
257 |
| -STATIC nrfx_err_t _twim_xfer_with_timeout(busio_i2c_obj_t *self, nrfx_twim_xfer_desc_t const * p_xfer_desc, uint32_t flags) { |
| 257 | +STATIC nrfx_err_t _twim_xfer_with_timeout(busio_i2c_obj_t *self, nrfx_twim_xfer_desc_t const *p_xfer_desc, uint32_t flags) { |
258 | 258 | // does non-blocking transfer and raises and exception if it takes longer than I2C_TIMEOUT ms to complete
|
259 | 259 | uint64_t deadline = supervisor_ticks_ms64() + I2C_TIMEOUT;
|
260 | 260 | nrfx_err_t err = NRFX_SUCCESS;
|
|
0 commit comments