diff options
author | Tim <cpldcpu@gmail.com> | 2014-01-14 23:40:25 -0800 |
---|---|---|
committer | Tim <cpldcpu@gmail.com> | 2014-01-14 23:40:25 -0800 |
commit | 993bed77e563054f12ac61b5d8f93e2cb548525e (patch) | |
tree | 7fc9a7dc6860dbb9823f646b261d4238d7fd802e /firmware/usbconfig.h | |
parent | 18e258ace5c610e1e40f53adaca402b46820f72a (diff) | |
parent | 34b0f0f0b6ef651bb30878341cba2a28a107d82d (diff) | |
download | micronucleus-993bed77e563054f12ac61b5d8f93e2cb548525e.tar.gz micronucleus-993bed77e563054f12ac61b5d8f93e2cb548525e.tar.bz2 micronucleus-993bed77e563054f12ac61b5d8f93e2cb548525e.zip |
Merge pull request #34 from micronucleus/testing
v1.11 - pull request
Diffstat (limited to 'firmware/usbconfig.h')
-rw-r--r-- | firmware/usbconfig.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/firmware/usbconfig.h b/firmware/usbconfig.h index 560c34d..dc5cafc 100644 --- a/firmware/usbconfig.h +++ b/firmware/usbconfig.h @@ -110,6 +110,12 @@ * for long transfers increases the driver size. */ /* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ + +// Check CRC of all received data +#define USB_RX_USER_HOOK( data, len ) { \ +if ( usbCrc16( data, len + 2 ) != 0x4FFE )\ +return;\ +} /* This macro is a hook if you want to do unconventional things. If it is * defined, it's inserted at the beginning of received message processing. * If you eat the received message and don't want default processing to @@ -163,10 +169,15 @@ #ifndef __ASSEMBLER__ void calibrateOscillatorASM(void); - extern uint16_t idlePolls; -# define USB_RESET_HOOK(resetStarts) if(!resetStarts){ ((uint8_t*)&idlePolls)[1]= 0;calibrateOscillatorASM();} + + #if AUTO_EXIT_NO_USB_MS>0 + extern uint16_union_t idlePolls; + #define USB_RESET_HOOK(resetStarts) if(!resetStarts){ idlePolls.b[1]=0; calibrateOscillatorASM();} + #else + #define USB_RESET_HOOK(resetStarts) if(!resetStarts){ calibrateOscillatorASM();} + #endif -# define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 + #define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 #endif |