[FL-1161] Input bug fixes and cleanup (#416)
* Input: start/stop timers only from the input thread, adjust long/short/repeat timings, improve timer routines reliability.
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "input.h"
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <timers.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <furi.h>
|
||||
#include <cli/cli.h>
|
||||
#include <m-string.h>
|
||||
|
||||
#define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2)
|
||||
#define INPUT_LONG_PRESS_TICKS 2048
|
||||
#define INPUT_REPEATE_PRESS_TICKS 256
|
||||
#define INPUT_PRESS_TICKS 200
|
||||
#define INPUT_LONG_PRESS_COUNTS 4
|
||||
#define INPUT_THREAD_FLAG_ISR 0x00000001
|
||||
|
||||
/* Input pin state */
|
||||
@@ -18,9 +20,9 @@ typedef struct {
|
||||
const InputPin* pin;
|
||||
// State
|
||||
volatile bool state;
|
||||
volatile bool repeat_event;
|
||||
volatile uint8_t debounce;
|
||||
volatile osTimerId_t press_timer;
|
||||
volatile uint8_t press_counter;
|
||||
} InputPinState;
|
||||
|
||||
/* Input state */
|
||||
|
Reference in New Issue
Block a user