Initial

Dependencies:   mbed USBDevice USBJoystick_SIM

Committer:
Cirrus01
Date:
Wed Mar 25 14:26:48 2020 +0000
Revision:
7:6e1b826a62b6
Parent:
6:d3042649530d
Changed 8 bit encoder values to 32 bit values

Who changed what in which revision?

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