aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-03 21:16:59 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-03 21:16:59 +0200
commitec8a06ff2b7dbf10fa6aebb25b1ed5be18faed80 (patch)
tree5525957a12f82ac8a9b0af6a7cc368063b2a55ee /Software/Embedded_SW/Embedded/Drivers
parent041f75abe0e1d8ecdf6c032ef1556513fbdb456e (diff)
downloadTango-ec8a06ff2b7dbf10fa6aebb25b1ed5be18faed80.tar.gz
Tango-ec8a06ff2b7dbf10fa6aebb25b1ed5be18faed80.zip
blower gradual increase, stop/release motrs lock, file system fixes
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c9
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c55
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h2
3 files changed, 65 insertions, 1 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
index 06f082bca..c984f2c48 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
@@ -677,6 +677,15 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue)
break;
}
break;
+ case MOTOR_CONFIG_END:
+ {
+ temp = x_HARD_HIZ;
+ temp = temp << 24;
+
+ MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback);
+ ConfigStages[_motorId]++;
+ }
+ break;
default:
return ERROR;
}
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
index 566cb1cc6..38b029925 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c
@@ -22,6 +22,7 @@
#include "driverlib/i2c.h"
#include "drivers/I2C_Communication/I2C.h"
#include "Blower.h"
+#include "modules/control/control.h"
DAC_Union DAC;
@@ -159,6 +160,60 @@ uint32_t Turn_the_Blower_Off()
return status;
}
+uint32_t mInitial_mV, mTarget_mV;
+uint32_t mInterval = eOneSecond*20;
+uint32_t BlowerControlId = 0xFF;
+
+uint32_t Gradual_Increase_Blower_Callback(uint32_t DispenserId, uint32_t ReadValue)
+{
+ if ((mTarget_mV-mInitial_mV)<100)
+ {
+ Control_Voltage_To_Blower(mTarget_mV);
+ Report("Finished Increasing blower",__FILE__,__LINE__,(int)mTarget_mV,RpWarning,(int)millisecondCounter,0);
+ if (RemoveControlCallback(BlowerControlId, Gradual_Increase_Blower_Callback )==OK)
+ {
+ Report("Remove control callback",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ BlowerControlId = 0xFF;
+ }
+ else
+ {
+ Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)BlowerControlId,0);
+ if (RemoveControlCallback(GetControlLowDevice_i(),Gradual_Increase_Blower_Callback)==OK)
+ {
+ Report("Remove control callback fixed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ BlowerControlId = 0xFF;
+ }
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0);
+ }
+ return OK;
+ }
+ mInitial_mV = mInitial_mV+100;
+ Control_Voltage_To_Blower(mInitial_mV);
+ Report("Increasing blower",__FILE__,__LINE__,(int)mInitial_mV,RpWarning,(int)millisecondCounter,0);
+ return OK;
+}
+
+uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV)
+{
+ mInitial_mV = Initial_mV;
+ mTarget_mV = Target_mV;
+ if ((mTarget_mV-mInitial_mV)<100)
+ {
+ Control_Voltage_To_Blower(mTarget_mV);
+ Report("Finished Increasing blower",__FILE__,__LINE__,(int)mTarget_mV,RpWarning,(int)millisecondCounter,0);
+ return OK;
+ }
+ mInitial_mV = Initial_mV+100;
+ Control_Voltage_To_Blower(mInitial_mV);
+ Report("Increasing blower",__FILE__,__LINE__,(int)mInitial_mV,RpWarning,(int)millisecondCounter,0);
+ BlowerControlId = AddControlCallback( Gradual_Increase_Blower_Callback, mInterval,getBlowerState ,0, 0, 0 );
+ if (BlowerControlId == 0xFF)
+ {
+ Report("Add control callback failed",__FILE__,__LINE__,(int)0,RpWarning,(int)BlowerControlId,0);
+ return ERROR;
+ }
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
index 56a42a885..abe5d8a1a 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h
@@ -52,7 +52,7 @@ uint32_t Turn_the_Blower_On();
uint32_t Control_Voltage_To_Blower(uint32_t mV);
uint32_t Turn_the_Blower_Off();
uint32_t getBlowerState(void);
-
+uint32_t Gradual_Increase_Blower(uint32_t Initial_mV,uint32_t Target_mV);
#endif /* DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ */