@@ -56,7 +56,7 @@ template<typename T_SPEED> class NeoArmMethodBase
56
56
{
57
57
uint32_t delta = micros () - _endTime;
58
58
59
- return (delta >= 50L );
59
+ return (delta >= T_SPEED::ResetTimeUs );
60
60
}
61
61
62
62
void Initialize ()
@@ -109,12 +109,22 @@ template<typename T_SPEED> class NeoArmMethodBase
109
109
110
110
#if defined(__MK20DX128__) || defined(__MK20DX256__) // Teensy 3.0 & 3.1
111
111
112
+ class NeoArmMk20dxSpeedPropsWs2813
113
+ {
114
+ public:
115
+ static const uint32_t CyclesT0h = (F_CPU / 4000000 );
116
+ static const uint32_t CyclesT1h = (F_CPU / 1250000 );
117
+ static const uint32_t Cycles = (F_CPU / 800000 );
118
+ static const uint32_t ResetTimeUs = 250 ;
119
+ };
120
+
112
121
class NeoArmMk20dxSpeedProps800Kbps
113
122
{
114
123
public:
115
124
static const uint32_t CyclesT0h = (F_CPU / 4000000 );
116
125
static const uint32_t CyclesT1h = (F_CPU / 1250000 );
117
126
static const uint32_t Cycles = (F_CPU / 800000 );
127
+ static const uint32_t ResetTimeUs = 50 ;
118
128
};
119
129
120
130
class NeoArmMk20dxSpeedProps400Kbps
@@ -123,11 +133,14 @@ class NeoArmMk20dxSpeedProps400Kbps
123
133
static const uint32_t CyclesT0h = (F_CPU / 2000000 );
124
134
static const uint32_t CyclesT1h = (F_CPU / 833333 );
125
135
static const uint32_t Cycles = (F_CPU / 400000 );
136
+ static const uint32_t ResetTimeUs = 50 ;
126
137
};
127
138
128
139
template <typename T_SPEEDPROPS> class NeoArmMk20dxSpeedBase
129
140
{
130
141
public:
142
+ static const uint32_t ResetTimeUs = T_SPEEDPROPS::ResetTimeUs;
143
+
131
144
static void send_pixels (uint8_t * pixels, size_t sizePixels, uint8_t pin)
132
145
{
133
146
uint8_t * p = pixels;
@@ -167,6 +180,7 @@ template<typename T_SPEEDPROPS> class NeoArmMk20dxSpeedBase
167
180
}
168
181
};
169
182
183
+ typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedPropsWs2813>> NeoArmWs2813Method;
170
184
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps800Kbps>> NeoArm800KbpsMethod;
171
185
typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps400Kbps>> NeoArm400KbpsMethod;
172
186
@@ -176,7 +190,7 @@ typedef NeoArmMethodBase<NeoArmMk20dxSpeedBase<NeoArmMk20dxSpeedProps400Kbps>> N
176
190
177
191
178
192
179
- class NeoArmMk26z64Speed800Kbps
193
+ class NeoArmMk26z64Speed800KbpsBase
180
194
{
181
195
public:
182
196
static void send_pixels (uint8_t * pixels, size_t sizePixels, uint8_t pin)
@@ -266,6 +280,19 @@ class NeoArmMk26z64Speed800Kbps
266
280
}
267
281
};
268
282
283
+ class NeoArmMk26z64SpeedWs2813 : public NeoArmMk26z64Speed800KbpsBase
284
+ {
285
+ public:
286
+ const static uint32_t ResetTimeUs = 250 ;
287
+ };
288
+
289
+ class NeoArmMk26z64Speed800Kbps : public NeoArmMk26z64Speed800KbpsBase
290
+ {
291
+ public:
292
+ const static uint32_t ResetTimeUs = 50 ;
293
+ }
294
+
295
+ typedef NeoArmMethodBase<NeoArmMk26z64SpeedWs2813> NeoArmWs2813Method;
269
296
typedef NeoArmMethodBase<NeoArmMk26z64Speed800Kbps> NeoArm800KbpsMethod;
270
297
271
298
#else
@@ -275,7 +302,7 @@ typedef NeoArmMethodBase<NeoArmMk26z64Speed800Kbps> NeoArm800KbpsMethod;
275
302
#elif defined(__SAMD21G18A__) // Arduino Zero
276
303
277
304
278
- class NeoArmSamd21g18aSpeedProps800Kbps
305
+ class NeoArmSamd21g18aSpeedProps800KbpsBase
279
306
{
280
307
public:
281
308
static void BitPreWait ()
@@ -300,6 +327,19 @@ class NeoArmSamd21g18aSpeedProps800Kbps
300
327
}
301
328
};
302
329
330
+ class NeoArmSamd21g18aSpeedPropsWs2813 : public NeoArmSamd21g18aSpeedProps800KbpsBase
331
+ {
332
+ public:
333
+ static const uint32_t ResetTimeUs = 250 ;
334
+ };
335
+
336
+ class NeoArmSamd21g18aSpeedProps800Kbps : public NeoArmSamd21g18aSpeedProps800KbpsBase
337
+ {
338
+ public:
339
+ static const uint32_t ResetTimeUs = 50 ;
340
+ };
341
+
342
+
303
343
class NeoArmSamd21g18aSpeedProps400Kbps
304
344
{
305
345
public:
@@ -325,11 +365,14 @@ class NeoArmSamd21g18aSpeedProps400Kbps
325
365
{
326
366
asm (" nop; nop; nop; nop; nop; nop; nop;" );
327
367
}
368
+ static const uint32_t ResetTimeUs = 50 ;
328
369
};
329
370
330
371
template <typename T_SPEEDPROPS> class NeoArmSamd21g18aSpeedBase
331
372
{
332
373
public:
374
+ static const uint32_t ResetTimeUs = T_SPEEDPROPS::ResetTimeUs;
375
+
333
376
static void send_pixels (uint8_t * pixels, size_t sizePixels, uint8_t pin)
334
377
{
335
378
// Tried this with a timer/counter, couldn't quite get adequate
@@ -376,15 +419,15 @@ template<typename T_SPEEDPROPS> class NeoArmSamd21g18aSpeedBase
376
419
}
377
420
};
378
421
422
+ typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedPropsWs2813>> NeoArmWs2813Method;
379
423
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps800Kbps>> NeoArm800KbpsMethod;
380
424
typedef NeoArmMethodBase<NeoArmSamd21g18aSpeedBase<NeoArmSamd21g18aSpeedProps400Kbps>> NeoArm400KbpsMethod;
381
425
382
426
#elif defined (ARDUINO_STM32_FEATHER) // FEATHER WICED (120MHz)
383
427
384
-
385
-
386
- class NeoArmStm32SpeedProps800Kbps
428
+ class NeoArmStm32SpeedProps800KbpsBase
387
429
{
430
+ public:
388
431
static void BitT1hWait ()
389
432
{
390
433
asm (" nop; nop; nop; nop; nop; nop; nop; nop;"
@@ -432,9 +475,20 @@ class NeoArmStm32SpeedProps800Kbps
432
475
" nop; nop; nop; nop; nop; nop; nop; nop;"
433
476
" nop; nop; nop; nop;" );
434
477
}
478
+ };
435
479
480
+ class NeoArmStm32SpeedProps800Kbps : public NeoArmStm32SpeedProps800KbpsBase
481
+ {
482
+ public:
483
+ static const uint32_t ResetTimeUs = 50 ;
484
+ };
436
485
486
+ class NeoArmStm32SpeedPropsWs2813 : public NeoArmStm32SpeedProps800KbpsBase
487
+ {
488
+ public:
489
+ static const uint32_t ResetTimeUs = 250 ;
437
490
};
491
+
438
492
/* TODO - not found in Adafruit library
439
493
class NeoArmStm32SpeedProps400Kbps
440
494
{
@@ -455,6 +509,9 @@ static void BitT0lWait()
455
509
456
510
template <typename T_SPEEDPROPS> class NeoArmStm32SpeedBase
457
511
{
512
+ public:
513
+ static const uint32_t ResetTimeUs = T_SPEEDPROPS::ResetTimeUs;
514
+
458
515
static void send_pixels (uint8_t * pixels, size_t sizePixels, uint8_t pin)
459
516
{
460
517
// Tried this with a timer/counter, couldn't quite get adequate
@@ -510,6 +567,7 @@ template<typename T_SPEEDPROPS> class NeoArmStm32SpeedBase
510
567
}
511
568
};
512
569
570
+ typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedPropsWs2813>> NeoArmWs2813Method;
513
571
typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedProps800Kbps>> NeoArm800KbpsMethod;
514
572
515
573
#else // Other ARM architecture -- Presumed Arduino Due
@@ -518,12 +576,22 @@ typedef NeoArmMethodBase<NeoArmStm32SpeedBase<NeoArmStm32SpeedProps800Kbps>> Neo
518
576
#define ARM_OTHER_SCALE VARIANT_MCK / 2UL / 1000000UL
519
577
#define ARM_OTHER_INST (2UL * F_CPU / VARIANT_MCK)
520
578
579
+ class NeoArmOtherSpeedPropsWs2813
580
+ {
581
+ public:
582
+ static const uint32_t CyclesT0h = ((uint32_t )(0.40 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
583
+ static const uint32_t CyclesT1h = ((uint32_t )(0.80 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
584
+ static const uint32_t Cycles = ((uint32_t )(1.25 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
585
+ static const uint32_t ResetTimeUs = 250 ;
586
+ };
587
+
521
588
class NeoArmOtherSpeedProps800Kbps
522
589
{
523
590
public:
524
591
static const uint32_t CyclesT0h = ((uint32_t )(0.40 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
525
592
static const uint32_t CyclesT1h = ((uint32_t )(0.80 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
526
593
static const uint32_t Cycles = ((uint32_t )(1.25 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
594
+ static const uint32_t ResetTimeUs = 50 ;
527
595
};
528
596
529
597
class NeoArmOtherSpeedProps400Kbps
@@ -532,11 +600,14 @@ class NeoArmOtherSpeedProps400Kbps
532
600
static const uint32_t CyclesT0h = ((uint32_t )(0.50 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
533
601
static const uint32_t CyclesT1h = ((uint32_t )(1.20 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
534
602
static const uint32_t Cycles = ((uint32_t )(2.50 * ARM_OTHER_SCALE + 0.5 ) - (5 * ARM_OTHER_INST));
603
+ static const uint32_t ResetTimeUs = 50 ;
535
604
};
536
605
537
606
template <typename T_SPEEDPROPS> class NeoArmOtherSpeedBase
538
607
{
539
608
public:
609
+ static const uint32_t ResetTimeUs = T_SPEEDPROPS::ResetTimeUs;
610
+
540
611
static void send_pixels (uint8_t * pixels, size_t sizePixels, uint8_t pin)
541
612
{
542
613
uint32_t pinMask;
@@ -608,13 +679,15 @@ template<typename T_SPEEDPROPS> class NeoArmOtherSpeedBase
608
679
}
609
680
};
610
681
682
+ typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedPropsWs2813>> NeoArmWs2813Method;
611
683
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps800Kbps>> NeoArm800KbpsMethod;
612
684
typedef NeoArmMethodBase<NeoArmOtherSpeedBase<NeoArmOtherSpeedProps400Kbps>> NeoArm400KbpsMethod;
613
685
614
686
#endif
615
687
616
688
617
689
// Arm doesn't have alternatives methods yet, so only one to make the default
690
+ typedef NeoArmWs2813Method NeoWs2813Method;
618
691
typedef NeoArm800KbpsMethod Neo800KbpsMethod;
619
692
#ifdef NeoArm400KbpsMethod // this is needed due to missing 400Kbps for some platforms
620
693
typedef NeoArm400KbpsMethod Neo400KbpsMethod;
0 commit comments