Files
lucky-cat/components/control_plane/internal/control_plane_events.h
T

58 lines
1.5 KiB
C

/*
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "driver/gpio.h"
typedef enum {
CONTROL_PLANE_EVENT_FAMILY_KEY = 0,
CONTROL_PLANE_EVENT_FAMILY_WIFI,
CONTROL_PLANE_EVENT_FAMILY_MULTIMODAL,
CONTROL_PLANE_EVENT_FAMILY_LCD,
CONTROL_PLANE_EVENT_FAMILY_DIRECTION,
CONTROL_PLANE_EVENT_FAMILY_CALIBRATION,
CONTROL_PLANE_EVENT_FAMILY_RUNTIME,
} control_plane_event_family_t;
typedef enum {
CONTROL_PLANE_KEY_ID_PTT = 0,
CONTROL_PLANE_KEY_ID_SW1,
CONTROL_PLANE_KEY_ID_SW2,
CONTROL_PLANE_KEY_ID_RESET,
} control_plane_key_id_t;
typedef enum {
CONTROL_PLANE_KEY_EVENT_PRESSED = 0,
CONTROL_PLANE_KEY_EVENT_RELEASED,
CONTROL_PLANE_KEY_EVENT_SHORT_PRESS,
CONTROL_PLANE_KEY_EVENT_LONG_PRESS_START,
CONTROL_PLANE_KEY_EVENT_LONG_PRESS_RELEASE,
CONTROL_PLANE_KEY_EVENT_DOUBLE_CLICK,
CONTROL_PLANE_KEY_EVENT_REPEAT,
CONTROL_PLANE_KEY_EVENT_CANCELLED,
} control_plane_key_event_type_t;
typedef struct {
control_plane_key_id_t key_id;
control_plane_key_event_type_t type;
gpio_num_t gpio_num;
int level;
int64_t timestamp_ms;
uint32_t press_duration_ms;
uint32_t click_count;
} control_plane_key_event_t;
typedef struct {
control_plane_event_family_t family;
int64_t timestamp_ms;
union {
control_plane_key_event_t key;
} data;
} control_plane_system_event_t;