MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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 {
67 ST_PLAN_IDLE=0,
68 ST_PLAN_INIT,
69 ST_PLAN_BUSY,
70 ST_PLAN_HALT,
71 ST_PLAN_WAIT
72 } ST_PlanStatus_e;
73
76 typedef enum {
77 ST_COND_NC=0,
78 ST_COND_FC,
79 ST_COND_AND,
80 ST_COND_OR
81 } ST_PlanCond_e;
82
85 typedef enum {
86 ST_COMP_NA=0,
87 ST_COMP_EQ,
88 ST_COMP_NEQ,
89 ST_COMP_GT,
90 ST_COMP_EGT,
91 ST_COMP_LW,
92 ST_COMP_ELW,
93 ST_COMP_In,
94 ST_COMP_EIn,
95 ST_COMP_InE,
96 ST_COMP_EInE,
97 ST_COMP_Out,
98 ST_COMP_EOut,
99 ST_COMP_OutE,
100 ST_COMP_EOutE
101 } ST_PlanComp_e;
102
105 typedef enum {
106 ST_ACT_EQ=0,
107 ST_ACT_ADD
108 } ST_PlanActOptn_e;
109
112 typedef enum {
113 ST_ACT_ENTR=0,
114 ST_ACT_EXIT
115 } ST_PlanActTrgr_e;
116
119 typedef enum {
120 ST_FSM_STATE_STAY=0,
121 ST_FSM_STATE_COND,
122 ST_FSM_STATE_TRAN
123 } ST_PlanFsmState_e;
124
127 typedef enum {
128 ST_VAR_INOUT=0,
129 ST_VAR_IN,
130 ST_VAR_OUT
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;
155 _iq24 PosStepFrac_mrev;
156 _iq24 VelLim;
157 _iq24 AccLim;
158 _iq24 DecLim;
159 _iq20 JrkLim;
160 // Information variables
161 ST_PlanStatus_e STATUS;
162 uint16_t CurState;
163 uint16_t CurTran;
164 ST_PlanFsmState_e FsmState;
165 int32_t Timer_tick;
166 uint16_t ERR_ID;
167 ST_PlanError_t CfgError;
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
188 static inline _iq24 STPOSPLAN_getVelocityLimit(ST_POSPLAN_Handle handle) {
189 ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
190
191 return(obj->VelLim);
192 } // end of STPOSPLAN_getVelocityLimit function
193
197 static inline _iq24 STPOSPLAN_getAccelerationLimit(ST_POSPLAN_Handle handle) {
198 ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
199
200 return(obj->AccLim);
201 } // end of STPOSPLAN_getAccelerationLimit function
202
206 static inline _iq24 STPOSPLAN_getDecelerationLimit(ST_POSPLAN_Handle handle) {
207 ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
208
209 return(obj->DecLim);
210 } // end of STPOSPLAN_getDecelerationLimit function
211
215 static inline _iq20 STPOSPLAN_getJerkLimit(ST_POSPLAN_Handle handle) {
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
264 static inline ST_PlanStatus_e STPOSPLAN_getStatus(ST_POSPLAN_Handle handle) {
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
292 static inline ST_PlanFsmState_e STPOSPLAN_getFsmState(ST_POSPLAN_Handle handle) {
293 ST_PosPlan_t *obj = (ST_PosPlan_t *)handle;
294
295 return(obj->FsmState);
296 } // end of STPOSPLAN_getFsmState function
297
301 static inline int32_t STPOSPLAN_getCurrentTimerValue_tick(ST_POSPLAN_Handle handle) {
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
607 void STPOSPLAN_reset(ST_POSPLAN_Handle handle);
608
613 ST_POSPLAN_Handle STPOSPLAN_init(void *pMemory, const size_t numBytes);
614
617 void STPOSPLAN_run(ST_POSPLAN_Handle handle);
618
621 void STPOSPLAN_runTick(ST_POSPLAN_Handle handle);
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__*/
STPOSPLAN_getVelocityLimit
static _iq24 STPOSPLAN_getVelocityLimit(ST_POSPLAN_Handle handle)
Gets the Velocity Limit (VelLim) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:188
STPOSPLAN_delCfgCond
void STPOSPLAN_delCfgCond(ST_POSPLAN_Handle handle, uint16_t CondIdx)
Deletes a Condition from the SpinTAC Position Plan configuration.
ST_PlanCond_e
ST_PlanCond_e
Enumeration for the Plan Condition options.
Definition: spintac_pos_plan.h:76
ST_PlanError_t::ERR_idx
uint16_t ERR_idx
Plan component index that caused the error.
Definition: spintac_pos_plan.h:140
STPOSPLAN_getCurrentTransition
static uint16_t STPOSPLAN_getCurrentTransition(ST_POSPLAN_Handle handle)
Gets the Current Transition (CurTran) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:283
ST_PlanComp_e
ST_PlanComp_e
Enumeration for the Plan Compare options.
Definition: spintac_pos_plan.h:85
ST_COMP_EGT
Compares, VarIdx >= Value1 OR VarIdx1 >= VarIdx2.
Definition: spintac_pos_plan.h:90
ST_COND_OR
Transition/Action with either condition satisfied.
Definition: spintac_pos_plan.h:80
STPOSPLAN_getAccelerationLimit
static _iq24 STPOSPLAN_getAccelerationLimit(ST_POSPLAN_Handle handle)
Gets the Acceleration Limit (AccLim) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:197
ST_PosPlan_t::VelLim
_iq24 VelLim
Velocity limit { unit: [pu/s], value range: (0.0, 1.0] }.
Definition: spintac_pos_plan.h:156
STPOSPLAN_getCurrentState
static uint16_t STPOSPLAN_getCurrentState(ST_POSPLAN_Handle handle)
Gets the Current State (CurState) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:274
STPOSPLAN_getCfgActNum
void STPOSPLAN_getCfgActNum(ST_POSPLAN_Handle handle, uint16_t *ActNum)
Returns the number of configured Actions in SpinTAC Position Plan.
STPOSPLAN_getCfgTranNum
void STPOSPLAN_getCfgTranNum(ST_POSPLAN_Handle handle, uint16_t *TranNum)
Returns the number of configured Transitions in SpinTAC Position Plan.
STPOSPLAN_setReset
static void STPOSPLAN_setReset(ST_POSPLAN_Handle handle, bool res)
Sets the Reset signal (RES) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:244
ST_PlanVar_e
ST_PlanVar_e
Enumeration for the Plan variable types.
Definition: spintac_pos_plan.h:127
ST_PosPlan_t::CfgError
ST_PlanError_t CfgError
Error decoding structure.
Definition: spintac_pos_plan.h:167
STPOSPLAN_run
void STPOSPLAN_run(ST_POSPLAN_Handle handle)
Runs SpinTAC Position Plan calculation.
STPOSPLAN_addCfgVar
void STPOSPLAN_addCfgVar(ST_POSPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value)
Adds a variable to the SpinTAC Position Plan configuration.
ST_COMP_In
Compares, Value1 <= VarIdx <= Value2.
Definition: spintac_pos_plan.h:93
ST_PlanStatus_e
ST_PlanStatus_e
Enumeration for the Plan Status States.
Definition: spintac_pos_plan.h:66
ST_PLAN_WAIT
wait state, holding the position reference in idle state
Definition: spintac_pos_plan.h:71
ST_FSM_STATE_COND
Plan is waiting for a transition condition to be true.
Definition: spintac_pos_plan.h:121
STPOSPLAN_setEnable
static void STPOSPLAN_setEnable(ST_POSPLAN_Handle handle, bool enb)
Sets the Enable signal (ENB) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:224
STPOSPLAN_getCfgError
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.
Definition: spintac_pos_plan.h:312
ST_COMP_NEQ
Compares, VarIdx != Value1 OR VarIdx1 != VarIdx2.
Definition: spintac_pos_plan.h:88
STPOSPLAN_getStatus
static ST_PlanStatus_e STPOSPLAN_getStatus(ST_POSPLAN_Handle handle)
Gets the Status value (STATUS) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:264
STPOSPLAN_setCfgCond
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.
ST_COMP_EOutE
Compares, Value1 > VarIdx > Value2.
Definition: spintac_pos_plan.h:100
STPOSPLAN_delCfgAct
void STPOSPLAN_delCfgAct(ST_POSPLAN_Handle handle, uint16_t ActIdx)
Deletes an action from the SpinTAC Position Plan configuration.
STPOSPLAN_getVar
void STPOSPLAN_getVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value)
Gets the value of a SpinTAC Position Plan variable.
STPOSPLAN_setCfgHaltState
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.
ST_VAR_OUT
Variable type output.
Definition: spintac_pos_plan.h:130
STPOSPLAN_getCfgVar
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.
STPOSPLAN_getCfgTran
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.
ST_PosPlan_t::JrkLim
_iq20 JrkLim
Jerk Limit { unit: [pu/s^3], value range: [0.0005, 2000.0] }.
Definition: spintac_pos_plan.h:159
STPOSPLAN_init
ST_POSPLAN_Handle STPOSPLAN_init(void *pMemory, const size_t numBytes)
Initializes the SpinTAC Position Plan component.
ST_COMP_ELW
Compares, VarIdx <= Value1 OR VarIdx1 <= VarIdx2.
Definition: spintac_pos_plan.h:92
STPOSPLAN_setCfg
void STPOSPLAN_setCfg(ST_POSPLAN_Handle handle, _iq24 T_sec, bool LoopENB)
Configures SpinTAC Position Plan.
STPOSPLAN_setCfgArray
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.
STPOSPLAN_getPositionStep_mrev
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.
Definition: spintac_pos_plan.h:178
STPOSPLAN_getCurrentTimerValue_tick
static int32_t STPOSPLAN_getCurrentTimerValue_tick(ST_POSPLAN_Handle handle)
Gets the Current Time Value (Timer_tick) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:301
STPOSPLAN_getReset
static bool STPOSPLAN_getReset(ST_POSPLAN_Handle handle)
Gets the Reset signal (RES) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:255
ST_COMP_EInE
Compares, Value1 < VarIdx < Value2.
Definition: spintac_pos_plan.h:96
ST_PLAN_HALT
halt state, return to the position reference in idle state
Definition: spintac_pos_plan.h:70
STPOSPLAN_getCfgVarNum
void STPOSPLAN_getCfgVarNum(ST_POSPLAN_Handle handle, uint16_t *VarNum)
Returns the number of configured Variables in SpinTAC Position Plan.
ST_COND_NC
Transition/Action with no conditions satisfied.
Definition: spintac_pos_plan.h:77
ST_PlanError_t::ERR_code
uint16_t ERR_code
Function specific condition that caused the error.
Definition: spintac_pos_plan.h:141
ST_COMP_EOut
Compares, Value1 > VarIdx >= Value2.
Definition: spintac_pos_plan.h:98
ST_PosPlan_t::CurTran
uint16_t CurTran
Current transition of the state machine.
Definition: spintac_pos_plan.h:163
STPOSPLAN_addCfgCond
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.
ST_VAR_IN
Variable type input.
Definition: spintac_pos_plan.h:129
ST_PosPlan_t::AccLim
_iq24 AccLim
Acceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
Definition: spintac_pos_plan.h:157
ST_PlanFsmState_e
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
Definition: spintac_pos_plan.h:119
STPOSPLAN_addCfgState
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.
STPOSPLAN_getJerkLimit
static _iq20 STPOSPLAN_getJerkLimit(ST_POSPLAN_Handle handle)
Gets the Jerk Limit (JrkLim) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:215
ST_PosPlan_t::FsmState
ST_PlanFsmState_e FsmState
State of the state machine.
Definition: spintac_pos_plan.h:164
STPOSPLAN_setVar
void STPOSPLAN_setVar(ST_POSPLAN_Handle handle, uint16_t VarIdx, _iq24 Value)
Sets the value of a SpinTAC Position Plan variable.
ST_COMP_EQ
Compares, VarIdx == Value1 OR VarIdx1 == VarIdx2.
Definition: spintac_pos_plan.h:87
ST_COND_AND
Transition/Action with both conditions satisfied.
Definition: spintac_pos_plan.h:79
STPOSPLAN_setCfgState
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.
ST_POSPLAN_Handle
struct _ST_POSPLAN_Handle_ * ST_POSPLAN_Handle
Definition: spintac_pos_plan.h:172
_iq24
long _iq24
Definition: 32b/IQmathLib.h:230
STPOSPLAN_getCfgCondNum
void STPOSPLAN_getCfgCondNum(ST_POSPLAN_Handle handle, uint16_t *CondNum)
Returns the number of configured Conditions in SpinTAC Position Plan.
STPOSPLAN_getCfgHaltState
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.
ST_COMP_Out
Compares, Value1 >= VarIdx >= Value2.
Definition: spintac_pos_plan.h:97
ST_PlanActTrgr_e
ST_PlanActTrgr_e
Enumeration for the Plan Action trigger point types.
Definition: spintac_pos_plan.h:112
ST_ACT_EXIT
Action will be considered when exiting the state.
Definition: spintac_pos_plan.h:114
ST_COMP_LW
Compares, VarIdx < Value1 OR VarIdx1 < VarIdx2.
Definition: spintac_pos_plan.h:91
STPOSPLAN_runTick
void STPOSPLAN_runTick(ST_POSPLAN_Handle handle)
Runs SpinTAC Position Plan Timing. Call this only from an ISR.
STPOSPLAN_addCfgTran
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.
ST_COMP_EIn
Compares, Value1 < VarIdx <= Value2.
Definition: spintac_pos_plan.h:94
ST_PosPlan_t::RES
bool RES
Reset bit { false: not reset; true: reset }.
Definition: spintac_pos_plan.h:152
STPOSPLAN_addCfgAct
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.
spintac_version.h
Public interface, object, and function definitions related to the SpinTAC Version object...
STPOSPLAN_getCfg
void STPOSPLAN_getCfg(ST_POSPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB)
Gets the SpinTAC Position Plan configuration.
ST_COMP_OutE
Compares, Value1 >= VarIdx > Value2.
Definition: spintac_pos_plan.h:99
ST_ACT_ENTR
Action will be considered when entering the state.
Definition: spintac_pos_plan.h:113
STPOSPLAN_setCfgVarCond
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.
STPOSPLAN_getCfgStateNum
void STPOSPLAN_getCfgStateNum(ST_POSPLAN_Handle handle, uint16_t *StateNum)
Returns the number of configured States in SpinTAC Position Plan.
STPOSPLAN_setCfgTran
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.
ST_PosPlan_t::CurState
uint16_t CurState
Current state of the state machine.
Definition: spintac_pos_plan.h:162
ST_ACT_EQ
Action will set the variable equal to a value.
Definition: spintac_pos_plan.h:106
STPOSPLAN_getFsmState
static ST_PlanFsmState_e STPOSPLAN_getFsmState(ST_POSPLAN_Handle handle)
Gets the State Machine State (FsmState) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:292
ST_ACT_ADD
Action will add a value to the variable.
Definition: spintac_pos_plan.h:107
STPOSPLAN_delCfgState
void STPOSPLAN_delCfgState(ST_POSPLAN_Handle handle, uint16_t StateIdx)
Deletes a state from the SpinTAC Position Plan configuration.
ST_PosPlan_t::PosStepInt_mrev
int32_t PosStepInt_mrev
Position Step Integer part { unit: [MRev] }.
Definition: spintac_pos_plan.h:154
ST_PLAN_INIT
init state, initialize internal states
Definition: spintac_pos_plan.h:68
ST_FSM_STATE_TRAN
Plan is in transition with a motion profile.
Definition: spintac_pos_plan.h:122
ST_COMP_GT
Compares, VarIdx > Value1 OR VarIdx1 > VarIdx2.
Definition: spintac_pos_plan.h:89
ST_COND_FC
Transition/Action with first condition satisfied.
Definition: spintac_pos_plan.h:78
STPOSPLAN_setUnitProfDone
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
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
Definition: spintac_pos_plan.h:105
ST_PosPlan_t::ERR_ID
uint16_t ERR_ID
Error ID { 0: no error; others: see error code }.
Definition: spintac_pos_plan.h:166
STPOSPLAN_getCfgAct
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.
STPOSPLAN_getCfgCond
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.
STPOSPLAN_reset
void STPOSPLAN_reset(ST_POSPLAN_Handle handle)
Resets the SpinAC Position Plan component.
ST_PosPlan_t::Timer_tick
int32_t Timer_tick
State Timer { unit: [tick] }.
Definition: spintac_pos_plan.h:165
STPOSPLAN_getCfgVarCond
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.
_iq20
long _iq20
Definition: 32b/IQmathLib.h:234
ST_PosPlan_t::PosStepFrac_mrev
_iq24 PosStepFrac_mrev
Position Step fraction part { unit: [MRev], value range: (-1.0, 1.0)}.
Definition: spintac_pos_plan.h:155
ST_PLAN_IDLE
idle state, holding position
Definition: spintac_pos_plan.h:67
ST_PosPlan_t::ENB
bool ENB
Enable bit { false: disabled; true: enabled }.
Definition: spintac_pos_plan.h:151
ST_VAR_INOUT
Variable type input/output.
Definition: spintac_pos_plan.h:128
STPOSPLAN_delCfgVarCond
void STPOSPLAN_delCfgVarCond(ST_POSPLAN_Handle handle, uint16_t CondIdx)
Deletes a Variable Condition from the SpinTAC Position Plan configuration.
ST_COMP_InE
Compares, Value1 <= VarIdx < Value2.
Definition: spintac_pos_plan.h:95
ST_PosPlan_t
Defines the ST_PosPlan_t data.
Definition: spintac_pos_plan.h:148
STPOSPLAN_setCfgAct
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.
ST_PLAN_BUSY
busy state, running state machine
Definition: spintac_pos_plan.h:69
STPOSPLAN_getDecelerationLimit
static _iq24 STPOSPLAN_getDecelerationLimit(ST_POSPLAN_Handle handle)
Gets the Deceleration Limit (DecLim) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:206
STPOSPLAN_delCfgVar
void STPOSPLAN_delCfgVar(ST_POSPLAN_Handle handle, uint16_t VarIdx)
Deletes a Variable from the SpinTAC Position Plan configuration.
ST_PosPlan_t::DecLim
_iq24 DecLim
Deceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
Definition: spintac_pos_plan.h:158
STPOSPLAN_getEnable
static bool STPOSPLAN_getEnable(ST_POSPLAN_Handle handle)
Gets the Enable signal (ENB) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:235
STPOSPLAN_getErrorID
static uint16_t STPOSPLAN_getErrorID(ST_POSPLAN_Handle handle)
Gets the Error value (ERR_ID) for SpinTAC Position Plan.
Definition: spintac_pos_plan.h:324
STPOSPLAN_delCfgTran
void STPOSPLAN_delCfgTran(ST_POSPLAN_Handle handle, uint16_t TranIdx)
Deletes a Transition from the SpinTAC Position Plan configuration.
STPOSPLAN_addCfgVarCond
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_PosPlan_t::STATUS
ST_PlanStatus_e STATUS
Plan status { ST_PLAN_IDLE, ST_PLAN_INIT, ST_PLAN_BUSY, ST_PLAN_HALT, ST_PLAN_WAIT}.
Definition: spintac_pos_plan.h:161
ST_COMP_NA
No comparison.
Definition: spintac_pos_plan.h:86
ST_FSM_STATE_STAY
Plan is staying in a state until the timer is up.
Definition: spintac_pos_plan.h:120
STPOSPLAN_setCfgVar
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.
STPOSPLAN_getCfgState
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.
ST_PlanError_t
Defines the ST_PlanError_t data.
Definition: spintac_pos_plan.h:139