/**
 * Example for a interpolated sine/cosine table lookup
 *
 * modified by true to work in 8 bits, and to fix cos7 function
 *
 */

#ifndef INC_SIN7_H_
#define INC_SIN7_H_



#include <stdint.h>



/**
 * Sine calculation using interpolated table lookup.
 * Instead of radians or degrees we use "turns" here. Means this
 * sine does NOT return one phase for 0 to 2*PI, but for 0 to 1.
 * Input: -1 to 1 as int8 "Q7"  == -128 to 127.
 * Output: -1 to 1 as int8 "Q7" == -128 to 127.
 *
 * @param int8_t angle Q7
 * @return int8_t Q7
 */
int8_t sin7(int8_t angle);

/**
 * Cosine calculation using interpolated table lookup.
 * Instead of radians or degrees we use "turns" here. Means this
 * cosine does NOT return one phase for 0 to 2*PI, but for 0 to 1.
 * Input: -1 to 1 as int8 "Q7"  == -128 to 127.
 * Output: -1 to 1 as int8 "Q7" == -128 to 127.
 *
 * @param int8_t angle Q7
 * @return int8_t Q7
 */
int8_t cos7(int8_t angle);



#endif /* INC_MATH_SIN7_H_ */
