add reset of heap to board reset for nrf port

This commit is contained in:
Roy Hooper 2020-01-08 15:15:27 -05:00
parent 34c9e00f08
commit 4e040b0152
2 changed files with 12 additions and 4 deletions

View File

@ -97,6 +97,16 @@ static NRF_PWM_Type* find_free_pwm (void) {
return NULL;
}
static uint16_t* pixels_pattern_heap = NULL;
static size_t pixels_pattern_heap_size = 0;
static bool pattern_on_heap = false;
// Called during reset_port() to free the pattern buffer
void neopixel_write_reset(void) {
pixels_pattern_heap = NULL;
pixels_pattern_heap_size = 0;
pattern_on_heap = false;
}
uint64_t next_start_tick_ms = 0;
uint32_t next_start_tick_us = 1000;
@ -113,12 +123,8 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
// using DWT
#define PATTERN_SIZE(numBytes) (numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t))
uint32_t pattern_size = PATTERN_SIZE(numBytes);
uint16_t* pixels_pattern = NULL;
static uint16_t* pixels_pattern_heap = NULL;
static size_t pixels_pattern_heap_size = 0;
bool pattern_on_heap = false;
// Use the stack to store 1 pixels worth of PWM data for the status led. uint32_t to ensure alignment.
// Make it at least as big as PATTERN_SIZE(3), for one pixel of RGB data.

View File

@ -47,6 +47,7 @@
#include "common-hal/pulseio/PulseOut.h"
#include "common-hal/pulseio/PulseIn.h"
#include "common-hal/rtc/RTC.h"
#include "common-hal/neopixel_write/__init__.h"
#include "tick.h"
#include "shared-bindings/rtc/__init__.h"
@ -106,6 +107,7 @@ void reset_port(void) {
i2c_reset();
spi_reset();
uart_reset();
neopixel_write_reset();
#if CIRCUITPY_AUDIOBUSIO
i2s_reset();