aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-04-16 09:27:13 +0300
committerAvi Levkovich <avi@twine-s.com>2018-04-16 09:27:13 +0300
commite0c13f23fd5d9b05fdfb66434b321b88dd9e1af9 (patch)
treec669c9fbbf1d2f2c5aa70abf5a7bdf9980a267d6 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
parent5192a54ed0d527d308c52e76dfb6e5af99c63b95 (diff)
parentf2660c3e7f7fd912346ed128e3ae43639d8bfeba (diff)
downloadTango-e0c13f23fd5d9b05fdfb66434b321b88dd9e1af9.tar.gz
Tango-e0c13f23fd5d9b05fdfb66434b321b88dd9e1af9.zip
update motor driver
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
index 5b0f034f4..7119238de 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c
@@ -45,7 +45,7 @@ uint32_t MotorsConfigMessage(HardwareMotor * request)
{
uint32_t status = PASSED;
int Motor_i;
-
+ MotorDriverConfigStruc MotorDriverConfig;
Motor_i = request->hardwaremotortype;
if (Motor_i< MAX_THREAD_MOTORS_NUM)
{
@@ -63,7 +63,30 @@ uint32_t MotorsConfigMessage(HardwareMotor * request)
MotorsCfg[Motor_i].kd = request->kd;
MotorsCfg[Motor_i].changeslope = request->changeslope;
MotorsCfg[Motor_i].hightimeoutusec = request->highlengthmicrosecond;
- ThreadInitialTestStub(request);
+ if (Motor_i == MOTOR_LDRIVING)
+ ThreadInitialTestStub(request);
+ /*
+ typedef struct
+ {
+ uint32_t ACC; //set
+ uint32_t DEC; //set
+ uint32_t MaxSpeed; //set
+ bool HasMicroStep;
+ uint32_t Microstep; //set
+ bool HasConfigWord;
+ uint16_t ConfigWord; //set
+ }MotorDriverConfigStruc;
+ */
+ MotorDriverConfig.ACC = MotorsCfg[Motor_i].changeslope;
+ MotorDriverConfig.DEC = MotorsCfg[Motor_i].changeslope;
+ MotorDriverConfig.MaxSpeed = MotorsCfg[Motor_i].maxfreq;
+ MotorDriverConfig.HasMicroStep = true;
+ MotorDriverConfig.Microstep = MotorsCfg[Motor_i].minmicrostep;
+ MotorDriverConfig.HasConfigWord = false;
+ MotorDriverConfig.ConfigWord = 0;
+
+ status = MotorConfig( Motor_i, &MotorDriverConfig);
+
return status;
}
else return Motor_i;