unleashed-firmware/applications/input/input_i.h
gornekich 78ff0c9fca
[FL-938] Keyboard widget changes (#398)
* inputs: add repeat event
* byte_input: change draw
* text_input, byte_input: process repeat event
2021-04-01 20:10:12 +03:00

38 lines
820 B
C

#pragma once
#include "input.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <furi.h>
#include <cli/cli.h>
#define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2)
#define INPUT_LONG_PRESS_TICKS 2048
#define INPUT_REPEATE_PRESS_TICKS 256
#define INPUT_THREAD_FLAG_ISR 0x00000001
/* Input pin state */
typedef struct {
const InputPin* pin;
// State
volatile bool state;
volatile bool repeat_event;
volatile uint8_t debounce;
volatile osTimerId_t press_timer;
} InputPinState;
/* Input state */
typedef struct {
osThreadId_t thread;
PubSub event_pubsub;
InputPinState* pin_states;
Cli* cli;
} Input;
/* Input press timer callback */
void input_press_timer_callback(void* arg);
/* Input interrupt handler */
void input_isr(void* _pin, void* _ctx);