Skip to content

Commit 275a84b

Browse files
committed
Merge branch 'unblock_i2c' into develop
2 parents 9fb3755 + 5eb56d9 commit 275a84b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/main.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <libraries/gpiote/app_gpiote.h>
66
#include <libraries/timer/app_timer.h>
77
#include <softdevice/common/nrf_sdh.h>
8+
#include <nrf_delay.h>
89

910
// nimble
1011
#define min // workaround: nimble's min/max macros conflict with libstdc++
@@ -300,6 +301,20 @@ int main(void) {
300301

301302
nrf_drv_clock_init();
302303

304+
// Unblock i2c?
305+
nrf_gpio_cfg(pinTwiScl,
306+
NRF_GPIO_PIN_DIR_OUTPUT,
307+
NRF_GPIO_PIN_INPUT_DISCONNECT,
308+
NRF_GPIO_PIN_NOPULL,
309+
NRF_GPIO_PIN_S0D1,
310+
NRF_GPIO_PIN_NOSENSE);
311+
nrf_gpio_pin_set(pinTwiScl);
312+
for (uint8_t i = 0; i < 16; i++) {
313+
nrf_gpio_pin_toggle(pinTwiScl);
314+
nrf_delay_us(5);
315+
}
316+
nrf_gpio_cfg_default(pinTwiScl);
317+
303318
debounceTimer = xTimerCreate("debounceTimer", 200, pdFALSE, (void*) 0, DebounceTimerCallback);
304319
debounceChargeTimer = xTimerCreate("debounceTimerCharge", 200, pdFALSE, (void*) 0, DebounceTimerChargeCallback);
305320

0 commit comments

Comments
 (0)