-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
91 lines (80 loc) · 2.22 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* Copyright 2014-2015 Drew Thoreson
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU 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 General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef CONFIG_H_
#define CONFIG_H_
#include <linux/input.h>
#include "snes.h"
/*
* Controller definitions. You may add as many controllers to this list as
* you like and usnes will automagically poll them.
*
* It is a good idea to share CLOCK/LATCH pins between controllers, to reduce
* latency differences and the amount of polling that has to be done. But if
* you share CLOCK/LATCH pins, they must be shared between ALL controllers,
* otherwise usnes will fall back to polling them individually.
*/
static struct controller {
unsigned long keymap[SNES_NR_BUTTONS];
unsigned char clock;
unsigned char latch;
unsigned char data;
} controller[] =
{{
.keymap = {
[SNES_R] = KEY_R,
[SNES_L] = KEY_L,
[SNES_A] = KEY_A,
[SNES_B] = KEY_B,
[SNES_X] = KEY_X,
[SNES_Y] = KEY_Y,
[SNES_UP] = KEY_UP,
[SNES_DOWN] = KEY_DOWN,
[SNES_LEFT] = KEY_LEFT,
[SNES_RIGHT] = KEY_RIGHT,
[SNES_START] = KEY_ENTER,
[SNES_SELECT] = KEY_ESC
},
.clock = 21,
.latch = 20,
.data = 16
},
/* e.g. second controller with shared CLOCK and LATCH pins: */
/*{
.keymap = {
[SNES_R] = KEY_Q,
[SNES_L] = KEY_W,
[SNES_A] = KEY_E,
[SNES_B] = KEY_T,
[SNES_X] = KEY_U,
[SNES_Y] = KEY_I,
[SNES_UP] = KEY_O,
[SNES_DOWN] = KEY_P,
[SNES_LEFT] = KEY_S,
[SNES_RIGHT] = KEY_D,
[SNES_START] = KEY_F,
[SNES_SELECT] = KEY_G
},
.clock = 21,
.latch = 20,
.data = 12
}*/
};
#define NR_CONTROLLERS (sizeof(controller)/sizeof(*controller))
/*
* The delay, in milliseconds, that usnes will wait after polling.
*/
#define POLL_MS 60
#endif