GY-63_MS5611/libraries/FastTrig/FastTrig.h

66 lines
1.1 KiB
C
Raw Normal View History

2022-12-03 06:59:56 -05:00
#pragma once
2021-01-29 06:31:58 -05:00
//
// FILE: FastTrig.h
// AUTHOR: Rob Tillaart
2022-12-03 06:59:56 -05:00
// VERSION: 0.2.0
2021-01-29 06:31:58 -05:00
// PURPOSE: Arduino library for a faster approximation of sin() and cos()
// DATE: 2011-08-18
// URL: https://github.com/RobTillaart/FastTrig
// https://forum.arduino.cc/index.php?topic=69723.0
2022-11-07 04:20:54 -05:00
//
// HISTORY: see changelog.md
2021-04-25 13:56:44 -04:00
2021-01-29 06:31:58 -05:00
2022-12-03 06:59:56 -05:00
#ifdef ESP_PLATFORM
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
#else
2021-01-29 06:31:58 -05:00
#include "Arduino.h"
2022-12-03 06:59:56 -05:00
#endif
2021-01-29 06:31:58 -05:00
2022-11-07 04:20:54 -05:00
2022-12-03 06:59:56 -05:00
#define FAST_TRIG_LIB_VERSION (F("0.2.0"))
2022-04-15 10:43:05 -04:00
2022-12-03 06:59:56 -05:00
#ifdef __cplusplus
extern "C"
{
#endif
extern uint16_t sinTable16[];
extern uint8_t sinTable8[];
2021-01-29 06:31:58 -05:00
2021-12-18 07:14:58 -05:00
2021-01-29 06:31:58 -05:00
///////////////////////////////////////////////////////
//
// GONIO LOOKUP
//
2022-04-15 10:43:05 -04:00
float isin(float f);
2021-01-29 06:31:58 -05:00
2022-04-15 10:43:05 -04:00
float icos(float x);
2021-12-18 07:14:58 -05:00
2022-04-15 10:43:05 -04:00
float itan(float f);
2021-08-10 15:24:22 -04:00
2022-12-03 06:59:56 -05:00
// 0 returns NAN but we have a icot(x) cotangent.
2022-04-15 10:43:05 -04:00
float icot(float f);
2021-08-10 15:24:22 -04:00
2021-01-29 06:31:58 -05:00
///////////////////////////////////////////////////////
//
2022-12-03 06:59:56 -05:00
// INVERSE GONIO LOOKUP
2021-01-29 06:31:58 -05:00
//
2022-04-15 10:43:05 -04:00
float iasin(float f);
float iacos(float f);
2022-12-03 06:59:56 -05:00
// PLACEHOLDER no good implementation (do not use).
2022-04-15 10:43:05 -04:00
float iatan(float f);
2021-01-29 06:31:58 -05:00
2021-12-18 07:14:58 -05:00
2022-12-03 06:59:56 -05:00
#ifdef __cplusplus
}
#endif
// -- END OF FILE --