reset touchin on every vm run
This commit is contained in:
parent
048ca2a570
commit
6af48bb24c
@ -31,6 +31,13 @@
|
|||||||
|
|
||||||
bool touch_inited = false;
|
bool touch_inited = false;
|
||||||
|
|
||||||
|
void touchin_reset(void) {
|
||||||
|
if (touch_inited) {
|
||||||
|
touch_pad_deinit();
|
||||||
|
touch_inited = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static uint16_t get_raw_reading(touchio_touchin_obj_t *self) {
|
static uint16_t get_raw_reading(touchio_touchin_obj_t *self) {
|
||||||
uint32_t touch_value;
|
uint32_t touch_value;
|
||||||
touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value);
|
touch_pad_read_raw_data((touch_pad_t)self->pin->touch_channel, &touch_value);
|
||||||
@ -78,7 +85,6 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) {
|
|||||||
if (common_hal_touchio_touchin_deinited(self)) {
|
if (common_hal_touchio_touchin_deinited(self)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
touch_pad_deinit();
|
|
||||||
reset_pin_number(self->pin->touch_channel);
|
reset_pin_number(self->pin->touch_channel);
|
||||||
self->pin = NULL;
|
self->pin = NULL;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "common-hal/busio/UART.h"
|
#include "common-hal/busio/UART.h"
|
||||||
#include "common-hal/pulseio/PulseIn.h"
|
#include "common-hal/pulseio/PulseIn.h"
|
||||||
#include "common-hal/pwmio/PWMOut.h"
|
#include "common-hal/pwmio/PWMOut.h"
|
||||||
|
#include "common-hal/touchio/TouchIn.h"
|
||||||
#include "common-hal/watchdog/WatchDogTimer.h"
|
#include "common-hal/watchdog/WatchDogTimer.h"
|
||||||
#include "common-hal/wifi/__init__.h"
|
#include "common-hal/wifi/__init__.h"
|
||||||
#include "supervisor/memory.h"
|
#include "supervisor/memory.h"
|
||||||
@ -127,6 +128,10 @@ void reset_port(void) {
|
|||||||
rtc_reset();
|
rtc_reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CIRCUITPY_TOUCHIO_USE_NATIVE
|
||||||
|
touchin_reset();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CIRCUITPY_WATCHDOG
|
#if CIRCUITPY_WATCHDOG
|
||||||
watchdog_reset();
|
watchdog_reset();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user