This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB HID Mouse Driver using LPC2148

Hi all,

Thanks for your contineous support from this site.

I want to detect my board as HID mouse when plugged to USB port of PC. For that I guess I need to write HID mouse driver.

I am using LPC2148 controller. Can i gett some reference code for it?

Thanks & Regards,
Kamal

Parents
  • Hi Tsuneo,

    I made the Report Descriptor in readable format now:-)

    const U8 HID_ReportDescriptor[] = {
            HID_UsagePage(HID_USAGE_PAGE_GENERIC),
            HID_Usage(HID_USAGE_GENERIC_MOUSE),
            HID_Collection (HID_Application),
              HID_Usage (HID_USAGE_GENERIC_POINTER),
              HID_Collection (HID_Physical),
                HID_ReportCount (3),
                HID_ReportSize (1),
                HID_UsagePage (HID_USAGE_PAGE_BUTTON),
                HID_UsageMin (1),
                HID_UsageMax (3),
                HID_LogicalMin (0),
                HID_LogicalMax (1),
                HID_Input (HID_Data | HID_Variable | HID_Absolute),
                HID_ReportCount (1),
                HID_ReportSize (5),
                HID_Input (HID_Constant),
                HID_ReportSize (8),
                HID_ReportCount (2),
                HID_UsagePage(HID_USAGE_PAGE_GENERIC),
                HID_Usage(HID_USAGE_GENERIC_X),
                HID_Usage(HID_USAGE_GENERIC_Y),
                HID_LogicalMin(0x81),
                HID_LogicalMax (0x7F),
                HID_Input (HID_Data | HID_Variable | HID_Relative),
              HID_EndCollection,
            HID_EndCollection
    };
    

    As the USB mouse protocol requires 3 bytes of Data (Button, X Displacement, Y Displacement), I declared U8 InReport as

    U8 InReport[3] = {0};
    

    void GetInReport (void) function does nothing (Code stubing will be done later)

    I feel by doing so, it should work but....:-( It is still not working...

    Are there any other changes i need to take care ?

    Thanks & Regards,
    Kamal Joshi

Reply
  • Hi Tsuneo,

    I made the Report Descriptor in readable format now:-)

    const U8 HID_ReportDescriptor[] = {
            HID_UsagePage(HID_USAGE_PAGE_GENERIC),
            HID_Usage(HID_USAGE_GENERIC_MOUSE),
            HID_Collection (HID_Application),
              HID_Usage (HID_USAGE_GENERIC_POINTER),
              HID_Collection (HID_Physical),
                HID_ReportCount (3),
                HID_ReportSize (1),
                HID_UsagePage (HID_USAGE_PAGE_BUTTON),
                HID_UsageMin (1),
                HID_UsageMax (3),
                HID_LogicalMin (0),
                HID_LogicalMax (1),
                HID_Input (HID_Data | HID_Variable | HID_Absolute),
                HID_ReportCount (1),
                HID_ReportSize (5),
                HID_Input (HID_Constant),
                HID_ReportSize (8),
                HID_ReportCount (2),
                HID_UsagePage(HID_USAGE_PAGE_GENERIC),
                HID_Usage(HID_USAGE_GENERIC_X),
                HID_Usage(HID_USAGE_GENERIC_Y),
                HID_LogicalMin(0x81),
                HID_LogicalMax (0x7F),
                HID_Input (HID_Data | HID_Variable | HID_Relative),
              HID_EndCollection,
            HID_EndCollection
    };
    

    As the USB mouse protocol requires 3 bytes of Data (Button, X Displacement, Y Displacement), I declared U8 InReport as

    U8 InReport[3] = {0};
    

    void GetInReport (void) function does nothing (Code stubing will be done later)

    I feel by doing so, it should work but....:-( It is still not working...

    Are there any other changes i need to take care ?

    Thanks & Regards,
    Kamal Joshi

Children