WIP PID

Dependencies:   USBDEVICE USBJoystick mbed

Fork of USBJoystick_HelloWorld2 by Wim Huiskamp

Committer:
Cirrus01
Date:
Sat Jul 07 10:48:38 2018 +0000
Revision:
1:caf8a4134cbf
First

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Cirrus01 1:caf8a4134cbf 1 #define TARGET_STM32F4XX
Cirrus01 1:caf8a4134cbf 2 #define NUM_OF_BUTTONS 32
Cirrus01 1:caf8a4134cbf 3 #define NUM_OF_HAT_BUTTONS 4
Cirrus01 1:caf8a4134cbf 4 #define SYSTEM_CLOCK_HZ 96000000 // 96MHz
Cirrus01 1:caf8a4134cbf 5
Cirrus01 1:caf8a4134cbf 6 // Joystick button input pin assignments.
Cirrus01 1:caf8a4134cbf 7 //
Cirrus01 1:caf8a4134cbf 8 // You can wire up to 32 GPIO ports to buttons (equipped with
Cirrus01 1:caf8a4134cbf 9 // momentary switches). Connect each switch between the desired
Cirrus01 1:caf8a4134cbf 10 // GPIO port and ground (J9 pin 12 or 14). When the button is pressed,
Cirrus01 1:caf8a4134cbf 11 // we'll tell the host PC that the corresponding joystick button is
Cirrus01 1:caf8a4134cbf 12 // pressed. We debounce the keystrokes in software, so you can simply
Cirrus01 1:caf8a4134cbf 13 // wire directly to pushbuttons with no additional external hardware.
Cirrus01 1:caf8a4134cbf 14 //
Cirrus01 1:caf8a4134cbf 15 // Note that we assign 24 buttons by default, even though the USB
Cirrus01 1:caf8a4134cbf 16 // joystick interface can handle up to 32 buttons. VP itself only
Cirrus01 1:caf8a4134cbf 17 // allows mapping of up to 24 buttons in the preferences dialog
Cirrus01 1:caf8a4134cbf 18 // (although it can recognize 32 buttons internally). If you want
Cirrus01 1:caf8a4134cbf 19 // more buttons, you can reassign pins that are assigned by default
Cirrus01 1:caf8a4134cbf 20 // as LedWiz outputs. To reassign a pin, find the pin you wish to
Cirrus01 1:caf8a4134cbf 21 // reassign in the LedWizPortMap array below, and change the pin name
Cirrus01 1:caf8a4134cbf 22 // there to NC (for Not Connected). You can then change one of the
Cirrus01 1:caf8a4134cbf 23 // "NC" entries below to the reallocated pin name. The limit is 32
Cirrus01 1:caf8a4134cbf 24 // buttons total.
Cirrus01 1:caf8a4134cbf 25 //
Cirrus01 1:caf8a4134cbf 26 // (If you're using TLC5940 chips to control outputs, many of the
Cirrus01 1:caf8a4134cbf 27 // GPIO pins that are mapped to LedWiz outputs in the default
Cirrus01 1:caf8a4134cbf 28 // mapping can be reassigned as keys, since the TLC5940 outputs
Cirrus01 1:caf8a4134cbf 29 // take over for the GPIO pins. The exceptions are the pins that
Cirrus01 1:caf8a4134cbf 30 // are reassigned to control the TLC5940 chips.)
Cirrus01 1:caf8a4134cbf 31 //
Cirrus01 1:caf8a4134cbf 32 // Note: PTD1 (pin J2-12) should NOT be assigned as a button input,
Cirrus01 1:caf8a4134cbf 33 // as this pin is physically connected on the KL25Z to the on-board
Cirrus01 1:caf8a4134cbf 34 // indicator LED's blue segment.
Cirrus01 1:caf8a4134cbf 35
Cirrus01 1:caf8a4134cbf 36 PinName buttonMap[] = {
Cirrus01 1:caf8a4134cbf 37 PB_3, // button 1
Cirrus01 1:caf8a4134cbf 38 PB_5, // button 2
Cirrus01 1:caf8a4134cbf 39 PB_10, // button 3
Cirrus01 1:caf8a4134cbf 40 PC_7, // button 4
Cirrus01 1:caf8a4134cbf 41 PB_6, // button 5
Cirrus01 1:caf8a4134cbf 42 PA_5, // button 6
Cirrus01 1:caf8a4134cbf 43 PB_4, // button 7
Cirrus01 1:caf8a4134cbf 44 PB_13, // button 8
Cirrus01 1:caf8a4134cbf 45 PB_14, // button 9
Cirrus01 1:caf8a4134cbf 46 PB_15, // button 10
Cirrus01 1:caf8a4134cbf 47 PB_1, // button 11
Cirrus01 1:caf8a4134cbf 48 PB_2, // button 12
Cirrus01 1:caf8a4134cbf 49 PC_5, // button 13
Cirrus01 1:caf8a4134cbf 50 PC_6, // button 14
Cirrus01 1:caf8a4134cbf 51 PC_8, // button 15
Cirrus01 1:caf8a4134cbf 52 PH_1, // button 16
Cirrus01 1:caf8a4134cbf 53 PH_0, // button 17
Cirrus01 1:caf8a4134cbf 54 PC_15, // button 18
Cirrus01 1:caf8a4134cbf 55 PC_14, // button 19
Cirrus01 1:caf8a4134cbf 56 PB_7, // button 20
Cirrus01 1:caf8a4134cbf 57 NC, // button 21
Cirrus01 1:caf8a4134cbf 58 NC, // button 22
Cirrus01 1:caf8a4134cbf 59 NC, // button 23
Cirrus01 1:caf8a4134cbf 60 NC, // button 24
Cirrus01 1:caf8a4134cbf 61 NC, // button 25
Cirrus01 1:caf8a4134cbf 62 NC, // button 26
Cirrus01 1:caf8a4134cbf 63 NC, // button 27
Cirrus01 1:caf8a4134cbf 64 NC, // button 28
Cirrus01 1:caf8a4134cbf 65 NC, // button 29
Cirrus01 1:caf8a4134cbf 66 NC, // button 30
Cirrus01 1:caf8a4134cbf 67 NC, // button 31
Cirrus01 1:caf8a4134cbf 68 NC // button 32
Cirrus01 1:caf8a4134cbf 69 };
Cirrus01 1:caf8a4134cbf 70
Cirrus01 1:caf8a4134cbf 71 PinName hatMap[] = {
Cirrus01 1:caf8a4134cbf 72 PA_13, // button 1
Cirrus01 1:caf8a4134cbf 73 PA_14, // button 2
Cirrus01 1:caf8a4134cbf 74 PA_15, // button 3
Cirrus01 1:caf8a4134cbf 75 PC_4, // button 4
Cirrus01 1:caf8a4134cbf 76 NC, // button 5
Cirrus01 1:caf8a4134cbf 77 NC, // button 6
Cirrus01 1:caf8a4134cbf 78 NC, // button 7
Cirrus01 1:caf8a4134cbf 79 NC // button 8
Cirrus01 1:caf8a4134cbf 80 };
Cirrus01 1:caf8a4134cbf 81
Cirrus01 1:caf8a4134cbf 82
Cirrus01 1:caf8a4134cbf 83 // STANDARD ID SETTINGS. These provide full, transparent LedWiz compatibility.
Cirrus01 1:caf8a4134cbf 84 const uint16_t USB_VENDOR_ID = 0x1209;
Cirrus01 1:caf8a4134cbf 85 const uint16_t USB_PRODUCT_ID = 0xACDE;
Cirrus01 1:caf8a4134cbf 86 const uint16_t USB_PRODUCT_VER = 0x0002;