Skip to content

Commit

Permalink
Merge pull request #4160 from gamblor21/rp2040_neopixel_pin_fix
Browse files Browse the repository at this point in the history
RP2040 Set the neopixel pin as output after PIO use
  • Loading branch information
dhalbert authored Feb 8, 2021
2 parents 3a68ac8 + 386b49c commit 3c99b09
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ports/raspberrypi/common-hal/neopixel_write/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "bindings/rp2pio/StateMachine.h"
#include "common-hal/rp2pio/StateMachine.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/digitalio/DigitalInOut.h"

#include "supervisor/port.h"

Expand Down Expand Up @@ -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.
rp2pio_statemachine_deinit(&state_machine, true);

// Reset the pin and release it from the PIO
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.
next_start_raw_ticks = port_get_raw_ticks(NULL) + 1;
}

0 comments on commit 3c99b09

Please sign in to comment.