Demo for USBJoystick updated for 32 buttons.
Dependencies: USBDevice USBJoystick_SIM mbed USBJoystick_2
Fork of USBJoystick_HelloWorld2 by
config.h
- Committer:
- Cirrus01
- Date:
- 2018-09-29
- Revision:
- 4:dc3556a31262
- Parent:
- 1:b106cf2e99ba
File content as of revision 4:dc3556a31262:
#define TARGET_STM32F4XX
#define NUM_OF_BUTTONS 32
#define NUM_OF_HAT_BUTTONS 4
#define SYSTEM_CLOCK_HZ 96000000 // 96MHz
// Joystick button input pin assignments.
//
// You can wire up to 32 GPIO ports to buttons (equipped with
// momentary switches). Connect each switch between the desired
// GPIO port and ground (J9 pin 12 or 14). When the button is pressed,
// we'll tell the host PC that the corresponding joystick button is
// pressed. We debounce the keystrokes in software, so you can simply
// wire directly to pushbuttons with no additional external hardware.
//
// Note that we assign 24 buttons by default, even though the USB
// joystick interface can handle up to 32 buttons. VP itself only
// allows mapping of up to 24 buttons in the preferences dialog
// (although it can recognize 32 buttons internally). If you want
// more buttons, you can reassign pins that are assigned by default
// as LedWiz outputs. To reassign a pin, find the pin you wish to
// reassign in the LedWizPortMap array below, and change the pin name
// there to NC (for Not Connected). You can then change one of the
// "NC" entries below to the reallocated pin name. The limit is 32
// buttons total.
//
// (If you're using TLC5940 chips to control outputs, many of the
// GPIO pins that are mapped to LedWiz outputs in the default
// mapping can be reassigned as keys, since the TLC5940 outputs
// take over for the GPIO pins. The exceptions are the pins that
// are reassigned to control the TLC5940 chips.)
//
// Note: PTD1 (pin J2-12) should NOT be assigned as a button input,
// as this pin is physically connected on the KL25Z to the on-board
// indicator LED's blue segment.
PinName buttonMap[] = {
PB_3, // button 1
PB_5, // button 2
PB_10, // button 3
PC_7, // button 4
PB_6, // button 5
PA_5, // button 6
PB_4, // button 7
PB_13, // button 8
PB_14, // button 9
PB_15, // button 10
PB_1, // button 11
PB_2, // button 12
PC_5, // button 13
PC_6, // button 14
PC_8, // button 15
PC_4, // button 16
NC, // button 17
NC, // button 18
NC, // button 19
NC, // button 20
NC, // button 21
NC, // button 22
NC, // button 23
NC, // button 24
NC, // button 25
NC, // button 26
NC, // button 27
NC, // button 28
NC, // button 29
NC, // button 30
NC, // button 31
NC // button 32
};
PinName hatMap[] = {
PC_2, // button 1
PC_3, // button 2
PC_10, // button 3
PC_12, // button 4
NC, // button 5
NC, // button 6
NC, // button 7
NC // button 8
};
// STANDARD ID SETTINGS. These provide full, transparent LedWiz compatibility.
const uint16_t USB_VENDOR_ID = 0x1209;
const uint16_t USB_PRODUCT_ID = 0xACDE;
const uint16_t USB_PRODUCT_VER = 0x0002;
