Utils.h File Reference

General purpose macros. More...

#include "IQConstants.h"

Go to the source code of this file.

Defines

#define MAX(A, B)   ((A) >= (B) ? (A) : (B))
 returns the maximum of A, B
#define MIN(A, B)   ((A) <= (B) ? (A) : (B))
 returns the minimum of A, B
#define ABS(C)   ((C) >= (0) ? (C) : (-C))
 returns the absolute value of C
#define LIM(A, L)   (A)=MIN(MAX(A,-L),L)
 reassigns A so that it is limited by +/- L (arg +L)
#define WRAPSUP(A, ANG)   ((A) > (ANG) ? (A-_IQmpy(ANG,2)) : (A))
 wrap max angle to ANG
#define WRAPINF(A, ANG)   ((A) < (ANG) ? (A+_IQmpy(ANG,2)) : (A))
 wrap min angle to ANG
#define WRAP(A, ANG)   (A) = WRAPINF(WRAPSUP(A,ANG),-ANG)
 wrap min, max angle to ANG
#define WRAPSUP2PI(A)   ((A) > (PI) ? (A-TWOPI) : (A))
 wrap max angle to PI
#define WRAPINF2PI(A)   ((A) < (-PI) ? (A+TWOPI) : (A))
 wrap min angle to PI
#define WRAP2PI(A)   (A) = WRAPINF2PI(WRAPSUP2PI(A))
 wrap min, max angle to PI

Functions

static _iq GetMax (volatile _iq *a, volatile _iq *b, volatile _iq **ptrMax)
static _iq GetMin (volatile _iq *a, volatile _iq *b, volatile _iq **ptrMin)

Detailed Description

General purpose macros.

File Name : Utils.h Project : TIMotorLIB

TI Doc: na

Author:
Pablo Garcia (pgarcia@isa.uniovi.es)
Date:
2007

Definition in file Utils.h.


Define Documentation

#define ABS (  )     ((C) >= (0) ? (C) : (-C))

returns the absolute value of C

Definition at line 63 of file Utils.h.

#define LIM ( A,
 )     (A)=MIN(MAX(A,-L),L)

reassigns A so that it is limited by +/- L (arg +L)

Definition at line 65 of file Utils.h.

#define MAX ( A,
 )     ((A) >= (B) ? (A) : (B))

returns the maximum of A, B

Definition at line 57 of file Utils.h.

#define MIN ( A,
 )     ((A) <= (B) ? (A) : (B))

returns the minimum of A, B

Definition at line 59 of file Utils.h.

#define WRAP ( A,
ANG   )     (A) = WRAPINF(WRAPSUP(A,ANG),-ANG)

wrap min, max angle to ANG

Definition at line 71 of file Utils.h.

#define WRAP2PI (  )     (A) = WRAPINF2PI(WRAPSUP2PI(A))

wrap min, max angle to PI

Definition at line 78 of file Utils.h.

#define WRAPINF ( A,
ANG   )     ((A) < (ANG) ? (A+_IQmpy(ANG,2)) : (A))

wrap min angle to ANG

Definition at line 69 of file Utils.h.

#define WRAPINF2PI (  )     ((A) < (-PI) ? (A+TWOPI) : (A))

wrap min angle to PI

Definition at line 76 of file Utils.h.

#define WRAPSUP ( A,
ANG   )     ((A) > (ANG) ? (A-_IQmpy(ANG,2)) : (A))

wrap max angle to ANG

Definition at line 67 of file Utils.h.

#define WRAPSUP2PI (  )     ((A) > (PI) ? (A-TWOPI) : (A))

wrap max angle to PI

Definition at line 74 of file Utils.h.


Function Documentation

static _iq GetMax ( volatile _iq *  a,
volatile _iq *  b,
volatile _iq **  ptrMax 
) [inline, static]

return the maximum of two numbers and a pointer to the address of maximum variable

Parameters:
a,: pointer to first number
b,: pointer to second number
ptrMax,: address of the maximum variable RETURNS:
Returns:
: maximum value

Definition at line 97 of file Utils.h.

static _iq GetMin ( volatile _iq *  a,
volatile _iq *  b,
volatile _iq **  ptrMin 
) [inline, static]

return the minimum of two numbers and a pointer to the address of minimum variable

Parameters:
a,: pointer to first number
b,: pointer to second number
ptrMin,: address of the minimum variable
Returns:
: minimum value

Definition at line 118 of file Utils.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Sat Apr 16 11:42:45 2011 for TIMotorLIB by  doxygen 1.6.3