Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary dependence on micros() for neopixel libs #333

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion megaavr/libraries/tinyNeoPixel/tinyNeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,11 @@ void tinyNeoPixel::show(void) {


interrupts();
#ifndef DISABLEMILLIS
#if !defined(DISABLEMILLIS) && !defined(MILLIS_USE_TIMERRTC) && !defined(MILLIS_USE_TIMERRTC_XTAL && !defined(MILLIS_USE_TIMERRTC_XOSC)
endTime = micros();
// Save EOD time for latch on next call
#else
#warning "micros is not available based on timer settings. You must ensure at least 50us between calls to show() or the pixels will never latch"
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion megaavr/libraries/tinyNeoPixel/tinyNeoPixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class tinyNeoPixel {
*/
static uint32_t gamma32(uint32_t x);

#ifndef DISABLEMILLIS
#if !defined(DISABLEMILLIS) && !defined(MILLIS_USE_TIMERRTC) && !defined(MILLIS_USE_TIMERRTC_XTAL) && !defined(MILLIS_USE_TIMERRTC_XOSC)
inline bool canShow(void) { return (micros() - endTime) >= 50L; }
#else
inline bool canShow(void) {return 1;} //we don't have micros here;
Expand Down
10 changes: 6 additions & 4 deletions megaavr/libraries/tinyNeoPixel_Static/tinyNeoPixel_Static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,15 +809,17 @@ void tinyNeoPixel::show(void) {
[lo] "r" (lo));

#else
#error "CPU SPEED NOT SUPPORTED"
#error "CPU SPEED NOT SUPPORTED"
#endif

// END AVR ----------------------------------------------------------------


interrupts();
#ifndef DISABLEMILLIS
endTime = micros(); // Save EOD time for latch on next call
#if !defined(DISABLEMILLIS) && !defined(MILLIS_USE_TIMERRTC) && !defined(MILLIS_USE_TIMERRTC_XTAL) && !defined(MILLIS_USE_TIMERRTC_XOSC))
endTime = micros();
// Save EOD time for latch on next call
#else
#warning "micros is not available based on timer settings. You must ensure at least 50us between calls to show() or the pixels will never latch"
#endif
}

Expand Down
10 changes: 3 additions & 7 deletions megaavr/libraries/tinyNeoPixel_Static/tinyNeoPixel_Static.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,10 @@ class tinyNeoPixel {
*/
static uint32_t gamma32(uint32_t x);

#ifndef DISABLEMILLIS
inline bool canShow(void) {
return (micros() - endTime) >= 50L;
}
#if !defined(DISABLEMILLIS) && !defined(MILLIS_USE_TIMERRTC) && !defined(MILLIS_USE_TIMERRTC_XTAL) && !defined(MILLIS_USE_TIMERRTC_XOSC)
inline bool canShow(void) { return (micros() - endTime) >= 50L; }
#else
inline bool canShow(void) {
return 1; //we don't have micros here;
}
inline bool canShow(void) {return 1;} //we don't have micros here;
#endif


Expand Down