cancel
Showing results for 
Search instead for 
Did you mean: 

Code Examples

taas_3144281
Valued Contributor

Hi.

This sample uses CY8CKIT-059.

This sample code is based on “https://www.cypress.com/documentation/application-notes/an57473-usb-hid-basics-psoc-3-and-psoc-5lp”.

This "AN57473" has 5 buttons, but add 1 button to make 6 buttons.

I hope this sample will help you evaluate USB HID.

schematics

pastedImage_5.png

Pin list

pastedImage_6.png

USBFS component

pastedImage_7.png

AN57473        This sample

Usage Maximum (5) ⇒ Usage Maximum (6)

Report Count (5)    ⇒ Report Count (6)

Report Size (3)     ⇒ Report Size (2)

main.c

===========================================

void ReadButtons (void)

{

if(Thumb_Button_Read() != 0)                   /* Detect if button was pressed        */

Buttons |= 0x01;                                         /* If pressed, mask bit to indicate button press */

else

Buttons &= ~0x01;                                      /* If released, clear bit */

if(Button_A_Read() != 0)

Buttons |= 0x02;

else

Buttons &= ~0x02;

if(Button_B_Read() != 0)

Buttons |= 0x04;

else

Buttons &= ~0x04;

if(Button_C_Read() != 0)

Buttons |= 0x08;

else

Buttons &= ~0x08;

if(Button_D_Read() != 0)

Buttons |= 0x10;

else

Buttons &= ~0x10;

  

         if(Button_E_Read() != 0)       

         Buttons |= 0x20;

         else

         Buttons &= ~0x20;

}

===========================================

Breadboard wiring diagram

pastedImage_9.png

Game controller property

pastedImage_8.png

Thanks,

Asanuma

5 Replies
Ekta
Moderator
Moderator

Hello Asanuma,

Thank you for providing the example project.

Best Regards

Ekta

odissey1
Honored Contributor II

Asanuma,

Is Joystick Demo a custom application? Where to find this program?

/odissey1

taas_3144281
Valued Contributor

odissey1-san

This is an application with 6 buttons.

The project is attached.

Best Regards,

Asanuma

odissey1
Honored Contributor II

Asanuma,

I mean what is this application,

pastedImage_0.png

Is this a part of Windows or a custom App?

/odissey1

taas_3144281
Valued Contributor

odissey1-san

This application is part of Windows.

For more info, refer section 5.1 5.2 5.3.

AN57473

https://www.cypress.com/documentation/application-notes/an57473-usb-hid-basics-psoc-3-and-psoc-5lp

Best Regards,

Asanuma

0 Likes