File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
ports/nrf/common-hal/neopixel_write Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,17 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
130
130
if (pattern_size <= sizeof (one_pixel )) {
131
131
pixels_pattern = (uint16_t * ) one_pixel ;
132
132
} else {
133
- pixels_pattern = (uint16_t * ) m_malloc_maybe (pattern_size , false);
133
+ uint8_t sd_en = 0 ;
134
+ (void ) sd_softdevice_is_enabled (& sd_en );
135
+ if (sd_en ) {
136
+ // If the soft device is enabled then we must use PWM to
137
+ // transmit. This takes a bunch of memory to do so raise an
138
+ // exception if we can't.
139
+ pixels_pattern = (uint16_t * ) m_malloc (pattern_size , false);
140
+ } else {
141
+ pixels_pattern = (uint16_t * ) m_malloc_maybe (pattern_size , false);
142
+ }
143
+
134
144
pattern_on_heap = true;
135
145
}
136
146
}
You can’t perform that action at this time.
0 commit comments