03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function GFLIB_AtanYX_F32<br />

4.33.5 Re-entrancy<br />

The function is re-entrant.<br />

4.33.6 Code Example<br />

pointer to approximation coefficients. The &pParam<br />

parameter is optional <strong>and</strong> in case it is not used, the default<br />

GFLIB_ATAN_DEFAULT_FLT approximation<br />

coefficients are used.<br />

#include "gflib.h"<br />

tFloat fltInput;<br />

tFloat fltAngle;<br />

void main(void)<br />

{<br />

// input ratio = 1<br />

fltInput = 1;<br />

}<br />

// output angle should be 0.7853981634 => pi/4<br />

fltAngle = GFLIB_Atan_FLT (fltInput, GFLIB_ATAN_DEFAULT_FLT);<br />

// output angle should be 0.7853981634 => pi/4<br />

fltAngle = GFLIB_Atan (fltInput, GFLIB_ATAN_DEFAULT_FLT, Define FLT);<br />

// ##############################################################<br />

// Available only if single precision floating point<br />

// implementation selected as default<br />

// ##############################################################<br />

// output angle should be 0.7853981634 => pi/4<br />

fltAngle = GFLIB_Atan (fltInput);<br />

4.34 Function GFLIB_AtanYX_F32<br />

This function calculate the angle between the positive x-axis <strong>and</strong> the direction of a vector<br />

given by the (x, y) coordinates.<br />

4.34.1 Declaration<br />

tFrac32 GFLIB_AtanYX_F32(tFrac32 f32InY, tFrac32 f32InX);<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

246 Freescale Semiconductor, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!