diff Small_CPU/Src/i2c.c @ 100:b364c75005bb kittz

Stable.fix.
author Dmitry Romanov <kitt@bk.ru>
date Tue, 27 Nov 2018 12:59:56 +0300
parents c6d284ea265b
children 22a1094545f3
line wrap: on
line diff
--- a/Small_CPU/Src/i2c.c	Mon Nov 26 15:25:52 2018 +0300
+++ b/Small_CPU/Src/i2c.c	Tue Nov 27 12:59:56 2018 +0300
@@ -69,9 +69,9 @@
 {
 	I2cHandle.Instance             = I2Cx;
   I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
-  I2cHandle.Init.ClockSpeed      = 100000;//400000;
+  I2cHandle.Init.ClockSpeed      = 400000;//400000;
   I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
-  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_2;
+  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_16_9;
   I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
   I2cHandle.Init.NoStretchMode   = I2C_NOSTRETCH_DISABLED;
   I2cHandle.Init.OwnAddress1     = 0x01;
@@ -80,13 +80,15 @@
 
 	global.I2C_SystemStatus = HAL_I2C_Init(&I2cHandle);
 	HAL_I2CEx_AnalogFilter_Config(&I2cHandle, I2C_ANALOGFILTER_ENABLED);
+	HAL_I2CEx_ConfigDigitalFilter(&I2cHandle,0x0F);
+
 
 
 	global.dataSendToSlaveStopEval = 0;
-//	if(global.dataSendToSlavePending)
-//	{
-//		scheduleSpecial_Evaluate_DataSendToSlave();
-//	}
+	if(global.dataSendToSlavePending)
+	{
+		scheduleSpecial_Evaluate_DataSendToSlave();
+	}
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
 
@@ -118,10 +120,10 @@
 		I2C_Error_count();
 	}
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
 
@@ -141,10 +143,10 @@
 	}
 
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
 	
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
@@ -168,9 +170,9 @@
 	global.dataSendToSlaveStopEval = 0;
 //	if(global.dataSendToSlavePending)
 //	{
-//
+//		scheduleSpecial_Evaluate_DataSendToSlave();
 //	}
-	scheduleSpecial_Evaluate_DataSendToSlave();
+
 	return (HAL_StatusTypeDef)localHALstatusReturn;
 }