MotorWare f2806x Module API Documentation
spintac_vel_plan.h
Go to the documentation of this file.
1 #ifndef __SPINTAC_VEL_PLAN_H__
2 #define __SPINTAC_VEL_PLAN_H__
3 /* --COPYRIGHT--,BSD
4  * Copyright (c) 2012, LineStream Technologies Incorporated
5  * Copyright (c) 2012, Texas Instruments Incorporated
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * * Neither the names of Texas Instruments Incorporated, LineStream
20  * Technologies Incorporated, nor the names of its contributors may be
21  * used to endorse or promote products derived from this software without
22  * specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
31  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
34  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  * --/COPYRIGHT--*/
36 
43 
45 
46 
47 #include "spintac_version.h"
48 
51 #define ST_VEL_PLAN_ACT_DWORDS (5)
52 #define ST_VEL_PLAN_COND_DWORDS (3)
54 #define ST_VEL_PLAN_VAR_DWORDS (2)
56 #define ST_VEL_PLAN_TRAN_DWORDS (5)
58 #define ST_VEL_PLAN_STATE_DWORDS (6)
60 
61 
62 #ifndef __ST_PLAN_ENUM__
63 #define __ST_PLAN_ENUM__
64 typedef enum {
73 
76 typedef enum {
82 
85 typedef enum {
101 } ST_PlanComp_e;
102 
105 typedef enum {
109 
112 typedef enum {
116 
119 typedef enum {
124 
127 typedef enum {
131 } ST_PlanVar_e;
132 #endif //__ST_PLAN_ENUM__
133 
134 #ifndef __ST_PLAN_ERROR__
135 #define __ST_PLAN_ERROR__
136 typedef struct {
140  uint16_t ERR_idx;
141  uint16_t ERR_code;
142 } ST_PlanError_t; // Structure for SpinTAC Plan Error
143 #endif //__ST_PLAN_ERROR__
144 
148 typedef struct {
149  /* Input variables */
150  // Control bits
151  bool ENB;
152  bool RES;
153  /* Output variables */
157  // Information variables
159  uint16_t CurState;
160  uint16_t CurTran;
162  int32_t Timer_tick;
163  uint16_t ERR_ID;
165  /* Internal variables */
166  uint32_t s0[26];
167 } ST_VelPlan_t; // Structure for SpinTAC Velocity Plan
168 
169 typedef struct _ST_VELPLAN_Handle_ *ST_VELPLAN_Handle; // SpinTAC Velocity Plan Handle
170 
175  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
176 
177  return(obj->VelEnd);
178 } // end of STVELPLAN_getVelocitySetpoint function
179 
184  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
185 
186  return(obj->AccLim);
187 } // end of STVELPLAN_getAccelerationLimit function
188 
193  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
194 
195  return(obj->JrkLim);
196 } // end of STVELPLAN_getJerkLimit function
197 
201 static inline void STVELPLAN_setEnable(ST_VELPLAN_Handle handle, bool enb) {
202  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
203 
204  obj->ENB = enb;
205 
206  return;
207 } // end of STVELPLAN_setEnable function
208 
212 static inline bool STVELPLAN_getEnable(ST_VELPLAN_Handle handle) {
213  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
214 
215  return (obj->ENB);
216 } // end of STVELPLAN_getEnable function
217 
221 static inline void STVELPLAN_setReset(ST_VELPLAN_Handle handle, bool res) {
222  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
223 
224  obj->RES = res;
225 
226  return;
227 } // end of STVELPLAN_setReset function
228 
232 static inline bool STVELPLAN_getReset(ST_VELPLAN_Handle handle) {
233  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
234 
235  return (obj->RES);
236 } // end of STVELPLAN_getReset function
237 
242  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
243 
244  return (obj->STATUS);
245 } // end of STVELPLAN_getStatus function
246 
247 
251 static inline uint16_t STVELPLAN_getCurrentState(ST_VELPLAN_Handle handle) {
252  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
253 
254  return(obj->CurState);
255 } // end of STVELPLAN_getCurrentState function
256 
260 static inline uint16_t STVELPLAN_getCurrentTransition(ST_VELPLAN_Handle handle) {
261  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
262 
263  return(obj->CurTran);
264 } // end of STVELPLAN_getCurrentTransition function
265 
270  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
271 
272  return(obj->FsmState);
273 } // end of STVELPLAN_getFsmState function
274 
279  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
280 
281  return(obj->Timer_tick);
282 } // end of STVELPLAN_getCurrentTimerValue_tick function
283 
289 static inline uint16_t STVELPLAN_getCfgError(ST_VELPLAN_Handle handle, uint16_t *ERR_idx, uint16_t *ERR_code) {
290  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
291 
292  *ERR_idx = obj->CfgError.ERR_idx;
293  *ERR_code = obj->CfgError.ERR_code;
294 
295  return (obj->ERR_ID);
296 } // end of STVELPLAN_getCfgError function
297 
301 static inline uint16_t STVELPLAN_getErrorID(ST_VELPLAN_Handle handle) {
302  ST_VelPlan_t *obj = (ST_VelPlan_t *)handle;
303 
304  return (obj->ERR_ID);
305 } // end of STVELPLAN_getErrorID function
306 
310 void STVELPLAN_getCfgStateNum(ST_VELPLAN_Handle handle, uint16_t *StateNum);
311 
315 void STVELPLAN_getCfgVarNum(ST_VELPLAN_Handle handle, uint16_t *VarNum);
316 
320 void STVELPLAN_getCfgCondNum(ST_VELPLAN_Handle handle, uint16_t *CondNum);
321 
325 void STVELPLAN_getCfgTranNum(ST_VELPLAN_Handle handle, uint16_t *TranNum);
326 
330 void STVELPLAN_getCfgActNum(ST_VELPLAN_Handle handle, uint16_t *ActNum);
331 
338 void STVELPLAN_addCfgCond(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2);
339 
343 void STVELPLAN_delCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx);
344 
352 void STVELPLAN_setCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2);
353 
361 void STVELPLAN_getCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx, ST_PlanComp_e *Comp, _iq24 *Value1, _iq24 *Value2);
362 
368 void STVELPLAN_addCfgVarCond(ST_VELPLAN_Handle handle, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp);
369 
373 void STVELPLAN_delCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx);
374 
381 void STVELPLAN_setCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp);
382 
389 void STVELPLAN_getCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx1, uint16_t *VarIdx2, ST_PlanComp_e *Comp);
390 
400 void STVELPLAN_addCfgTran(ST_VELPLAN_Handle handle, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim);
401 
405 void STVELPLAN_delCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx);
406 
417 void STVELPLAN_setCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim);
418 
429 void STVELPLAN_getCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t *FromState, uint16_t *ToState, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, _iq24 *AccLim, _iq20 *JrkLim);
430 
441 void STVELPLAN_addCfgAct(ST_VELPLAN_Handle handle, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit);
442 
446 void STVELPLAN_delCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx);
447 
459 void STVELPLAN_setCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit);
460 
472 void STVELPLAN_getCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t *State, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, uint16_t *VarIdx, ST_PlanActOptn_e *Opt, _iq24 *Value, ST_PlanActTrgr_e *EnterExit);
473 
478 void STVELPLAN_addCfgVar(ST_VELPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value);
479 
483 void STVELPLAN_delCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx);
484 
490 void STVELPLAN_setCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e Type, _iq24 Value);
491 
497 void STVELPLAN_getCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e *Type, _iq24 *Value);
498 
503 void STVELPLAN_setVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 Value);
504 
509 void STVELPLAN_getVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value);
510 
514 void STVELPLAN_setUnitProfDone(ST_VELPLAN_Handle handle, bool ProDON);
515 
520 void STVELPLAN_setCfg(ST_VELPLAN_Handle handle, _iq24 T_sec, bool LoopENB);
521 
526 void STVELPLAN_getCfg(ST_VELPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB);
527 
534 void STVELPLAN_setCfgHaltState(ST_VELPLAN_Handle handle, _iq24 VelEnd, _iq24 AccLim, _iq20 JrkLim, int32_t Timer_tick);
535 
542 void STVELPLAN_getCfgHaltState(ST_VELPLAN_Handle handle, _iq24 *VelEnd, _iq24 *AccLim, _iq20 *JrkLim, int32_t *Timer_tick);
543 
548 void STVELPLAN_addCfgState(ST_VELPLAN_Handle handle, _iq24 VelEnd, int32_t Timer_tick);
549 
553 void STVELPLAN_delCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx);
554 
560 void STVELPLAN_setCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 VelEnd, int32_t Timer_tick);
561 
567 void STVELPLAN_getCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 *VelEnd, int32_t *Timer_tick);
568 
572 
577 ST_VELPLAN_Handle STVELPLAN_init(void *pMemory, const size_t numBytes);
578 
581 void STVELPLAN_run(ST_VELPLAN_Handle handle);
582 
586 
596 void STVELPLAN_setCfgArray(ST_VELPLAN_Handle handle, uint32_t *cfgArray, const size_t numBytes, uint16_t MaxActNum,uint16_t MaxCondNum, uint16_t MaxVarNum, uint16_t MaxTranNum, uint16_t MaxStateNum);
597 
599 #endif /*__SPINTAC_VEL_PLAN_H__*/
static bool STVELPLAN_getReset(ST_VELPLAN_Handle handle)
Gets the Reset signal (RES) for SpinTAC Velocity Plan.
void STVELPLAN_getCfgVarNum(ST_VELPLAN_Handle handle, uint16_t *VarNum)
Returns the number of configured Variables in SpinTAC Velocity Plan.
ST_PlanCond_e
Enumeration for the Plan Condition options.
uint16_t ERR_idx
Plan component index that caused the error.
ST_PlanComp_e
Enumeration for the Plan Compare options.
void STVELPLAN_getCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx1, uint16_t *VarIdx2, ST_PlanComp_e *Comp)
Returns a Variable Condition from the SpinTAC Velocity Plan configuration.
Compares, VarIdx >= Value1 OR VarIdx1 >= VarIdx2.
Transition/Action with either condition satisfied.
void STVELPLAN_delCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx)
Deletes a Variable from the SpinTAC Velocity Plan configuration.
bool ENB
Enable bit { false: disabled; true: enabled }.
void STVELPLAN_getCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t *FromState, uint16_t *ToState, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, _iq24 *AccLim, _iq20 *JrkLim)
Return a Transition from the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit)
Modifies an action in the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Modifies a Varaible Condition to the SpinTAC Velocity Plan configuration.
void STVELPLAN_addCfgCond(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Adds a Condition to the SpinTAC Velocity Plan configuration.
ST_VELPLAN_Handle STVELPLAN_init(void *pMemory, const size_t numBytes)
Initializes the SpinTAC Velocity Plan component.
void STVELPLAN_getCfgStateNum(ST_VELPLAN_Handle handle, uint16_t *StateNum)
Returns the number of configured States in SpinTAC Velocity Plan.
static ST_PlanFsmState_e STVELPLAN_getFsmState(ST_VELPLAN_Handle handle)
Gets the State Machine State (FsmState) for SpinTAC Velocity Plan.
void STVELPLAN_addCfgState(ST_VELPLAN_Handle handle, _iq24 VelEnd, int32_t Timer_tick)
Adds a State to the SpinTAC Velocity Plan configuration.
ST_PlanVar_e
Enumeration for the Plan variable types.
void STVELPLAN_setCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim)
Modifies a Transition in the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e Type, _iq24 Value)
Modifies a variable in the SpinTAC Velocity Plan configuration.
void STVELPLAN_run(ST_VELPLAN_Handle handle)
Runs SpinTAC Velocity Plan calculation.
void STVELPLAN_delCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx)
Deletes a state from the SpinTAC Velocity Plan configuration.
Compares, Value1 <= VarIdx <= Value2.
ST_PlanStatus_e
Enumeration for the Plan Status States.
wait state, holding the speed reference in idle state
void STVELPLAN_setCfg(ST_VELPLAN_Handle handle, _iq24 T_sec, bool LoopENB)
Configures SpinTAC Velocity Plan.
void STVELPLAN_addCfgVarCond(ST_VELPLAN_Handle handle, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Adds a Variable Condition to the SpinTAC Velocity Plan configuration.
Plan is waiting for a transition condition to be true.
static uint16_t STVELPLAN_getCfgError(ST_VELPLAN_Handle handle, uint16_t *ERR_idx, uint16_t *ERR_code)
Gets the Configuration Error for SpinTAC Velocity Plan.
uint16_t CurTran
Current transition of the state machine.
void STVELPLAN_delCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx)
Deletes a Transition from the SpinTAC Velocity Plan configuration.
Compares, VarIdx != Value1 OR VarIdx1 != VarIdx2.
ST_PlanStatus_e STATUS
Plan status { ST_PLAN_IDLE, ST_PLAN_INIT, ST_PLAN_BUSY, ST_PLAN_HALT, ST_PLAN_WAIT}.
void STVELPLAN_delCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx)
Deletes an action from the SpinTAC Velocity Plan configuration.
Compares, Value1 > VarIdx > Value2.
void STVELPLAN_runTick(ST_VELPLAN_Handle handle)
Updates the SpinTAC Velocity Plan Timer.
void STVELPLAN_getCfgCondNum(ST_VELPLAN_Handle handle, uint16_t *CondNum)
Returns the number of configured Conditions in SpinTAC Velocity Plan.
void STVELPLAN_delCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx)
Deletes a Condition from the SpinTAC Velocity Plan configuration.
static _iq24 STVELPLAN_getAccelerationLimit(ST_VELPLAN_Handle handle)
Gets the Acceleration Limit (AccLim) for SpinTAC Velocity Plan.
Variable type output.
void STVELPLAN_setCfgHaltState(ST_VELPLAN_Handle handle, _iq24 VelEnd, _iq24 AccLim, _iq20 JrkLim, int32_t Timer_tick)
Configures the SpinTAC Velocity Plan Halt state.
Compares, VarIdx <= Value1 OR VarIdx1 <= VarIdx2.
ST_PlanCond_e
Enumeration for the Plan Condition options.
ST_PlanComp_e
Enumeration for the Plan Compare options.
void STVELPLAN_getCfg(ST_VELPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB)
Gets the SpinTAC Velocity Plan configuration.
Compares, Value1 < VarIdx < Value2.
halt state, return to the speed reference in idle state
void STVELPLAN_reset(ST_VELPLAN_Handle handle)
Resets the Velocity Plan component.
void STVELPLAN_addCfgTran(ST_VELPLAN_Handle handle, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim)
Adds a Transition to the SpinTAC Velocity Plan configuration.
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
Transition/Action with no conditions satisfied.
ST_PlanFsmState_e FsmState
State of the state machine.
uint16_t ERR_code
Function specific condition that caused the error.
Compares, Value1 > VarIdx >= Value2.
void STVELPLAN_setUnitProfDone(ST_VELPLAN_Handle handle, bool ProDON)
Sets a flag in SpinTAC Velocity Plan to indicate if the unit profile is complete. ...
struct _ST_VELPLAN_Handle_ * ST_VELPLAN_Handle
Variable type input.
void STVELPLAN_getCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e *Type, _iq24 *Value)
Returns a variable from the SpinTAC Velocity Plan configuration.
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
void STVELPLAN_addCfgAct(ST_VELPLAN_Handle handle, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit)
Adds an action to the SpinTAC Velocity Plan configuration.
uint16_t ERR_ID
Error ID { 0: no error; others: see error code }.
void STVELPLAN_getCfgActNum(ST_VELPLAN_Handle handle, uint16_t *ActNum)
Returns the number of configured Actions in SpinTAC Velocity Plan.
Compares, VarIdx == Value1 OR VarIdx1 == VarIdx2.
void STVELPLAN_getCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx, ST_PlanComp_e *Comp, _iq24 *Value1, _iq24 *Value2)
Returns a Condition from the SpinTAC Velocity Plan configuration.
Transition/Action with both conditions satisfied.
static void STVELPLAN_setEnable(ST_VELPLAN_Handle handle, bool enb)
Sets the Enable signal (ENB) for SpinTAC Velocity Plan.
long _iq24
Compares, Value1 >= VarIdx >= Value2.
ST_PlanActTrgr_e
Enumeration for the Plan Action trigger point types.
Action will be considered when exiting the state.
Compares, VarIdx < Value1 OR VarIdx1 < VarIdx2.
static uint16_t STVELPLAN_getCurrentState(ST_VELPLAN_Handle handle)
Gets the Current State (CurState) for SpinTAC Velocity Plan.
ST_PlanError_t CfgError
Error decoding structure.
void STVELPLAN_setVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 Value)
Sets the value of a SpinTAC Velocity Plan variable.
ST_PlanVar_e
Enumeration for the Plan variable types.
Compares, Value1 < VarIdx <= Value2.
Public interface, object, and function definitions related to the SpinTAC Version object...
_iq24 AccLim
Acceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
Compares, Value1 >= VarIdx > Value2.
int32_t Timer_tick
State Timer { unit: [tick] }.
ST_PlanStatus_e
Enumeration for the Plan Status States.
_iq24 VelEnd
Velocity setpoint { unit: [pu/s], value range: [-1.0, 1.0] }.
Defines the ST_VelPlan_t data.
Action will be considered when entering the state.
void STVELPLAN_addCfgVar(ST_VELPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value)
Adds a variable to the SpinTAC Velocity Plan configuration.
_iq20 JrkLim
Jerk Limit { unit: [pu/s^3], value range: [0.0005, 2000.0] }.
Action will set the variable equal to a value.
void STVELPLAN_setCfgArray(ST_VELPLAN_Handle handle, uint32_t *cfgArray, const size_t numBytes, uint16_t MaxActNum, uint16_t MaxCondNum, uint16_t MaxVarNum, uint16_t MaxTranNum, uint16_t MaxStateNum)
Prepares SpinTAC Velocity Plan configuration array.
ST_PlanActTrgr_e
Enumeration for the Plan Action trigger point types.
Action will add a value to the variable.
void STVELPLAN_getCfgTranNum(ST_VELPLAN_Handle handle, uint16_t *TranNum)
Returns the number of configured Transitions in SpinTAC Velocity Plan.
static bool STVELPLAN_getEnable(ST_VELPLAN_Handle handle)
Gets the Enable signal (ENB) for SpinTAC Velocity Plan.
init state, initialize internal states
Plan is in transition with a motion profile.
Compares, VarIdx > Value1 OR VarIdx1 > VarIdx2.
Transition/Action with first condition satisfied.
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
void STVELPLAN_setCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Modifies a Condition in the SpinTAC Velocity Plan configuration.
static uint16_t STVELPLAN_getErrorID(ST_VELPLAN_Handle handle)
Gets the Error ID for SpinTAC Velocity Plan.
static void STVELPLAN_setReset(ST_VELPLAN_Handle handle, bool res)
Sets the Reset signal (RES) for SpinTAC Velocity Plan.
long _iq20
void STVELPLAN_getCfgHaltState(ST_VELPLAN_Handle handle, _iq24 *VelEnd, _iq24 *AccLim, _iq20 *JrkLim, int32_t *Timer_tick)
Gets the SpinTAC Velocity Plan Halt state configuration.
static _iq24 STVELPLAN_getVelocitySetpoint(ST_VELPLAN_Handle handle)
Gets the Velocity Setpoint (VelEnd) for SpinTAC Velocity Plan.
bool RES
Reset bit { false: not reset; true: reset }.
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
static _iq20 STVELPLAN_getJerkLimit(ST_VELPLAN_Handle handle)
Gets the Jerk Limit (JrkLim) for SpinTAC Velocity Plan.
void STVELPLAN_getVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value)
Gets the value of a SpinTAC Velocity Plan variable.
idle state, holding velocity
Variable type input/output.
void STVELPLAN_setCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 VelEnd, int32_t Timer_tick)
Modifies a state in the SpinTAC Velocity Plan configuration.
Compares, Value1 <= VarIdx < Value2.
static ST_PlanStatus_e STVELPLAN_getStatus(ST_VELPLAN_Handle handle)
Gets the Status value (STATUS) for SpinTAC Velocity Plan.
static uint16_t STVELPLAN_getCurrentTransition(ST_VELPLAN_Handle handle)
Gets the Current Transition (CurTran) for SpinTAC Velocity Plan.
busy state, running state machine
void STVELPLAN_getCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 *VelEnd, int32_t *Timer_tick)
Returns a state from the SpinTAC Velocity Plan configuration.
void STVELPLAN_delCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx)
Deletes a Variable Condition from the SpinTAC Velocity Plan configuration.
static int32_t STVELPLAN_getCurrentTimerValue_tick(ST_VELPLAN_Handle handle)
Gets the Current Time Value (Timer_tick) for SpinTAC Velocity Plan.
No comparison.
void STVELPLAN_getCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t *State, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, uint16_t *VarIdx, ST_PlanActOptn_e *Opt, _iq24 *Value, ST_PlanActTrgr_e *EnterExit)
Returns an action from the SpinTAC Velocity Plan configuration.
uint16_t CurState
Current state of the state machine.
Plan is staying in a state until the timer is up.
Defines the ST_PlanError_t data.