If( JoystickStatus_LCL & JOYSTICK_UP_MASK ) JoystickReport->Y = -100 Įlse if( JoystickStatus_LCL & JOYSTICK_DOWN_MASK ) JoystickReport->Y = 100 Uint8_t ButtonStatus_LCL = ( BUTTONS_PORT_PIN & BUTTONS_ALL_MASK ) ^ BUTTONS_ALL_MASK Uint8_t JoystickStatus_LCL = ( JOYSTICK_PORT_PIN & JOYSTICK_ALL_MASK ) ^ JOYSTICK_ALL_MASK USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData bool CALLBACK_HID_Device_CreateHIDReport( USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, The main USB call would then take care of transferring this report to the host. All that was needed was, during the call back function, to read the joystick and button states and add them to the generated report. Within the project is a call back function used to create the HID report to be transferred to the host. Since most operating systems support the USB HID classes out of the box there is no need for any third party drivers. The example project implements a Human Interface Device (HID) class joystick driver.
With the design laid out on strip board I started on the firmware. Rather than starting from scratch I took the joystick class driver example provided with the LUFA and begun modifying it to suit my needs. I have used LUFA a lot in recent years because I find it extremely easy to implement as well as being extremely well documented.
They feature an Atmel AT90USB162 micro controller with full speed USB controller which makes implementing USB applications a breeze. For the firmware I opted to use the LUFA (Lightweight USB Framework for AVRs, formerly known as MyUSB). All I needed after all was a simple joystick to USB converter with support for up to eight buttons. The design I came up with encompasses a Minimus AVR development board I already had lying around. The majority of which are keyboard encoders.
Those you buy of the shelf in my opinion are just way overpriced for what you get. Rather than buying one I decided from the onset that I was going to design my own. With the case now modified to fit the new joystick and buttons I moved onto the interface board.