mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-15 17:18:01 +00:00
e9e76e144c
* RPC: Update protobuf sources * RPC: Implement storage_stat_request * RPC: Test storage_stat_request * FuriRecord: fix use after free in destroy method. * Furi: refactor PubSub and it's usage. Fix allocation in RPC. * FuriCore: fix memory leak in pubsub * FuriCore: update unsubscribe method signature in pubsub, make subscription structure lighter. * FuriCore: remove dead code Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
46 lines
972 B
C
46 lines
972 B
C
/**
|
|
* @file input_i.h
|
|
* Input: internal API
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "input.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <furi.h>
|
|
#include <cli/cli.h>
|
|
#include <m-string.h>
|
|
#include <furi-hal-gpio.h>
|
|
|
|
#define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2)
|
|
#define INPUT_PRESS_TICKS 150
|
|
#define INPUT_LONG_PRESS_COUNTS 2
|
|
#define INPUT_THREAD_FLAG_ISR 0x00000001
|
|
|
|
/** Input pin state */
|
|
typedef struct {
|
|
const InputPin* pin;
|
|
// State
|
|
volatile bool state;
|
|
volatile uint8_t debounce;
|
|
volatile osTimerId_t press_timer;
|
|
volatile uint8_t press_counter;
|
|
volatile uint32_t counter;
|
|
} InputPinState;
|
|
|
|
/** Input state */
|
|
typedef struct {
|
|
osThreadId_t thread;
|
|
FuriPubSub* event_pubsub;
|
|
InputPinState* pin_states;
|
|
Cli* cli;
|
|
volatile uint32_t counter;
|
|
} Input;
|
|
|
|
/** Input press timer callback */
|
|
void input_press_timer_callback(void* arg);
|
|
|
|
/** Input interrupt handler */
|
|
void input_isr(void* _ctx);
|