where in the firmware source code to add a GPIO turn on/off command when a device is detected plugged in USB-C ?

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
beyuc_3712261
Level 3
Level 3

I am trying to add a command in the source code of the reference project  "CYPD3120-40LQXI_dp_dongle" to turn on/off a GPIO port of CYPD3123 when a device is detected plugged in the USB-C. Can anyone tell me the command and the source code name in the project?

Thanks,

Derogn Yuan

0 Likes
1 Solution
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi Derong,

CYPD3120-40LQXI_dp_dongle attach event will be report in function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat).

You just need add GPIO write action under ATTACH EVENT. Of course, it same way to DETACH.

pastedImage_0.png

If you want to know How to operation  GPIO write, you just need drag a cypin and name it on .cysch file.

pastedImage_1.png

You could select the Drive Mode as you want to.

If you want to know more details, attached file can be refer to.

Best Regards,

Lisa

View solution in original post

0 Likes
3 Replies
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi Derong,

CYPD3120-40LQXI_dp_dongle attach event will be report in function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat).

You just need add GPIO write action under ATTACH EVENT. Of course, it same way to DETACH.

pastedImage_0.png

If you want to know How to operation  GPIO write, you just need drag a cypin and name it on .cysch file.

pastedImage_1.png

You could select the Drive Mode as you want to.

If you want to know more details, attached file can be refer to.

Best Regards,

Lisa

0 Likes

Hi Lisa,

It is now working when I use the case APP_EVE_CONNECT  and APP_EVE_DISCONNECT to add the GPIO control commands.  Could you tell me why the APP_EVE_TYPEC_ATTACH and APP_EVE_TYPEC_DETACH are not recognizable by the compiler (I am using PSoC Creator 3.3)? what header file should be add at the top of  the app.c to make the compiler process ? Is it OK to use the case APP_EVE_CONNECT  and APP_EVE_DISCONNECT in my application?p1.png

Thanks,

Derong Yuan

0 Likes

Hi Derong,

It is because you are using old firmware verision. I am referring the latest one.

Best Regards,

Lisa

0 Likes