Jörg Weber / Mbed 2 deprecated USBJoystick_2

Dependencies:   USBDevice USBJoystick_SIM mbed USBJoystick_2

Dependents:   USBJoystick_2

Fork of USBJoystick_HelloWorld2 by Wim Huiskamp

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.h Source File

config.h

00001 #define TARGET_STM32F4XX
00002 #define NUM_OF_BUTTONS 32
00003 #define NUM_OF_HAT_BUTTONS 4
00004 #define SYSTEM_CLOCK_HZ                 96000000  // 96MHz 
00005 
00006 // Joystick button input pin assignments.  
00007 //
00008 // You can wire up to 32 GPIO ports to buttons (equipped with 
00009 // momentary switches).  Connect each switch between the desired 
00010 // GPIO port and ground (J9 pin 12 or 14).  When the button is pressed, 
00011 // we'll tell the host PC that the corresponding joystick button is 
00012 // pressed.  We debounce the keystrokes in software, so you can simply 
00013 // wire directly to pushbuttons with no additional external hardware.
00014 //
00015 // Note that we assign 24 buttons by default, even though the USB
00016 // joystick interface can handle up to 32 buttons.  VP itself only
00017 // allows mapping of up to 24 buttons in the preferences dialog 
00018 // (although it can recognize 32 buttons internally).  If you want 
00019 // more buttons, you can reassign pins that are assigned by default
00020 // as LedWiz outputs.  To reassign a pin, find the pin you wish to
00021 // reassign in the LedWizPortMap array below, and change the pin name 
00022 // there to NC (for Not Connected).  You can then change one of the
00023 // "NC" entries below to the reallocated pin name.  The limit is 32
00024 // buttons total.
00025 //
00026 // (If you're using TLC5940 chips to control outputs, many of the
00027 // GPIO pins that are mapped to LedWiz outputs in the default
00028 // mapping can be reassigned as keys, since the TLC5940 outputs
00029 // take over for the GPIO pins.  The exceptions are the pins that
00030 // are reassigned to control the TLC5940 chips.)
00031 //
00032 // Note: PTD1 (pin J2-12) should NOT be assigned as a button input,
00033 // as this pin is physically connected on the KL25Z to the on-board
00034 // indicator LED's blue segment.
00035 
00036 PinName buttonMap[] = {
00037     PB_3,      // button 1
00038     PB_5,      // button 2
00039     PB_10,     // button 3
00040     PC_7,      // button 4
00041     PB_6,      // button 5
00042     PA_5,      // button 6
00043     PB_4,      // button 7
00044     PB_13,     // button 8
00045     PB_14,     // button 9
00046     PB_15,     // button 10
00047     PB_1,      // button 11
00048     PB_2,      // button 12
00049     PC_5,      // button 13
00050     PC_6,      // button 14
00051     PC_8,      // button 15
00052     PC_4,      // button 16
00053     NC,        // button 17
00054     NC,        // button 18
00055     NC,        // button 19
00056     NC,        // button 20
00057     NC,        // button 21
00058     NC,        // button 22
00059     NC,        // button 23
00060     NC,        // button 24
00061     NC,        // button 25
00062     NC,        // button 26
00063     NC,        // button 27
00064     NC,        // button 28
00065     NC,        // button 29
00066     NC,        // button 30
00067     NC,        // button 31
00068     NC         // button 32
00069 };
00070 
00071 PinName hatMap[] = {
00072     PC_2,      // button 1
00073     PC_3,      // button 2
00074     PC_10,     // button 3
00075     PC_12,      // button 4
00076     NC,        // button 5
00077     NC,        // button 6
00078     NC,        // button 7
00079     NC         // button 8
00080 };
00081 
00082 
00083 // STANDARD ID SETTINGS.  These provide full, transparent LedWiz compatibility.
00084 const uint16_t USB_VENDOR_ID = 0x1209;      
00085 const uint16_t USB_PRODUCT_ID = 0xACDE;     
00086 const uint16_t USB_PRODUCT_VER = 0x0002;