unleashed-firmware/applications/input/input_i.h
あく 389ff92cc1
Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter
* About: remove ID from IC
* Firmware: remove double define for DIVC/DIVR
* Scripts: check folder names too. Docker: replace syntax check with make lint.
* Reformat Sources and Migrate to new file naming convention
* Docker: symlink clang-format-12 to clang-format
* Add coding style guide
2022-01-05 19:10:18 +03:00

47 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);