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

@@ -27,8 +27,8 @@ include( AddFileDependencies )
#| "avr" # Teensy++ 1.0
#| "avr" # Teensy++ 2.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( "${COMPILER_FAMILY}" )

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

@@ -152,53 +152,6 @@ static uint8_t mouse_report_desc[] = {
};
#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



// **************************************************************
@@ -354,35 +307,6 @@ static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
MOUSE_SIZE, 0, // wMaxPacketSize
MOUSE_INTERVAL, // bInterval
#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
};


@@ -441,10 +365,6 @@ const usb_descriptor_list_t usb_descriptor_list[] = {
#ifdef MOUSE_INTERFACE
{0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
{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
{0x0300, 0x0000, (const uint8_t *)&string0, 4},
{0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)},
@@ -551,6 +471,3 @@ const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS] =
#endif
};





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

@@ -25,7 +25,7 @@
#define DEVICE_PROTOCOL 0x01
#define EP0_SIZE 64
#define NUM_ENDPOINTS 15
#define NUM_INTERFACE 5
#define NUM_INTERFACE 4
#define CDC_IAD_DESCRIPTOR 1
#define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 // Serial
@@ -43,20 +43,14 @@
#define MOUSE_ENDPOINT 5
#define MOUSE_SIZE 8
#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 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 ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY



@@ -74,3 +68,4 @@ extern const usb_descriptor_list_t usb_descriptor_list[];


#endif


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

@@ -245,7 +245,7 @@ static void usbdev_setup(void)
#endif

// TODO: this does not work... why?
#if defined(SEREMU_INTERFACE) || defined(KEYBOARD_INTERFACE)
#if defined(KEYBOARD_INTERFACE)
case 0x0921: // HID SET_REPORT
//serial_print(":)\n");
return;
@@ -379,8 +379,9 @@ static void usb_control(uint32_t stat)
}
//serial_phex32(*(uint32_t *)usb_cdc_line_coding);
//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);
}
#endif
@@ -864,4 +865,3 @@ uint8_t usb_configured(void)
return usb_configuration;
}



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

@@ -28,11 +28,6 @@ extern volatile uint8_t usb_cdc_transmit_flush_timer;
extern void usb_serial_flush_callback(void);
#endif

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


#endif


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

@@ -237,12 +237,5 @@ void usb_serial_flush_callback(void)
//serial_print("usb_flush_callback end\n");
}









#endif // CDC_STATUS_INTERFACE && CDC_DATA_INTERFACE


+ 6
- 6
setup.cmake View File

@@ -20,7 +20,7 @@
#| 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
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
set( MacroModule "buffer" )
@@ -68,8 +68,8 @@ function( ModuleCompatibility ModulePath )
if ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
# Module found, no need to scan further
return()
endif ( ${mod_var} STREQUAL ${COMPILER_FAMILY} )
endforeach( mod_var ${ARGN} )
endif ()
endforeach()

message( FATAL_ERROR "${ModulePath} does not support the ${COMPILER_FAMILY} family..." )
endfunction()
@@ -108,11 +108,11 @@ macro( PathPrepend Output SourcesPath )
foreach( item ${ARGN} )
# Set the path
set( tmpSource ${tmpSource} "${SourcesPath}/${item}" )
endforeach( item )
endforeach()

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


#| Scan Module
@@ -156,7 +156,7 @@ set( MANUFACTURER "Kiibohd" )
#| Attempt to call Git to get the branch, last commit date, and whether code modified since last commit

#| 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
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE Git_Modified_INFO