diff Small_CPU/Src/i2c.c @ 94:c6d284ea265b kittz

reduce i2c speed and dutycycle for compass stability
author Dmitry Romanov <kitt@bk.ru>
date Mon, 26 Nov 2018 12:20:31 +0300
parents 3db7389d49cc
children b364c75005bb
line wrap: on
line diff
--- a/Small_CPU/Src/i2c.c	Mon Nov 26 11:38:06 2018 +0300
+++ b/Small_CPU/Src/i2c.c	Mon Nov 26 12:20:31 2018 +0300
@@ -69,9 +69,9 @@
 {
 	I2cHandle.Instance             = I2Cx;
   I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
-  I2cHandle.Init.ClockSpeed      = 400000;//400000;
+  I2cHandle.Init.ClockSpeed      = 100000;//400000;
   I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
-  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_16_9;
+  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_2;
   I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
   I2cHandle.Init.NoStretchMode   = I2C_NOSTRETCH_DISABLED;
   I2cHandle.Init.OwnAddress1     = 0x01;
@@ -83,10 +83,10 @@
 
 
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
 
@@ -166,10 +166,11 @@
 	}
 
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+//	if(global.dataSendToSlavePending)
+//	{
+//
+//	}
+	scheduleSpecial_Evaluate_DataSendToSlave();
 	return (HAL_StatusTypeDef)localHALstatusReturn;
 }