parent
dd89ff244d
commit
6e7e703f89
@ -1,4 +1,4 @@
|
||||
#include "common-hal/countio/Counter.h"
|
||||
#include "shared-bindings/countio/Counter.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "py/mpstate.h"
|
||||
@ -48,6 +48,15 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
||||
pwm_set_enabled(self->slice_num, true);
|
||||
}
|
||||
|
||||
|
||||
void reset_countio(void) {
|
||||
for (size_t i = 0; i < NUM_PWM_SLICES; i++) {
|
||||
if (MP_STATE_PORT(counting)[i] != NULL) {
|
||||
common_hal_countio_counter_deinit(MP_STATE_PORT(counting)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool common_hal_countio_counter_deinited(countio_counter_obj_t *self) {
|
||||
return self->pin_a == 0;
|
||||
}
|
||||
|
@ -16,4 +16,6 @@ typedef struct {
|
||||
|
||||
void counter_interrupt_handler();
|
||||
|
||||
void reset_countio(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_RASPBERRRYPI_COMMON_HAL_COUNTIO_COUNTER_H
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/countio/Counter.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
#include "shared-bindings/rtc/__init__.h"
|
||||
#include "shared-bindings/pwmio/PWMOut.h"
|
||||
@ -135,6 +136,10 @@ void reset_port(void) {
|
||||
reset_uart();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_COUNTIO
|
||||
reset_countio();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_PWMIO
|
||||
pwmout_reset();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user