![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/crc.h@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /********************************************************************** |
kadonotakashi | 0:8fdf9a60065b | 2 | * |
kadonotakashi | 0:8fdf9a60065b | 3 | * Filename: crc.h |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Description: A header file describing the various CRC standards. |
kadonotakashi | 0:8fdf9a60065b | 6 | * |
kadonotakashi | 0:8fdf9a60065b | 7 | * Notes: |
kadonotakashi | 0:8fdf9a60065b | 8 | * |
kadonotakashi | 0:8fdf9a60065b | 9 | * |
kadonotakashi | 0:8fdf9a60065b | 10 | * Copyright (c) 2000 by Michael Barr. This software is placed into |
kadonotakashi | 0:8fdf9a60065b | 11 | * the public domain and may be used for any purpose. However, this |
kadonotakashi | 0:8fdf9a60065b | 12 | * notice must not be changed or removed and no warranty is either |
kadonotakashi | 0:8fdf9a60065b | 13 | * expressed or implied by its publication or distribution. |
kadonotakashi | 0:8fdf9a60065b | 14 | **********************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 15 | |
kadonotakashi | 0:8fdf9a60065b | 16 | #ifndef _crc_h |
kadonotakashi | 0:8fdf9a60065b | 17 | #define _crc_h |
kadonotakashi | 0:8fdf9a60065b | 18 | |
kadonotakashi | 0:8fdf9a60065b | 19 | |
kadonotakashi | 0:8fdf9a60065b | 20 | #define FALSE 0 |
kadonotakashi | 0:8fdf9a60065b | 21 | #define TRUE !FALSE |
kadonotakashi | 0:8fdf9a60065b | 22 | |
kadonotakashi | 0:8fdf9a60065b | 23 | /* |
kadonotakashi | 0:8fdf9a60065b | 24 | * Select the CRC standard from the list that follows. |
kadonotakashi | 0:8fdf9a60065b | 25 | */ |
kadonotakashi | 0:8fdf9a60065b | 26 | #define CRC16 |
kadonotakashi | 0:8fdf9a60065b | 27 | |
kadonotakashi | 0:8fdf9a60065b | 28 | |
kadonotakashi | 0:8fdf9a60065b | 29 | #if defined(CRC_CCITT) |
kadonotakashi | 0:8fdf9a60065b | 30 | |
kadonotakashi | 0:8fdf9a60065b | 31 | typedef unsigned short crc; |
kadonotakashi | 0:8fdf9a60065b | 32 | |
kadonotakashi | 0:8fdf9a60065b | 33 | #define CRC_NAME "CRC-CCITT" |
kadonotakashi | 0:8fdf9a60065b | 34 | #define POLYNOMIAL 0x1021 |
kadonotakashi | 0:8fdf9a60065b | 35 | #define INITIAL_REMAINDER 0xFFFF |
kadonotakashi | 0:8fdf9a60065b | 36 | #define FINAL_XOR_VALUE 0x0000 |
kadonotakashi | 0:8fdf9a60065b | 37 | #define REFLECT_DATA FALSE |
kadonotakashi | 0:8fdf9a60065b | 38 | #define REFLECT_REMAINDER FALSE |
kadonotakashi | 0:8fdf9a60065b | 39 | #define CHECK_VALUE 0x29B1 |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | #elif defined(CRC16) |
kadonotakashi | 0:8fdf9a60065b | 42 | |
kadonotakashi | 0:8fdf9a60065b | 43 | typedef unsigned short crc; |
kadonotakashi | 0:8fdf9a60065b | 44 | |
kadonotakashi | 0:8fdf9a60065b | 45 | #define CRC_NAME "CRC-16" |
kadonotakashi | 0:8fdf9a60065b | 46 | #define POLYNOMIAL 0x8005 |
kadonotakashi | 0:8fdf9a60065b | 47 | #define INITIAL_REMAINDER 0x0000 |
kadonotakashi | 0:8fdf9a60065b | 48 | #define FINAL_XOR_VALUE 0x0000 |
kadonotakashi | 0:8fdf9a60065b | 49 | #define REFLECT_DATA TRUE |
kadonotakashi | 0:8fdf9a60065b | 50 | #define REFLECT_REMAINDER TRUE |
kadonotakashi | 0:8fdf9a60065b | 51 | #define CHECK_VALUE 0xBB3D |
kadonotakashi | 0:8fdf9a60065b | 52 | |
kadonotakashi | 0:8fdf9a60065b | 53 | #elif defined(CRC32) |
kadonotakashi | 0:8fdf9a60065b | 54 | |
kadonotakashi | 0:8fdf9a60065b | 55 | typedef unsigned long crc; |
kadonotakashi | 0:8fdf9a60065b | 56 | |
kadonotakashi | 0:8fdf9a60065b | 57 | #define CRC_NAME "CRC-32" |
kadonotakashi | 0:8fdf9a60065b | 58 | #define POLYNOMIAL 0x04C11DB7 |
kadonotakashi | 0:8fdf9a60065b | 59 | #define INITIAL_REMAINDER 0xFFFFFFFF |
kadonotakashi | 0:8fdf9a60065b | 60 | #define FINAL_XOR_VALUE 0xFFFFFFFF |
kadonotakashi | 0:8fdf9a60065b | 61 | #define REFLECT_DATA TRUE |
kadonotakashi | 0:8fdf9a60065b | 62 | #define REFLECT_REMAINDER TRUE |
kadonotakashi | 0:8fdf9a60065b | 63 | #define CHECK_VALUE 0xCBF43926 |
kadonotakashi | 0:8fdf9a60065b | 64 | |
kadonotakashi | 0:8fdf9a60065b | 65 | #else |
kadonotakashi | 0:8fdf9a60065b | 66 | |
kadonotakashi | 0:8fdf9a60065b | 67 | #error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd." |
kadonotakashi | 0:8fdf9a60065b | 68 | |
kadonotakashi | 0:8fdf9a60065b | 69 | #endif |
kadonotakashi | 0:8fdf9a60065b | 70 | |
kadonotakashi | 0:8fdf9a60065b | 71 | |
kadonotakashi | 0:8fdf9a60065b | 72 | void crcInit(void); |
kadonotakashi | 0:8fdf9a60065b | 73 | crc crcSlow(unsigned char const message[], int nBytes); |
kadonotakashi | 0:8fdf9a60065b | 74 | crc crcFast(unsigned char const message[], int nBytes); |
kadonotakashi | 0:8fdf9a60065b | 75 | |
kadonotakashi | 0:8fdf9a60065b | 76 | |
kadonotakashi | 0:8fdf9a60065b | 77 | #endif /* _crc_h */ |