A few fixes for nRF52840 feather QSPI and neopixel
This commit is contained in:
parent
e77c06e8c3
commit
15eeac5d4b
@ -35,12 +35,21 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
|
||||
|
||||
#ifdef QSPI_FLASH_FILESYSTEM
|
||||
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
|
||||
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
|
||||
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
|
||||
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
|
||||
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
|
||||
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
|
||||
#endif
|
||||
|
||||
#ifdef SPI_FLASH_FILESYSTEM
|
||||
#define SPI_FLASH_MOSI_PIN &pin_P0_17
|
||||
#define SPI_FLASH_MISO_PIN &pin_P0_22
|
||||
#define SPI_FLASH_SCK_PIN &pin_P0_19
|
||||
#define SPI_FLASH_CS_PIN &pin_P0_20
|
||||
#endif
|
||||
|
||||
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
||||
|
||||
@ -51,8 +60,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define EXTERNAL_FLASH_QSPI_DUAL (1)
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
|
||||
|
@ -20,6 +20,6 @@ endif
|
||||
|
||||
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q16C"
|
||||
|
@ -48,7 +48,6 @@ STATIC uint32_t claimed_pins[GPIO_COUNT];
|
||||
STATIC uint32_t never_reset_pins[GPIO_COUNT];
|
||||
|
||||
void reset_all_pins(void) {
|
||||
return;
|
||||
for (size_t i = 0; i < GPIO_COUNT; i++) {
|
||||
claimed_pins[i] = never_reset_pins[i];
|
||||
}
|
||||
@ -77,7 +76,6 @@ void reset_all_pins(void) {
|
||||
|
||||
// Mark pin as free and return it to a quiescent state.
|
||||
void reset_pin_number(uint8_t pin_number) {
|
||||
return;
|
||||
if (pin_number == NO_PIN) {
|
||||
return;
|
||||
}
|
||||
|
@ -108,12 +108,21 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
|
||||
// using DWT
|
||||
uint32_t pattern_size = numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t);
|
||||
uint16_t* pixels_pattern = NULL;
|
||||
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.
|
||||
uint32_t one_pixel[8 * sizeof(uint16_t) + 1];
|
||||
|
||||
NRF_PWM_Type* pwm = find_free_pwm();
|
||||
|
||||
// only malloc if there is PWM device available
|
||||
if ( pwm != NULL ) {
|
||||
pixels_pattern = (uint16_t *) m_malloc(pattern_size, false);
|
||||
if (numBytes == 4) {
|
||||
pixels_pattern = (uint16_t *) one_pixel;
|
||||
} else {
|
||||
pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false);
|
||||
pattern_on_heap = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use the identified device to choose the implementation
|
||||
@ -193,7 +202,10 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
|
||||
nrf_pwm_disable(pwm);
|
||||
nrf_pwm_pins_set(pwm, (uint32_t[]) {0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
|
||||
|
||||
m_free(pixels_pattern);
|
||||
if (pattern_on_heap) {
|
||||
m_free(pixels_pattern);
|
||||
}
|
||||
|
||||
} // End of DMA implementation
|
||||
// ---------------------------------------------------------------------
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user