File tree Expand file tree Collapse file tree 10 files changed +44
-2
lines changed
circuitplayground_express Expand file tree Collapse file tree 10 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -44,3 +44,6 @@ void board_init(void)
4444bool board_requests_safe_mode (void ) {
4545 return false;
4646}
47+
48+ void reset_board (void ) {
49+ }
Original file line number Diff line number Diff line change @@ -39,4 +39,7 @@ void board_init(void);
3939// way.
4040bool board_requests_safe_mode (void );
4141
42+ // Reset the state of off MCU components such as neopixels.
43+ void reset_board (void );
44+
4245#endif // __MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H__
Original file line number Diff line number Diff line change 2424 * THE SOFTWARE.
2525 */
2626
27+ #include <string.h>
28+
2729#include "boards/board.h"
2830#include "asf/sam0/drivers/port/port.h"
2931#include "common-hal/microcontroller/Pin.h"
32+ #include "shared-bindings/digitalio/DigitalInOut.h"
33+ #include "shared-bindings/neopixel_write/__init__.h"
34+ #include "samd21_pins.h"
3035
3136void board_init (void )
3237{
@@ -47,3 +52,14 @@ bool board_requests_safe_mode(void) {
4752 reset_pin (PIN_PA28 );
4853 return safe_mode ;
4954}
55+
56+ void reset_board (void ) {
57+ uint8_t empty [30 ];
58+ memset (empty , 0 , 30 );
59+ digitalio_digitalinout_obj_t neopixel_pin ;
60+ common_hal_digitalio_digitalinout_construct (& neopixel_pin , & pin_PB23 );
61+ common_hal_digitalio_digitalinout_switch_to_output (& neopixel_pin , false,
62+ DRIVE_MODE_PUSH_PULL );
63+ common_hal_neopixel_write (& neopixel_pin , empty , 30 );
64+ common_hal_digitalio_digitalinout_deinit (& neopixel_pin );
65+ }
Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ void board_init(void)
3333bool board_requests_safe_mode (void ) {
3434 return false;
3535}
36+
37+ void reset_board (void ) {
38+ }
Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ void board_init(void)
3333bool board_requests_safe_mode (void ) {
3434 return false;
3535}
36+
37+ void reset_board (void ) {
38+ }
Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ void board_init(void)
3333bool board_requests_safe_mode (void ) {
3434 return false;
3535}
36+
37+ void reset_board (void ) {
38+ }
Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ void board_init(void)
3333bool board_requests_safe_mode (void ) {
3434 return false;
3535}
36+
37+ void reset_board (void ) {
38+ }
Original file line number Diff line number Diff line change @@ -44,3 +44,6 @@ void board_init(void)
4444bool board_requests_safe_mode (void ) {
4545 return false;
4646}
47+
48+ void reset_board (void ) {
49+ }
Original file line number Diff line number Diff line change 2626
2727#include "boards/board.h"
2828
29- void board_init (void )
30- {
29+ void board_init (void ) {
3130}
3231
3332bool board_requests_safe_mode (void ) {
3433 return false;
3534}
35+
36+ void reset_board (void ) {
37+ }
Original file line number Diff line number Diff line change @@ -594,6 +594,7 @@ int main(void) {
594594
595595 // Reset everything and prep MicroPython to run boot.py.
596596 reset_samd21 ();
597+ reset_board ();
597598 reset_mp ();
598599
599600 // Turn on autoreload by default but before boot.py in case it wants to change it.
@@ -656,6 +657,7 @@ int main(void) {
656657 autoreload_enable ();
657658 }
658659 reset_samd21 ();
660+ reset_board ();
659661 reset_mp ();
660662 }
661663 if (exit_code == PYEXEC_FORCED_EXIT ) {
@@ -665,6 +667,7 @@ int main(void) {
665667 first_run = false;
666668 skip_repl = start_mp (safe_mode );
667669 reset_samd21 ();
670+ reset_board ();
668671 reset_mp ();
669672 } else if (exit_code != 0 ) {
670673 break ;
You can’t perform that action at this time.
0 commit comments