MotorWare f2806x Module API Documentation
spintac_pos_plan.h
Go to the documentation of this file.
1 #ifndef __SPINTAC_POS_PLAN_H__
2 #define __SPINTAC_POS_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_POS_PLAN_ACT_DWORDS (5)
52 #define ST_POS_PLAN_COND_DWORDS (3)
54 #define ST_POS_PLAN_VAR_DWORDS (2)
56 #define ST_POS_PLAN_TRAN_DWORDS (7)
58 #define ST_POS_PLAN_STATE_DWORDS (7)
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 */
154  int32_t PosStepInt_mrev;
160  // Information variables
162  uint16_t CurState;
163  uint16_t CurTran;
165  int32_t Timer_tick;
166  uint16_t ERR_ID;
168  /* Internal variables */
169  uint32_t s0[31];
170 } ST_PosPlan_t;
171 
172 typedef struct _ST_POSPLAN_Handle_ *ST_POSPLAN_Handle; // SpinTAC Position Plan Handle
173 
178 static inline void STPOSPLAN_getPositionStep_mrev(ST_POSPLAN_Handle handle, int32_t *posStepInt_mrev, _iq24 *posStepFrac_mrev) {
179  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
180  *posStepInt_mrev = obj->PosStepInt_mrev;
181  *posStepFrac_mrev = obj->PosStepFrac_mrev;
182  return;
183 } // end of STPOSPLAN_getPositionStepInt_mrev function
184 
189  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
190 
191  return(obj->VelLim);
192 } // end of STPOSPLAN_getVelocityLimit function
193 
198  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
199 
200  return(obj->AccLim);
201 } // end of STPOSPLAN_getAccelerationLimit function
202 
207  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
208 
209  return(obj->DecLim);
210 } // end of STPOSPLAN_getDecelerationLimit function
211 
216  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
217 
218  return(obj->JrkLim);
219 } // end of STPOSPLAN_getJerkLimit function
220 
224 static inline void STPOSPLAN_setEnable(ST_POSPLAN_Handle handle, bool enb) {
225  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
226 
227  obj->ENB = enb;
228 
229  return;
230 } // end of STPOSPLAN_setEnable function
231 
235 static inline bool STPOSPLAN_getEnable(ST_POSPLAN_Handle handle) {
236  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
237 
238  return (obj->ENB);
239 } // end of STPOSPLAN_getEnable function
240 
244 static inline void STPOSPLAN_setReset(ST_POSPLAN_Handle handle, bool res) {
245  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
246 
247  obj->RES = res;
248 
249  return;
250 } // end of STPOSPLAN_setReset function
251 
255 static inline bool STPOSPLAN_getReset(ST_POSPLAN_Handle handle) {
256  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
257 
258  return (obj->RES);
259 } // end of STPOSPLAN_getReset function
260 
265  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
266 
267  return (obj->STATUS);
268 } // end of STPOSPLAN_getStatus function
269 
270 
274 static inline uint16_t STPOSPLAN_getCurrentState(ST_POSPLAN_Handle handle) {
275  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
276 
277  return(obj->CurState);
278 } // end of STPOSPLAN_getCurrentState function
279 
283 static inline uint16_t STPOSPLAN_getCurrentTransition(ST_POSPLAN_Handle handle) {
284  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
285 
286  return(obj->CurTran);
287 } // end of STPOSPLAN_getCurrentTransition function
288 
293  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
294 
295  return(obj->FsmState);
296 } // end of STPOSPLAN_getFsmState function
297 
302  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
303 
304  return(obj->Timer_tick);
305 } // end of STPOSPLAN_getCurrentTimerValue_tick function
306 
312 static inline uint16_t STPOSPLAN_getCfgError(ST_POSPLAN_Handle handle, uint16_t *ERR_idx, uint16_t *ERR_code) {
313  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
314 
315  *ERR_idx = obj->CfgError.ERR_idx;
316  *ERR_code = obj->CfgError.ERR_code;
317 
318  return (obj->ERR_ID);
319 } // end of STPOSPLAN_getCfgError function
320 
324 static inline uint16_t STPOSPLAN_getErrorID(ST_POSPLAN_Handle handle) {
325  ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
326 
327  return (obj->ERR_ID);
328 } // end of STPOSPLAN_getErrorID function
329 
333 void STPOSPLAN_getCfgStateNum(ST_POSPLAN_Handle handle, uint16_t *StateNum);
334 
338 void STPOSPLAN_getCfgVarNum(ST_POSPLAN_Handle handle, uint16_t *VarNum);
339 
343 void STPOSPLAN_getCfgCondNum(ST_POSPLAN_Handle handle, uint16_t *CondNum);
344 
348 void STPOSPLAN_getCfgTranNum(ST_POSPLAN_Handle handle, uint16_t *TranNum);
349 
353 void STPOSPLAN_getCfgActNum(ST_POSPLAN_Handle handle, uint16_t *ActNum);
354 
361 void STPOSPLAN_addCfgCond(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2);
362 
366 void STPOSPLAN_delCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx);
367 
375 void STPOSPLAN_setCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2);
376 
384 void STPOSPLAN_getCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx, ST_PlanComp_e *Comp, _iq24 *Value1, _iq24 *Value2);
385 
391 void STPOSPLAN_addCfgVarCond(ST_POSPLAN_Handle handle, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp);
392 
396 void STPOSPLAN_delCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx);
397 
404 void STPOSPLAN_setCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp);
405 
412 void STPOSPLAN_getCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx1, uint16_t *VarIdx2, ST_PlanComp_e *Comp);
413 
425 void STPOSPLAN_addCfgTran(ST_POSPLAN_Handle handle, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 VelLim, _iq24 AccLim, _iq24 DecLim, _iq20 JrkLim);
426 
430 void STPOSPLAN_delCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx);
431 
444 void STPOSPLAN_setCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 VelLim, _iq24 AccLim, _iq24 DecLim, _iq20 JrkLim);
445 
458 void STPOSPLAN_getCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx, uint16_t *FromState, uint16_t *ToState, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, _iq24 *VelLim, _iq24 *AccLim, _iq24 *DecLim, _iq20 *JrkLim);
459 
470 void STPOSPLAN_addCfgAct(ST_POSPLAN_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);
471 
475 void STPOSPLAN_delCfgAct(ST_POSPLAN_Handle handle, uint16_t ActIdx);
476 
488 void STPOSPLAN_setCfgAct(ST_POSPLAN_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);
489 
501 void STPOSPLAN_getCfgAct(ST_POSPLAN_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);
502 
507 void STPOSPLAN_addCfgVar(ST_POSPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value);
508 
512 void STPOSPLAN_delCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx);
513 
519 void STPOSPLAN_setCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e Type, _iq24 Value);
520 
526 void STPOSPLAN_getCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e *Type, _iq24 *Value);
527 
532 void STPOSPLAN_setVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 Value);
533 
538 void STPOSPLAN_getVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value);
539 
543 void STPOSPLAN_setUnitProfDone(ST_POSPLAN_Handle handle, bool ProDON);
544 
549 void STPOSPLAN_setCfg(ST_POSPLAN_Handle handle, _iq24 T_sec, bool LoopENB);
550 
555 void STPOSPLAN_getCfg(ST_POSPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB);
556 
565 void STPOSPLAN_setCfgHaltState(ST_POSPLAN_Handle handle, int32_t PosStepInt_mrev, _iq24 PosStepFrac_mrev, _iq24 VelLim, _iq24 AccLim, _iq20 JrkLim, int32_t Timer_tick);
566 
575 void STPOSPLAN_getCfgHaltState(ST_POSPLAN_Handle handle, int32_t *PosStepInt_mrev, _iq24 *PosStepFrac_mrev, _iq24 *VelLim, _iq24 *AccLim, _iq20 *JrkLim, int32_t *Timer_tick);
576 
582 void STPOSPLAN_addCfgState(ST_POSPLAN_Handle handle, int32_t PosStepInt_mrev, _iq24 PosStep_Fracmrev, int32_t Timer_tick);
583 
587 void STPOSPLAN_delCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx);
588 
595 void STPOSPLAN_setCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx, int32_t PosStepInt_mrev, _iq24 PosStepFrac_mrev, int32_t Timer_tick);
596 
603 void STPOSPLAN_getCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx, int32_t *PosStepInt_mrev, _iq24 *PosStepFrac_mrev, int32_t *Timer_tick);
604 
608 
613 ST_POSPLAN_Handle STPOSPLAN_init(void *pMemory, const size_t numBytes);
614 
617 void STPOSPLAN_run(ST_POSPLAN_Handle handle);
618 
622 
632 void STPOSPLAN_setCfgArray(ST_POSPLAN_Handle handle, uint32_t *cfgArray, const size_t numBytes, uint16_t MaxActNum, uint16_t MaxCondNum, uint16_t MaxVarNum, uint16_t MaxTranNum, uint16_t MaxStateNum);
634 
635 #endif /*__SPINTAC_POS_PLAN_H__*/
static _iq24 STPOSPLAN_getVelocityLimit(ST_POSPLAN_Handle handle)
Gets the Velocity Limit (VelLim) for SpinTAC Position Plan.
void STPOSPLAN_delCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx)
Deletes a Condition from the SpinTAC Position Plan configuration.
ST_PlanCond_e
Enumeration for the Plan Condition options.
uint16_t ERR_idx
Plan component index that caused the error.
static uint16_t STPOSPLAN_getCurrentTransition(ST_POSPLAN_Handle handle)
Gets the Current Transition (CurTran) for SpinTAC Position Plan.
ST_PlanComp_e
Enumeration for the Plan Compare options.
Compares, VarIdx >= Value1 OR VarIdx1 >= VarIdx2.
Transition/Action with either condition satisfied.
static _iq24 STPOSPLAN_getAccelerationLimit(ST_POSPLAN_Handle handle)
Gets the Acceleration Limit (AccLim) for SpinTAC Position Plan.
_iq24 VelLim
Velocity limit { unit: [pu/s], value range: (0.0, 1.0] }.
static uint16_t STPOSPLAN_getCurrentState(ST_POSPLAN_Handle handle)
Gets the Current State (CurState) for SpinTAC Position Plan.
void STPOSPLAN_getCfgActNum(ST_POSPLAN_Handle handle, uint16_t *ActNum)
Returns the number of configured Actions in SpinTAC Position Plan.
void STPOSPLAN_getCfgTranNum(ST_POSPLAN_Handle handle, uint16_t *TranNum)
Returns the number of configured Transitions in SpinTAC Position Plan.
static void STPOSPLAN_setReset(ST_POSPLAN_Handle handle, bool res)
Sets the Reset signal (RES) for SpinTAC Position Plan.
ST_PlanVar_e
Enumeration for the Plan variable types.
ST_PlanError_t CfgError
Error decoding structure.
void STPOSPLAN_run(ST_POSPLAN_Handle handle)
Runs SpinTAC Position Plan calculation.
void STPOSPLAN_addCfgVar(ST_POSPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value)
Adds a variable to the SpinTAC Position Plan configuration.
Compares, Value1 <= VarIdx <= Value2.
ST_PlanStatus_e
Enumeration for the Plan Status States.
wait state, holding the position reference in idle state
Plan is waiting for a transition condition to be true.
static void STPOSPLAN_setEnable(ST_POSPLAN_Handle handle, bool enb)
Sets the Enable signal (ENB) for SpinTAC Position Plan.
static uint16_t STPOSPLAN_getCfgError(ST_POSPLAN_Handle handle, uint16_t *ERR_idx, uint16_t *ERR_code)
Gets the Configuration Error for SpinTAC Position Plan.
Compares, VarIdx != Value1 OR VarIdx1 != VarIdx2.
static ST_PlanStatus_e STPOSPLAN_getStatus(ST_POSPLAN_Handle handle)
Gets the Status value (STATUS) for SpinTAC Position Plan.
void STPOSPLAN_setCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Modifies a Condition in the SpinTAC Position Plan configuration.
Compares, Value1 > VarIdx > Value2.
void STPOSPLAN_delCfgAct(ST_POSPLAN_Handle handle, uint16_t ActIdx)
Deletes an action from the SpinTAC Position Plan configuration.
void STPOSPLAN_getVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value)
Gets the value of a SpinTAC Position Plan variable.
void STPOSPLAN_setCfgHaltState(ST_POSPLAN_Handle handle, int32_t PosStepInt_mrev, _iq24 PosStepFrac_mrev, _iq24 VelLim, _iq24 AccLim, _iq20 JrkLim, int32_t Timer_tick)
Configures the SpinTAC Position Plan Halt state.
Variable type output.
void STPOSPLAN_getCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e *Type, _iq24 *Value)
Returns a variable from the SpinTAC Position Plan configuration.
void STPOSPLAN_getCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx, uint16_t *FromState, uint16_t *ToState, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, _iq24 *VelLim, _iq24 *AccLim, _iq24 *DecLim, _iq20 *JrkLim)
Get a Transition from the SpinTAC Position Plan configuration.
_iq20 JrkLim
Jerk Limit { unit: [pu/s^3], value range: [0.0005, 2000.0] }.
ST_POSPLAN_Handle STPOSPLAN_init(void *pMemory, const size_t numBytes)
Initializes the SpinTAC Position Plan component.
Compares, VarIdx <= Value1 OR VarIdx1 <= VarIdx2.
void STPOSPLAN_setCfg(ST_POSPLAN_Handle handle, _iq24 T_sec, bool LoopENB)
Configures SpinTAC Position Plan.
void STPOSPLAN_setCfgArray(ST_POSPLAN_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 Position Plan data structure.
static void STPOSPLAN_getPositionStep_mrev(ST_POSPLAN_Handle handle, int32_t *posStepInt_mrev, _iq24 *posStepFrac_mrev)
Gets the Position Step (posStepInt_mrev, posStepFrac_mrev) for SpinTAC Position Plan.
static int32_t STPOSPLAN_getCurrentTimerValue_tick(ST_POSPLAN_Handle handle)
Gets the Current Time Value (Timer_tick) for SpinTAC Position Plan.
static bool STPOSPLAN_getReset(ST_POSPLAN_Handle handle)
Gets the Reset signal (RES) for SpinTAC Position Plan.
Compares, Value1 < VarIdx < Value2.
halt state, return to the position reference in idle state
void STPOSPLAN_getCfgVarNum(ST_POSPLAN_Handle handle, uint16_t *VarNum)
Returns the number of configured Variables in SpinTAC Position Plan.
Transition/Action with no conditions satisfied.
uint16_t ERR_code
Function specific condition that caused the error.
Compares, Value1 > VarIdx >= Value2.
uint16_t CurTran
Current transition of the state machine.
void STPOSPLAN_addCfgCond(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Adds a Condition to the SpinTAC Position Plan configuration.
Variable type input.
_iq24 AccLim
Acceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
void STPOSPLAN_addCfgState(ST_POSPLAN_Handle handle, int32_t PosStepInt_mrev, _iq24 PosStep_Fracmrev, int32_t Timer_tick)
Adds a State to the SpinTAC Position Plan configuration.
static _iq20 STPOSPLAN_getJerkLimit(ST_POSPLAN_Handle handle)
Gets the Jerk Limit (JrkLim) for SpinTAC Position Plan.
ST_PlanFsmState_e FsmState
State of the state machine.
void STPOSPLAN_setVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 Value)
Sets the value of a SpinTAC Position Plan variable.
Compares, VarIdx == Value1 OR VarIdx1 == VarIdx2.
Transition/Action with both conditions satisfied.
void STPOSPLAN_setCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx, int32_t PosStepInt_mrev, _iq24 PosStepFrac_mrev, int32_t Timer_tick)
Modifies a state in the SpinTAC Position Plan configuration.
struct _ST_POSPLAN_Handle_ * ST_POSPLAN_Handle
long _iq24
void STPOSPLAN_getCfgCondNum(ST_POSPLAN_Handle handle, uint16_t *CondNum)
Returns the number of configured Conditions in SpinTAC Position Plan.
void STPOSPLAN_getCfgHaltState(ST_POSPLAN_Handle handle, int32_t *PosStepInt_mrev, _iq24 *PosStepFrac_mrev, _iq24 *VelLim, _iq24 *AccLim, _iq20 *JrkLim, int32_t *Timer_tick)
Gets the SpinTAC Position Plan Halt state.
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.
void STPOSPLAN_runTick(ST_POSPLAN_Handle handle)
Runs SpinTAC Position Plan Timing. Call this only from an ISR.
void STPOSPLAN_addCfgTran(ST_POSPLAN_Handle handle, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 VelLim, _iq24 AccLim, _iq24 DecLim, _iq20 JrkLim)
Adds a Transition to the SpinTAC Position Plan configuration.
Compares, Value1 < VarIdx <= Value2.
bool RES
Reset bit { false: not reset; true: reset }.
void STPOSPLAN_addCfgAct(ST_POSPLAN_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 Position Plan configuration.
Public interface, object, and function definitions related to the SpinTAC Version object...
void STPOSPLAN_getCfg(ST_POSPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB)
Gets the SpinTAC Position Plan configuration.
Compares, Value1 >= VarIdx > Value2.
Action will be considered when entering the state.
void STPOSPLAN_setCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Modifies a Variable Condition to the SpinTAC Position Plan configuration.
void STPOSPLAN_getCfgStateNum(ST_POSPLAN_Handle handle, uint16_t *StateNum)
Returns the number of configured States in SpinTAC Position Plan.
void STPOSPLAN_setCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 VelLim, _iq24 AccLim, _iq24 DecLim, _iq20 JrkLim)
Modifies a Transition in the SpinTAC Position Plan configuration.
uint16_t CurState
Current state of the state machine.
Action will set the variable equal to a value.
static ST_PlanFsmState_e STPOSPLAN_getFsmState(ST_POSPLAN_Handle handle)
Gets the State Machine State (FsmState) for SpinTAC Position Plan.
Action will add a value to the variable.
void STPOSPLAN_delCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx)
Deletes a state from the SpinTAC Position Plan configuration.
int32_t PosStepInt_mrev
Position Step Integer part { unit: [MRev] }.
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.
void STPOSPLAN_setUnitProfDone(ST_POSPLAN_Handle handle, bool ProDON)
Sets a flag in SpinTAC Position Plan to indicate if the unit profile is complete. ...
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
uint16_t ERR_ID
Error ID { 0: no error; others: see error code }.
void STPOSPLAN_getCfgAct(ST_POSPLAN_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 Position Plan configuration.
void STPOSPLAN_getCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx, ST_PlanComp_e *Comp, _iq24 *Value1, _iq24 *Value2)
Returns a Condition from the SpinTAC Position Plan configuration.
void STPOSPLAN_reset(ST_POSPLAN_Handle handle)
Resets the SpinAC Position Plan component.
int32_t Timer_tick
State Timer { unit: [tick] }.
void STPOSPLAN_getCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx1, uint16_t *VarIdx2, ST_PlanComp_e *Comp)
Returns a Variable Condition from the SpinTAC Position Plan configuration.
long _iq20
_iq24 PosStepFrac_mrev
Position Step fraction part { unit: [MRev], value range: (-1.0, 1.0)}.
idle state, holding position
bool ENB
Enable bit { false: disabled; true: enabled }.
Variable type input/output.
void STPOSPLAN_delCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx)
Deletes a Variable Condition from the SpinTAC Position Plan configuration.
Compares, Value1 <= VarIdx < Value2.
Defines the ST_PosPlan_t data.
void STPOSPLAN_setCfgAct(ST_POSPLAN_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 Position Plan configuration.
busy state, running state machine
static _iq24 STPOSPLAN_getDecelerationLimit(ST_POSPLAN_Handle handle)
Gets the Deceleration Limit (DecLim) for SpinTAC Position Plan.
void STPOSPLAN_delCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx)
Deletes a Variable from the SpinTAC Position Plan configuration.
_iq24 DecLim
Deceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
static bool STPOSPLAN_getEnable(ST_POSPLAN_Handle handle)
Gets the Enable signal (ENB) for SpinTAC Position Plan.
static uint16_t STPOSPLAN_getErrorID(ST_POSPLAN_Handle handle)
Gets the Error value (ERR_ID) for SpinTAC Position Plan.
void STPOSPLAN_delCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx)
Deletes a Transition from the SpinTAC Position Plan configuration.
void STPOSPLAN_addCfgVarCond(ST_POSPLAN_Handle handle, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Adds a Variable Condition to the SpinTAC Position Plan configuration.
ST_PlanStatus_e STATUS
Plan status { ST_PLAN_IDLE, ST_PLAN_INIT, ST_PLAN_BUSY, ST_PLAN_HALT, ST_PLAN_WAIT}.
No comparison.
Plan is staying in a state until the timer is up.
void STPOSPLAN_setCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e Type, _iq24 Value)
Modifies a variable in the SpinTAC Position Plan configuration.
void STPOSPLAN_getCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx, int32_t *PosStepInt_mrev, _iq24 *PosStepFrac_mrev, int32_t *Timer_tick)
Returns a state from the SpinTAC Position Plan configuration.
Defines the ST_PlanError_t data.