3#ifndef __INC_LIB8TION_TRIG_H
4#define __INC_LIB8TION_TRIG_H
28#if defined(USE_SIN_32)
30#define sin16 fl::sin16lut
31#define cos16 fl::cos16lut
38#define sin16 sin16_avr
49 static const uint8_t data[] = {
50 0, 0, 49, 0, 6393 % 256, 6393 / 256, 48, 0,
51 12539 % 256, 12539 / 256, 44, 0, 18204 % 256, 18204 / 256, 38, 0,
52 23170 % 256, 23170 / 256, 31, 0, 27245 % 256, 27245 / 256, 23, 0,
53 30273 % 256, 30273 / 256, 14, 0, 32137 % 256, 32137 / 256, 4 };
55 uint16_t
offset = (theta & 0x3FFF);
85 u.blo = data[sectionX4];
86 u.bhi = data[sectionX4 + 1];
87 m = data[sectionX4 + 2];
89 uint8_t secoffset8 = (uint8_t)(
offset) / 2;
91 uint16_t mx = m * secoffset8;
114 static const uint16_t base[] = {0, 6393, 12539, 18204,
115 23170, 27245, 30273, 32137};
116 static const uint8_t slope[] = {49, 48, 44, 38, 31, 23, 14, 4};
118 uint16_t
offset = (theta & 0x3FFF) >> 3;
122 uint8_t section =
offset / 256;
123 uint16_t b = base[section];
124 uint8_t m = slope[section];
126 uint8_t secoffset8 = (uint8_t)(
offset) / 2;
128 uint16_t mx = m * secoffset8;
158#if defined(__AVR__) && !defined(LIB8_ATTINY)
173 asm volatile(
"sbrc %[theta],6 \n\t"
179 uint8_t secoffset =
offset & 0x0F;
186 uint8_t section =
offset >> 4;
187 uint8_t s2 = section * 2;
197 asm volatile(
"mul %[m16],%[secoffset] \n\t"
202 "andi %[mx],0x0F \n\t"
204 "andi %[xr1], 0xF0 \n\t"
205 "or %[mx], %[xr1] \n\t"
206 : [mx]
"=d"(mx), [xr1]
"=d"(xr1)
207 : [m16]
"d"(m16), [secoffset]
"d"(secoffset));
238 uint8_t secoffset =
offset & 0x0F;
242 uint8_t section =
offset >> 4;
243 uint8_t s2 = section * 2;
250 uint8_t mx = (m16 * secoffset) >> 4;
UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
LIB8STATIC int16_t cos16(uint16_t theta)
Fast 16-bit approximation of cos(x).
LIB8STATIC int16_t sin16_C(uint16_t theta)
Fast 16-bit approximation of sin(x).
LIB8STATIC uint8_t cos8(uint8_t theta)
Fast 8-bit approximation of cos(x).
LIB8STATIC uint8_t sin8_C(uint8_t theta)
Fast 8-bit approximation of sin(x).
#define sin16
Platform-independent alias of the fast sin implementation.
const uint8_t b_m16_interleave[]
Pre-calculated lookup table used in sin8() and cos8() functions.
#define sin8
Platform-independent alias of the fast sin implementation.
#define LIB8STATIC
Define a LIB8TION member function as static inline with an "unused" attribute.
Defines static inlining macros for lib8tion functions.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]