6#define FASTLED_INTERNAL
11FASTLED_NAMESPACE_BEGIN
14#define RAND16_SEED 1337
39void *
memset8 (
void * ptr, uint8_t val, uint16_t num )
42 " movw r26, %[ptr] \n\t"
43 " sbrs %A[num], 0 \n\t"
44 " rjmp Lseteven_%= \n\t"
45 " rjmp Lsetodd_%= \n\t"
51 " subi %A[num], 2 \n\t"
52 " brcc Lsetloop_%= \n\t"
53 " sbci %B[num], 0 \n\t"
54 " brcc Lsetloop_%= \n\t"
66void *
memcpy8 (
void * dst,
const void* src, uint16_t num )
69 " movw r30, %[src] \n\t"
70 " movw r26, %[dst] \n\t"
71 " sbrs %A[num], 0 \n\t"
72 " rjmp Lcpyeven_%= \n\t"
73 " rjmp Lcpyodd_%= \n\t"
75 " ld __tmp_reg__, Z+ \n\t"
76 " st X+, __tmp_reg__ \n\t"
78 " ld __tmp_reg__, Z+ \n\t"
79 " st X+, __tmp_reg__ \n\t"
81 " subi %A[num], 2 \n\t"
82 " brcc Lcpyloop_%= \n\t"
83 " sbci %B[num], 0 \n\t"
84 " brcc Lcpyloop_%= \n\t"
94void *
memmove8 (
void * dst,
const void* src, uint16_t num )
101 dst = (
char*)dst + num;
102 src = (
char*)src + num;
104 " movw r30, %[src] \n\t"
105 " movw r26, %[dst] \n\t"
106 " sbrs %A[num], 0 \n\t"
107 " rjmp Lmoveven_%= \n\t"
108 " rjmp Lmovodd_%= \n\t"
110 " ld __tmp_reg__, -Z \n\t"
111 " st -X, __tmp_reg__ \n\t"
113 " ld __tmp_reg__, -Z \n\t"
114 " st -X, __tmp_reg__ \n\t"
116 " subi %A[num], 2 \n\t"
117 " brcc Lmovloop_%= \n\t"
118 " sbci %B[num], 0 \n\t"
119 " brcc Lmovloop_%= \n\t"
142void test1abs( int8_t i)
144 Serial.print(
"abs("); Serial.print(i); Serial.print(
") = ");
146 Serial.print(j); Serial.println(
" ");
152 for( int8_t q = -128; q != 127; ++q) {
164 Serial.println(
"mul8:");
165 for( r = 0; r <= 20; r += 1) {
166 Serial.print(r); Serial.print(
" : ");
167 for( c = 0; c <= 20; c += 1) {
170 Serial.print(t); Serial.print(
' ');
174 Serial.println(
"done.");
184 Serial.println(
"scale8:");
185 for( r = 0; r <= 240; r += 10) {
186 Serial.print(r); Serial.print(
" : ");
187 for( c = 0; c <= 240; c += 10) {
190 Serial.print(t); Serial.print(
' ');
196 Serial.println(
"scale8_video:");
198 for( r = 0; r <= 100; r += 4) {
199 Serial.print(r); Serial.print(
" : ");
200 for( c = 0; c <= 100; c += 4) {
203 Serial.print(t); Serial.print(
' ');
208 Serial.println(
"done.");
218 for( r = 0; r <= 240; r += 10) {
219 Serial.print(r); Serial.print(
" : ");
220 for( c = 0; c <= 240; c += 10) {
223 Serial.print(t); Serial.print(
' ');
227 Serial.println(
"done.");
235 for(
byte z = 0; z < 10; ++z) {
238 Serial.print(
"nscale8x3_video( ");
239 Serial.print(r); Serial.print(
", ");
240 Serial.print(g); Serial.print(
", ");
241 Serial.print(b); Serial.print(
", ");
242 Serial.print(sc); Serial.print(
") = [ ");
246 Serial.print(r); Serial.print(
", ");
247 Serial.print(g); Serial.print(
", ");
248 Serial.print(b); Serial.print(
"]");
252 Serial.println(
"done.");
central include file for FastLED, defines the CFastLED class/object
void * memcpy8(void *dst, const void *src, uint16_t num)
Faster alternative to memcpy() on AVR.
void * memset8(void *ptr, uint8_t value, uint16_t num)
Faster alternative to memset() on AVR.
void * memmove8(void *dst, const void *src, uint16_t num)
Faster alternative to memmove() on AVR.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE int8_t abs8(int8_t i)
Take the absolute value of a signed 8-bit uint8_t.
LIB8STATIC_ALWAYS_INLINE uint8_t mul8(uint8_t i, uint8_t j)
8x8 bit multiplication, with 8-bit result.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
uint16_t rand16seed
Seed for the random number generator functions.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
LIB8STATIC void nscale8x3_video(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose de...
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
#define RAND16_SEED
Seed for the random number generator functions.
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.