Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/bin/python3
- '''
- Basic script to send USB Vendor Commands to PSoC5LP
- Based on Cypress AN56377
- VID = 0x04B4
- PID = 0xE176
- Direction = OUT
- ReqType = Vendor
- Target = Device
- Request Codes:
- 0xA1 = Turn onboard LED on
- 0xB1 = Turn onboard LED off
- 0xA2 = TODO, read data
- 0xB2 = TODO, send data
- '''
- import usb
- import sys
- import time
- VID = 0x04B4
- PID = 0xE176
- dev = usb.core.find(idVendor = VID, idProduct = PID)
- if not dev:
- print("No se encontro el PSoC")
- exit(1)
- print("PSoC encontrado")
- for i in range(10):
- # dev.ctrl_transfer(bmRequestType, bmRequest, wValue, wIndex, data)
- # Prendemos el LED
- dev.ctrl_transfer(0x40 , 0xA1, 0, 0, [])
- # Esperamos
- time.sleep(0.5)
- # Apagamos el LED
- dev.ctrl_transfer(0x40 , 0xB1, 0, 0, [])
- time.sleep(0.5)
- print("Adios!")
- exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement