diff options
author | cpldcpu <cpldcpu@gmail.com> | 2013-12-28 15:11:39 +0100 |
---|---|---|
committer | cpldcpu <cpldcpu@gmail.com> | 2013-12-28 15:11:39 +0100 |
commit | 7a4c9a92ac827df5cf5620e6cd3b9ad33d42e237 (patch) | |
tree | f2ee3ee99916410a4e3b6423ea8decb415ea9dc6 /firmware/usbconfig.h | |
parent | 0712bc8b3fe71e923e37067242fe43978f6d7db9 (diff) | |
download | micronucleus-7a4c9a92ac827df5cf5620e6cd3b9ad33d42e237.tar.gz micronucleus-7a4c9a92ac827df5cf5620e6cd3b9ad33d42e237.tar.bz2 micronucleus-7a4c9a92ac827df5cf5620e6cd3b9ad33d42e237.zip |
firmware: CRC checking of all received data
backport of optimizations by @gblargg
Diffstat (limited to 'firmware/usbconfig.h')
-rw-r--r-- | firmware/usbconfig.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/usbconfig.h b/firmware/usbconfig.h index 560c34d..8ccee36 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 |