From 490457241752b32bea17cfc6ff6540d0c920b1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sat, 18 Feb 2017 21:41:11 +0100 Subject: [PATCH] Move temp and counter out of InitI2C() so that the compiler shouldn't optimize the loop. --- right/src/init_peripherials.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/right/src/init_peripherials.c b/right/src/init_peripherials.c index 920207c..2e1a792 100644 --- a/right/src/init_peripherials.c +++ b/right/src/init_peripherials.c @@ -8,6 +8,8 @@ #include "led_pwm.h" #include "bridge_protocol_scheduler.h" +volatile uint32_t temp, counter; + void InitI2c() { port_pin_config_t pinConfig = { .pullSelect = kPORT_PullUp, @@ -47,8 +49,8 @@ void InitI2c() { /* This function is designed to restart and reinstall the I2C handler * when a disconnection of the left side makes the master I2C bus unresponsive */ +volatile uint32_t temp, counter; void restartI2C(void) { - volatile uint32_t temp, counter; uint32_t sourceClock; i2c_master_config_t masterConfig;