Skip to content

Commit a3a690d

Browse files
authored
Add pragma to ensure neopixel_write is always -Os
1 parent ed9db80 commit a3a690d

File tree

1 file changed

+7
-0
lines changed
  • ports/atmel-samd/common-hal/neopixel_write

1 file changed

+7
-0
lines changed

ports/atmel-samd/common-hal/neopixel_write/__init__.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
}
4949
#endif
5050

51+
// Ensure this code is compiled with -Os. Any other optimization level may change the timing of it
52+
// and break neopixels.
53+
#pragma GCC push_options
54+
#pragma GCC optimize ("Os")
55+
5156
uint64_t next_start_tick_ms = 0;
5257
uint32_t next_start_tick_us = 1000;
5358

@@ -183,3 +188,5 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
183188
mp_hal_enable_all_interrupts();
184189

185190
}
191+
192+
#pragma GCC pop_options

0 commit comments

Comments
 (0)