Defines | Functions

Trigonometry functions returning 16-bit integer values

Defines

#define TRIGINT_SIN16_STATIC_TABLE   1
 Compile time macro that can be used to disable the static (compile-time) lookup table.

Functions

int16_t trigint_sin16 (trigint_angle_t angle)
 Returns the sine of angle as signed 16-bit integer.
int trigint_sin16_table_size ()
 Returns the size of the lookup table used for signed 16-bit integers.
int16_t trigint_sin16_table_lookup (int index)
 Lookup a specific table entry for the given index.
void trigint_sin16_init ()
 Initialize the dynamic table.

Define Documentation

#define TRIGINT_SIN16_STATIC_TABLE   1

Compile time macro that can be used to disable the static (compile-time) lookup table.

This can be used to reduce compiled code size at the expense of requiring a call to trigint_sin16_init() at runtime.


Function Documentation

int16_t trigint_sin16 ( trigint_angle_t  angle  ) 

Returns the sine of angle as signed 16-bit integer.

It is scaled to an amplitude of 32,767, thus values will range from -32,767 to +32,767.

Parameters:
angle the angle to compute the sine of
Returns:
the sine value, as a signed 16-bit integer
int trigint_sin16_table_size (  ) 

Returns the size of the lookup table used for signed 16-bit integers.

Returns:
the size of the lookup table used for signed 16-bit integers
Note:
This is generally only needed for debugging purposes.
int16_t trigint_sin16_table_lookup ( int  index  )  [inline]

Lookup a specific table entry for the given index.

Parameters:
index a table index
Returns:
the 16-bit signed value at the table entry
Note:
This is generally only needed for debugging purposes.
void trigint_sin16_init (  ) 

Initialize the dynamic table.

Must be called before any calls to trigint_sin16(). This is only necessary and available if the TRIGINT_SIN16_STATIC_TABLE macro is set to 0.