Merge pull request #4160 from gamblor21/rp2040_neopixel_pin_fix

RP2040 Set the neopixel pin as output after PIO use
This commit is contained in:
Dan Halbert 2021-02-08 17:57:30 -05:00 committed by GitHub
commit 3c99b09993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "bindings/rp2pio/StateMachine.h" #include "bindings/rp2pio/StateMachine.h"
#include "common-hal/rp2pio/StateMachine.h" #include "common-hal/rp2pio/StateMachine.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "supervisor/port.h" #include "supervisor/port.h"
@ -89,7 +90,11 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* digitalinout,
// Use a private deinit of the state machine that doesn't reset the pin. // Use a private deinit of the state machine that doesn't reset the pin.
rp2pio_statemachine_deinit(&state_machine, true); rp2pio_statemachine_deinit(&state_machine, true);
// Reset the pin and release it from the PIO
gpio_init(digitalinout->pin->number); gpio_init(digitalinout->pin->number);
common_hal_digitalio_digitalinout_switch_to_output((digitalio_digitalinout_obj_t*)digitalinout, false, DRIVE_MODE_PUSH_PULL);
// Update the next start. // Update the next start.
next_start_raw_ticks = port_get_raw_ticks(NULL) + 1; next_start_raw_ticks = port_get_raw_ticks(NULL) + 1;
} }