light up LED only when USB address is assigned

This commit is contained in:
Steffen Vogel 2012-04-15 16:22:31 +02:00
parent cd8699d96b
commit 83d70e7350
2 changed files with 24 additions and 2 deletions

View file

@ -317,13 +317,19 @@ int i;
/* all inputs except PC0, PC1 */
DDRC |= 0x03;
ledGreenOn();
ledRedOff();
/* enable pull up on jumper */
SLOW_SCK_PORT |= (1 << SLOW_SCK_NUM);
}
void usbHadReset() {
ledGreenOff();
}
void usbAddressAssigned() {
ledGreenOn();
}
int main(void) {
/* init ports */
hardwareInit();

View file

@ -110,6 +110,22 @@ the newest features and options.
* usbdrv.h.
*/
/* Visual feedback of successful enumeration */
#ifndef __ASSEMBLER__
extern void usbHadReset();
extern void usbAddressAssigned();
#endif
#define USB_RESET_HOOK(resetStarts) if(!resetStarts) { usbHadReset(); }
/* This macro is a hook if you need to know when an USB RESET occurs. It has
* one parameter which distinguishes between the start of RESET state and its
* end.
*/
#define USB_SET_ADDRESS_HOOK() usbAddressAssigned();
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
* received.
*/
/* -------------------------- Device Description --------------------------- */
#define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */