LIBDSP Version 4.1.9
LIBDSP Software Library
Loading...
Searching...
No Matches
tpt_atan2_q15.c File Reference
#include "tpt_math.h"
Include dependency graph for tpt_atan2_q15.c:

Macros

#define NORM_SH   (15)
#define CST_1   (1L << NORM_SH)
#define CST_2   (4L << NORM_SH)
#define D2Q(F)
#define MULQ(a, b)
#define OCTANTIFY(_x, _y, _o)
#define BRAD_PI   0x2000 /* 32768/4 */

Functions

static q31_t atan1 (const q31_t x)
q15_t tpt_atan2_q15 (q15_t y, q15_t x)
 Arc tangent in radian of y/x using sign of x and y to determine right quadrant.

Variables

static q15_t ga []
static q15_t gb []

Macro Definition Documentation

◆ BRAD_PI

#define BRAD_PI   0x2000 /* 32768/4 */

◆ CST_1

#define CST_1   (1L << NORM_SH)

◆ CST_2

#define CST_2   (4L << NORM_SH)

◆ D2Q

#define D2Q ( F)
Value:
((q15_t)((float)F * (float)CST_1))
#define CST_1
Definition tpt_div_q31.c:30
int16_t q15_t
16-bit fractional data type in 1.15 format.
Definition tpt_math_dsp.h:145

◆ MULQ

#define MULQ ( a,
b )
Value:
((q15_t)(((q31_t)(a) * (b)) >> 16))
int32_t q31_t
32-bit fractional data type in 1.31 format.
Definition tpt_math_dsp.h:141

◆ NORM_SH

#define NORM_SH   (15)

◆ OCTANTIFY

#define OCTANTIFY ( _x,
_y,
_o )
Value:
do \
{ \
q31_t _t; \
_o = 0; \
if (_y < 0) \
{ \
_x = -_x; \
_y = -_y; \
_o -= 4; \
} \
if (_x <= 0) \
{ \
_t = _x; \
_x = _y; \
_y = -_t; \
_o += 2; \
} \
if (_x <= _y) \
{ \
_t = _y - _x; \
_x = _x + _y; \
_y = _t; \
_o += 1; \
} \
} while (0);

Function Documentation

◆ atan1()

q31_t atan1 ( const q31_t x)
inlinestatic

Variable Documentation

◆ ga

q15_t ga[]
static
Initial value:
= {
D2Q(0.00012894702004 / PI_F32), D2Q(0.00410552202930 / PI_F32),
D2Q(0.01797827343558 / PI_F32), D2Q(0.04487866261926 / PI_F32),
D2Q(0.08467202719892 / PI_F32), D2Q(0.13495471234832 / PI_F32),
D2Q(0.19237801112651 / PI_F32), D2Q(0.25366425315298 / PI_F32)}
#define PI_F32
Definition dsp_pi_values.h:29
#define D2Q(F)
Definition tpt_atan2_q15.c:13

◆ gb

q15_t gb[]
static
Initial value:
= {
D2Q(0.99534894623805 / PI_F32 * 2), D2Q(0.96541373335686 / PI_F32 * 2),
D2Q(0.91062230899554 / PI_F32 * 2), D2Q(0.83915654988516 / PI_F32 * 2),
D2Q(0.75963586412685 / PI_F32 * 2), D2Q(0.67915650580081 / PI_F32 * 2),
D2Q(0.60252898580173 / PI_F32 * 2), D2Q(0.53241718079412 / PI_F32 * 2)}