Cleanup PIOs and State Machines on soft reset
This commit is contained in:
parent
eeb89a97b4
commit
f8eb5bc275
@ -29,6 +29,18 @@
|
||||
#include "py/runtime.h"
|
||||
#include "py/mphal.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "src/rp2_common/hardware_pio/include/hardware/pio.h"
|
||||
#include "shared-module/board/__init__.h"
|
||||
|
||||
// Pins aren't actually defined here. They are in the board specific directory
|
||||
// such as boards/arduino_zero/pins.c.
|
||||
|
||||
// routine to reset both pios
|
||||
void board_reset_pio() {
|
||||
for ( uint8_t sm = 0; sm < 4; sm++) {
|
||||
pio_sm_init (pio0, sm, 0, NULL);
|
||||
pio_sm_init (pio1, sm, 0, NULL);
|
||||
}
|
||||
pio_clear_instruction_memory(pio0);
|
||||
pio_clear_instruction_memory(pio1);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "supervisor/shared/translate.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-module/board/__init__.h"
|
||||
|
||||
#if CIRCUITPY_BUSIO
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
@ -179,4 +180,7 @@ void reset_board_busses(void) {
|
||||
#if BOARD_UART
|
||||
MP_STATE_VM(shared_uart_bus) = NULL;
|
||||
#endif
|
||||
#if CIRCUITPY_RP2PIO
|
||||
board_reset_pio();
|
||||
#endif
|
||||
}
|
||||
|
@ -28,5 +28,6 @@
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BOARD__INIT__H
|
||||
|
||||
void reset_board_busses(void);
|
||||
void board_reset_pio(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BOARD__INIT__H
|
||||
|
Loading…
x
Reference in New Issue
Block a user