diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-11-13 15:03:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-13 15:03:25 -0500 |
| commit | f190bb2c269b06ab2ce8ee8aa220682ab4f2fc2f (patch) | |
| tree | 4230b29aa8216ae4a9d30b5f12818ac1d1da2d99 | |
| parent | c63376c5fa41c35681e8ed28d997383f6e082841 (diff) | |
| parent | 4ae4cc11e081926eb361cd9942188159efa97f9a (diff) | |
Merge pull request #1332 from tannewt/clear_trellis_neopixels
Clear Trellis NeoPixels on board reset.
| -rw-r--r-- | ports/atmel-samd/boards/trellis_m4_express/board.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ports/atmel-samd/boards/trellis_m4_express/board.c b/ports/atmel-samd/boards/trellis_m4_express/board.c index 0f60736a2..a9b5f8163 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/board.c +++ b/ports/atmel-samd/boards/trellis_m4_express/board.c @@ -24,9 +24,14 @@ * THE SOFTWARE. */ +#include <string.h> + #include "boards/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" +#include "py/mpconfig.h" + +#include "common-hal/digitalio/DigitalInOut.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/neopixel_write/__init__.h" void board_init(void) { } @@ -36,4 +41,11 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { + uint8_t zeroes[96]; + memset(zeroes, 0, 96); + digitalio_digitalinout_obj_t neopixel; + common_hal_digitalio_digitalinout_construct(&neopixel, &pin_PA27); + common_hal_digitalio_digitalinout_switch_to_output(&neopixel, false, DRIVE_MODE_PUSH_PULL); + common_hal_neopixel_write(&neopixel, zeroes, 96); + common_hal_digitalio_digitalinout_deinit(&neopixel); } |
