Browse Source

Removed Joystick endpoint from ARM usb module

- Also a bit of general house-keeping
simple
Jacob Alexander 11 years ago
parent
commit
ca190c4fd9
7 changed files with 16 additions and 116 deletions
  1. 2
    2
      CMakeLists.txt
  2. 0
    83
      USB/pjrc/arm/usb_desc.c
  3. 3
    8
      USB/pjrc/arm/usb_desc.h
  4. 4
    4
      USB/pjrc/arm/usb_dev.c
  5. 0
    5
      USB/pjrc/arm/usb_dev.h
  6. 1
    8
      USB/pjrc/arm/usb_serial.c
  7. 6
    6
      setup.cmake

+ 2
- 2
CMakeLists.txt View File

#| "avr" # Teensy++ 1.0 #| "avr" # Teensy++ 1.0
#| "avr" # Teensy++ 2.0 #| "avr" # Teensy++ 2.0
#| "arm" # Teensy 3.0 #| "arm" # Teensy 3.0
#set( COMPILER_FAMILY "arm" )
set( COMPILER_FAMILY "avr" )
set( COMPILER_FAMILY "arm" )
#set( COMPILER_FAMILY "avr" )


message( STATUS "Compiler Family:" ) message( STATUS "Compiler Family:" )
message( "${COMPILER_FAMILY}" ) message( "${COMPILER_FAMILY}" )

+ 0
- 83
USB/pjrc/arm/usb_desc.c View File

}; };
#endif #endif


#ifdef JOYSTICK_INTERFACE
static uint8_t joystick_report_desc[] = {
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x20, // Report Count (32)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (Button #1)
0x29, 0x20, // Usage Maximum (Button #32)
0x81, 0x02, // Input (variable,absolute)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x07, // Logical Maximum (7)
0x35, 0x00, // Physical Minimum (0)
0x46, 0x3B, 0x01, // Physical Maximum (315)
0x75, 0x04, // Report Size (4)
0x95, 0x01, // Report Count (1)
0x65, 0x14, // Unit (20)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x39, // Usage (Hat switch)
0x81, 0x42, // Input (variable,absolute,null_state)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection ()
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x03, // Logical Maximum (1023)
0x75, 0x0A, // Report Size (10)
0x95, 0x04, // Report Count (4)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x32, // Usage (Z)
0x09, 0x35, // Usage (Rz)
0x81, 0x02, // Input (variable,absolute)
0xC0, // End Collection
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x03, // Logical Maximum (1023)
0x75, 0x0A, // Report Size (10)
0x95, 0x02, // Report Count (2)
0x09, 0x36, // Usage (Slider)
0x09, 0x36, // Usage (Slider)
0x81, 0x02, // Input (variable,absolute)
0xC0 // End Collection
};
#endif





// ************************************************************** // **************************************************************
MOUSE_SIZE, 0, // wMaxPacketSize MOUSE_SIZE, 0, // wMaxPacketSize
MOUSE_INTERVAL, // bInterval MOUSE_INTERVAL, // bInterval
#endif // MOUSE_INTERFACE #endif // MOUSE_INTERFACE

#ifdef JOYSTICK_INTERFACE
// interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
9, // bLength
4, // bDescriptorType
JOYSTICK_INTERFACE, // bInterfaceNumber
0, // bAlternateSetting
1, // bNumEndpoints
0x03, // bInterfaceClass (0x03 = HID)
0x00, // bInterfaceSubClass
0x00, // bInterfaceProtocol
0, // iInterface
// HID interface descriptor, HID 1.11 spec, section 6.2.1
9, // bLength
0x21, // bDescriptorType
0x11, 0x01, // bcdHID
0, // bCountryCode
1, // bNumDescriptors
0x22, // bDescriptorType
LSB(sizeof(joystick_report_desc)), // wDescriptorLength
MSB(sizeof(joystick_report_desc)),
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
7, // bLength
5, // bDescriptorType
JOYSTICK_ENDPOINT | 0x80, // bEndpointAddress
0x03, // bmAttributes (0x03=intr)
JOYSTICK_SIZE, 0, // wMaxPacketSize
JOYSTICK_INTERVAL, // bInterval
#endif
}; };




#ifdef MOUSE_INTERFACE #ifdef MOUSE_INTERFACE
{0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)}, {0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
{0x2100, MOUSE_INTERFACE, config_descriptor+MOUSE_DESC_OFFSET, 9}, {0x2100, MOUSE_INTERFACE, config_descriptor+MOUSE_DESC_OFFSET, 9},
#endif
#ifdef JOYSTICK_INTERFACE
{0x2200, JOYSTICK_INTERFACE, joystick_report_desc, sizeof(joystick_report_desc)},
{0x2100, JOYSTICK_INTERFACE, config_descriptor+JOYSTICK_DESC_OFFSET, 9},
#endif #endif
{0x0300, 0x0000, (const uint8_t *)&string0, 4}, {0x0300, 0x0000, (const uint8_t *)&string0, 4},
{0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)}, {0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)},
#endif #endif
}; };






+ 3
- 8
USB/pjrc/arm/usb_desc.h View File

