gadget-kspconsole/button.h

72 lines
1.7 KiB
C
Raw Permalink Normal View History

2023-11-27 15:13:55 +01:00
/*
* Copyright (C) 2023 Daniele Lacamera <root@danielinux.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BUTTON_H_INCLUDED
#define BUTTON_H_INCLUDED
void input_setup(void);
int input_get_swl(void);
int input_get_swr(void);
#define N_BUTTONS 13
#define BUTTON_DPADL 0
#define BUTTON_DPADU 1
#define BUTTON_DPADR 2
#define BUTTON_DPADD 3
#define BUTTON_OK 4
#define BUTTON_BACK 5
#define BUTTON_REPEAT 6
#define BUTTON_DEL 7
#define BUTTON_TPREV 8
#define BUTTON_TNEXT 9
#define BUTTON_PLUS 10
#define BUTTON_MINUS 11
#define TOUCHSCREEN 12
#define TS_TOUCH_NONE 0
#define TS_TOUCH_DETECTED 1
#define TS_TOUCH_INPUT 2
int input_detect_touch(void);
struct user_button
{
int pressed;
uint32_t transition_start_timestamp;
};
struct input_status
{
/* State switches */
int sw_play, sw_rec;
/* Trimmers */
uint32_t pot_l, pot_r;
/* Buttons */
struct user_button b[N_BUTTONS];
struct ts_touch_info {
uint32_t X,Y;
} ts;
uint32_t start_touch;
int touching;
};
extern struct input_status Input_status;
#endif