#define DEVICE_PROTOCOL 0x01 #define DEVICE_PROTOCOL 0x01
#define EP0_SIZE 64 #define EP0_SIZE 64
#define NUM_ENDPOINTS 15 #define NUM_ENDPOINTS 15
#define NUM_INTERFACE 5
#define NUM_INTERFACE 4
#define CDC_IAD_DESCRIPTOR 1 #define CDC_IAD_DESCRIPTOR 1
#define CDC_STATUS_INTERFACE 0 #define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 // Serial #define CDC_DATA_INTERFACE 1 // Serial
#define MOUSE_ENDPOINT 5 #define MOUSE_ENDPOINT 5
#define MOUSE_SIZE 8 #define MOUSE_SIZE 8
#define MOUSE_INTERVAL 2 #define MOUSE_INTERVAL 2
#define JOYSTICK_INTERFACE 4 // Joystick
#define JOYSTICK_ENDPOINT 6
#define JOYSTICK_SIZE 16
#define JOYSTICK_INTERVAL 1
#define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9) #define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
#define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9) #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
#define JOYSTICK_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9)
#define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9+9+7)
#define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7)
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY










#endif #endif


+ 4
- 4
USB/pjrc/arm/usb_dev.c View File

#endif #endif


// TODO: this does not work... why? // TODO: this does not work... why?
#if defined(SEREMU_INTERFACE) || defined(KEYBOARD_INTERFACE)
#if defined(KEYBOARD_INTERFACE)
case 0x0921: // HID SET_REPORT case 0x0921: // HID SET_REPORT
//serial_print(":)\n"); //serial_print(":)\n");
return; return;
} }
//serial_phex32(*(uint32_t *)usb_cdc_line_coding); //serial_phex32(*(uint32_t *)usb_cdc_line_coding);
//serial_print("\n"); //serial_print("\n");
// TODO - Fix this warning
if (*(uint32_t *)usb_cdc_line_coding == 134) usb_reboot_timer = 15;
// XXX - Not sure why this was casted to uint32_t... -HaaTa
//if (*(uint32_t *)usb_cdc_line_coding == 134) usb_reboot_timer = 15;
if (*usb_cdc_line_coding == 134) usb_reboot_timer = 15;
endpoint0_transmit(NULL, 0); endpoint0_transmit(NULL, 0);
} }
#endif #endif
return usb_configuration; return usb_configuration;
} }




+ 0
- 5
USB/pjrc/arm/usb_dev.h View File

extern void usb_serial_flush_callback(void); extern void usb_serial_flush_callback(void);
#endif #endif


#ifdef SEREMU_INTERFACE
extern volatile uint8_t usb_seremu_transmit_flush_timer;
extern void usb_seremu_flush_callback(void);
#endif



#endif #endif



+ 1
- 8
USB/pjrc/arm/usb_serial.c View File

//serial_print("usb_flush_callback end\n"); //serial_print("usb_flush_callback end\n");
} }










#endif // CDC_STATUS_INTERFACE && CDC_DATA_INTERFACE #endif // CDC_STATUS_INTERFACE && CDC_DATA_INTERFACE


+ 6
- 6
setup.cmake View File

#| Please the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones #| Please the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones


##| Deals with acquiring the keypress information and turning it into a key index ##| Deals with acquiring the keypress information and turning it into a key index
set( ScanModule "FACOM6684" )
set( ScanModule "MBC-55X" )


##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
set( MacroModule "buffer" ) set( MacroModule "buffer" )
if ( ${mod_var} STREQUAL ${COMPILER_FAMILY} ) if ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
# Module found, no need to scan further # Module found, no need to scan further
return() return()
endif ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
endforeach( mod_var ${ARGN} )
endif ()
endforeach()


message( FATAL_ERROR "${ModulePath} does not support the ${COMPILER_FAMILY} family..." ) message( FATAL_ERROR "${ModulePath} does not support the ${COMPILER_FAMILY} family..." )
endfunction() endfunction()
foreach( item ${ARGN} ) foreach( item ${ARGN} )
# Set the path # Set the path
set( tmpSource ${tmpSource} "${SourcesPath}/${item}" ) set( tmpSource ${tmpSource} "${SourcesPath}/${item}" )
endforeach( item )
endforeach()


# Finalize by writing the new list back over the old one # Finalize by writing the new list back over the old one
set( ${Output} ${tmpSource} ) set( ${Output} ${tmpSource} )
endmacro( PathPrepend )
endmacro()




#| Scan Module #| Scan Module
#| Attempt to call Git to get the branch, last commit date, and whether code modified since last commit #| Attempt to call Git to get the branch, last commit date, and whether code modified since last commit


#| Modified #| Modified
#| Takes a bit of work to extract the "M " using CMake, and not using it if there are not modifications
#| Takes a bit of work to extract the "M " using CMake, and not using it if there are no modifications
execute_process( COMMAND git status -s -uno --porcelain execute_process( COMMAND git status -s -uno --porcelain
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE Git_Modified_INFO OUTPUT_VARIABLE Git_Modified_INFO