led example with 2 timers

Dependencies:   mbed mbed-rtos

Committer:
passelin
Date:
Tue Feb 11 04:23:35 2014 +0000
Revision:
2:124a066878cc
23:23

Who changed what in which revision?

UserRevisionLine numberNew contents of line
passelin 2:124a066878cc 1 /*******************************************************************\
passelin 2:124a066878cc 2 * *
passelin 2:124a066878cc 3 * Library : lib_crc *
passelin 2:124a066878cc 4 * File : lib_crc.h *
passelin 2:124a066878cc 5 * Author : Lammert Bies 1999-2008 *
passelin 2:124a066878cc 6 * E-mail : info@lammertbies.nl *
passelin 2:124a066878cc 7 * Language : ANSI C *
passelin 2:124a066878cc 8 * *
passelin 2:124a066878cc 9 * *
passelin 2:124a066878cc 10 * Description *
passelin 2:124a066878cc 11 * =========== *
passelin 2:124a066878cc 12 * *
passelin 2:124a066878cc 13 * The file lib_crc.h contains public definitions and proto- *
passelin 2:124a066878cc 14 * types for the CRC functions present in lib_crc.c. *
passelin 2:124a066878cc 15 * *
passelin 2:124a066878cc 16 * *
passelin 2:124a066878cc 17 * Dependencies *
passelin 2:124a066878cc 18 * ============ *
passelin 2:124a066878cc 19 * *
passelin 2:124a066878cc 20 * none *
passelin 2:124a066878cc 21 * *
passelin 2:124a066878cc 22 * *
passelin 2:124a066878cc 23 * Modification history *
passelin 2:124a066878cc 24 * ==================== *
passelin 2:124a066878cc 25 * *
passelin 2:124a066878cc 26 * Date Version Comment *
passelin 2:124a066878cc 27 * *
passelin 2:124a066878cc 28 * 2010-10-20 1.17 Added several routines (JP) *
passelin 2:124a066878cc 29 * 2008-04-20 1.16 Added CRC-CCITT routine for Kermit *
passelin 2:124a066878cc 30 * *
passelin 2:124a066878cc 31 * 2007-04-01 1.15 Added CRC16 calculation for Modbus *
passelin 2:124a066878cc 32 * *
passelin 2:124a066878cc 33 * 2007-03-28 1.14 Added CRC16 routine for Sick devices *
passelin 2:124a066878cc 34 * *
passelin 2:124a066878cc 35 * 2005-12-17 1.13 Added CRC-CCITT with initial 0x1D0F *
passelin 2:124a066878cc 36 * *
passelin 2:124a066878cc 37 * 2005-02-14 1.12 Added CRC-CCITT with initial 0x0000 *
passelin 2:124a066878cc 38 * *
passelin 2:124a066878cc 39 * 2005-02-05 1.11 Fixed bug in CRC-DNP routine *
passelin 2:124a066878cc 40 * *
passelin 2:124a066878cc 41 * 2005-02-04 1.10 Added CRC-DNP routines *
passelin 2:124a066878cc 42 * *
passelin 2:124a066878cc 43 * 2005-01-07 1.02 Changes in tst_crc.c *
passelin 2:124a066878cc 44 * *
passelin 2:124a066878cc 45 * 1999-02-21 1.01 Added FALSE and TRUE mnemonics *
passelin 2:124a066878cc 46 * *
passelin 2:124a066878cc 47 * 1999-01-22 1.00 Initial source *
passelin 2:124a066878cc 48 * *
passelin 2:124a066878cc 49 \*******************************************************************/
passelin 2:124a066878cc 50 #ifndef _LIB_CRC_H_
passelin 2:124a066878cc 51 #define _LIB_CRC_H_
passelin 2:124a066878cc 52
passelin 2:124a066878cc 53 #include <stdint.h>
passelin 2:124a066878cc 54
passelin 2:124a066878cc 55 #define CRC_VERSION "2.0"
passelin 2:124a066878cc 56
passelin 2:124a066878cc 57 uint16_t update_crc16_normal( uint16_t *table, uint16_t crc, char c );
passelin 2:124a066878cc 58 uint16_t update_crc16_reflected( uint16_t *table, uint16_t crc, char c );
passelin 2:124a066878cc 59 uint32_t update_crc24_normal( uint32_t *table, uint32_t crc, char c );
passelin 2:124a066878cc 60 // update_crc24_reflected same as update_crc32_reflected
passelin 2:124a066878cc 61 uint32_t update_crc32_normal( uint32_t *table, uint32_t crc, char c );
passelin 2:124a066878cc 62 uint32_t update_crc32_reflected( uint32_t *table, uint32_t crc, char c );
passelin 2:124a066878cc 63
passelin 2:124a066878cc 64 uint64_t update_crc40_normal( uint64_t *table, uint64_t crc, char c );
passelin 2:124a066878cc 65 // update_crc40_reflected same as update_crc64_reflected
passelin 2:124a066878cc 66 uint64_t update_crc64_normal( uint64_t *table, uint64_t crc, char c );
passelin 2:124a066878cc 67 uint64_t update_crc64_reflected( uint64_t *table, uint64_t crc, char c );
passelin 2:124a066878cc 68
passelin 2:124a066878cc 69 /* Does the CRC calculation 1 byte at a time */
passelin 2:124a066878cc 70 uint8_t update_crc8_atm(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 71 uint8_t update_crc8_ccitt(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 72 uint8_t update_crc8_maxim(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 73 uint8_t update_crc8(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 74 uint8_t update_crc8_j1850(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 75 uint8_t update_crc8_wcdma(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 76 uint8_t update_crc8_rohc(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 77 uint8_t update_crc8_darc(uint8_t crc, uint8_t c);
passelin 2:124a066878cc 78 uint16_t update_crc16_8005( uint16_t crc, char c );
passelin 2:124a066878cc 79 uint16_t update_crc16_A001( uint16_t crc, char c );
passelin 2:124a066878cc 80 uint16_t update_crc16_1021( uint16_t crc, char c );
passelin 2:124a066878cc 81 uint16_t update_crc16_8408( uint16_t crc, char c );
passelin 2:124a066878cc 82 uint16_t update_crc16_3D65( uint16_t crc, char c );
passelin 2:124a066878cc 83 uint16_t update_crc16_dnp( uint16_t crc, char c );
passelin 2:124a066878cc 84 uint16_t update_crc16_t10_dif( uint16_t crc, char c );
passelin 2:124a066878cc 85 uint16_t update_crc16_0589( uint16_t crc, char c );
passelin 2:124a066878cc 86 uint16_t update_crc16_teledisk( uint16_t crc, char c );
passelin 2:124a066878cc 87 uint32_t update_crc24( uint32_t crc, char c );
passelin 2:124a066878cc 88 uint32_t update_crc24_r64( uint32_t crc, char c );
passelin 2:124a066878cc 89 uint32_t update_crc32_refl( uint32_t crc, char c );
passelin 2:124a066878cc 90 uint32_t update_crc32_norm( uint32_t crc, char c );
passelin 2:124a066878cc 91 uint32_t update_crc32_xfer( uint32_t crc, char c );
passelin 2:124a066878cc 92 uint32_t update_crc32_c( uint32_t crc, char c );
passelin 2:124a066878cc 93 uint32_t update_crc32_d( uint32_t crc, char c );
passelin 2:124a066878cc 94 uint32_t update_crc32_k( uint32_t crc, char c );
passelin 2:124a066878cc 95 uint32_t update_crc32_q( uint32_t crc, char c );
passelin 2:124a066878cc 96 uint16_t update_crc_sick( uint16_t crc, char c, char prev_byte );
passelin 2:124a066878cc 97
passelin 2:124a066878cc 98 uint64_t update_crc40_gsm(uint64_t crc, char c);
passelin 2:124a066878cc 99 uint64_t update_crc64(uint64_t crc, char c);
passelin 2:124a066878cc 100 uint64_t update_crc64_1B(uint64_t crc, char c);
passelin 2:124a066878cc 101 uint64_t update_crc64_jones(uint64_t crc, char c);
passelin 2:124a066878cc 102
passelin 2:124a066878cc 103 /* Does the CRC calculation over a string specified by length (allows 00 inside string) */
passelin 2:124a066878cc 104 uint8_t calculate_crc8_itu(char *p, unsigned int length);
passelin 2:124a066878cc 105 uint8_t calculate_crc8_atm(char *p, unsigned int length);
passelin 2:124a066878cc 106 uint8_t calculate_crc8_ccitt(char *p, unsigned int length);
passelin 2:124a066878cc 107 uint8_t calculate_crc8_maxim(char *p, unsigned int length);
passelin 2:124a066878cc 108 uint8_t calculate_crc8(char *p, unsigned int length);
passelin 2:124a066878cc 109 uint8_t calculate_crc8_icode(char *p, unsigned int length);
passelin 2:124a066878cc 110 uint8_t calculate_crc8_j1850(char *p, unsigned int length);
passelin 2:124a066878cc 111 uint8_t calculate_crc8_wcdma(char *p, unsigned int length);
passelin 2:124a066878cc 112 uint8_t calculate_crc8_rohc(char *p, unsigned int length);
passelin 2:124a066878cc 113 uint8_t calculate_crc8_darc(char *p, unsigned int length);
passelin 2:124a066878cc 114
passelin 2:124a066878cc 115 uint16_t calculate_crc16_Buypass(char *p, unsigned int length);
passelin 2:124a066878cc 116 uint16_t calculate_crc16_DDS_110(char *p, unsigned int length);
passelin 2:124a066878cc 117 uint16_t calculate_crc16_EN_13757(char *p, unsigned int length);
passelin 2:124a066878cc 118 uint16_t calculate_crc16_Teledisk(char *p, unsigned int length);
passelin 2:124a066878cc 119 uint16_t calculate_crc16(char *p, unsigned int length);
passelin 2:124a066878cc 120 uint16_t calculate_crc16_Modbus(char *p, unsigned int length);
passelin 2:124a066878cc 121 uint16_t calculate_crc16_Maxim(char *p, unsigned int length);
passelin 2:124a066878cc 122 uint16_t calculate_crc16_USB(char *p, unsigned int length);
passelin 2:124a066878cc 123 uint16_t calculate_crc16_T10_DIF(char *p, unsigned int length);
passelin 2:124a066878cc 124 uint16_t calculate_crc16_Dect_X(char *p, unsigned int length);
passelin 2:124a066878cc 125 uint16_t calculate_crc16_Dect_R(char *p, unsigned int length);
passelin 2:124a066878cc 126 uint16_t calculate_crc16_sick(char *p, unsigned int length);
passelin 2:124a066878cc 127 uint16_t calculate_crc16_DNP(char *p, unsigned int length);
passelin 2:124a066878cc 128 uint16_t calculate_crc16_Ccitt_Xmodem(char *p, unsigned int length);
passelin 2:124a066878cc 129 uint16_t calculate_crc16_Ccitt_FFFF(char *p, unsigned int length);
passelin 2:124a066878cc 130 uint16_t calculate_crc16_Ccitt_1D0F(char *p, unsigned int length);
passelin 2:124a066878cc 131 uint16_t calculate_crc16_Genibus(char *p, unsigned int length);
passelin 2:124a066878cc 132 uint16_t calculate_crc16_Kermit(char *p, unsigned int length);
passelin 2:124a066878cc 133 uint16_t calculate_crc16_X25(char *p, unsigned int length);
passelin 2:124a066878cc 134 uint16_t calculate_crc16_MCRF4XX(char *p, unsigned int length);
passelin 2:124a066878cc 135 uint16_t calculate_crc16_Riello(char *p, unsigned int length);
passelin 2:124a066878cc 136 uint16_t calculate_chk16_Fletcher(char *p, unsigned int length);
passelin 2:124a066878cc 137
passelin 2:124a066878cc 138 uint32_t calculate_crc24_flexray_a(char *p, unsigned int length);
passelin 2:124a066878cc 139 uint32_t calculate_crc24_flexray_b(char *p, unsigned int length);
passelin 2:124a066878cc 140 uint32_t calculate_crc24_r64(char *p, unsigned int length);
passelin 2:124a066878cc 141 uint32_t calculate_crc32(char *p, unsigned int length);
passelin 2:124a066878cc 142 uint32_t calculate_crc32_jamcrc(char *p, unsigned int length);
passelin 2:124a066878cc 143 uint32_t calculate_crc32_c(char *p, unsigned int length);
passelin 2:124a066878cc 144 uint32_t calculate_crc32_d(char *p, unsigned int length);
passelin 2:124a066878cc 145 uint32_t calculate_crc32_bzip2(char *p, unsigned int length);
passelin 2:124a066878cc 146 uint32_t calculate_crc32_mpeg2(char *p, unsigned int length);
passelin 2:124a066878cc 147 uint32_t calculate_crc32_posix(char *p, unsigned int length);
passelin 2:124a066878cc 148 uint32_t calculate_crc32_k(char *p, unsigned int length);
passelin 2:124a066878cc 149 uint32_t calculate_crc32_q(char *p, unsigned int length);
passelin 2:124a066878cc 150 uint32_t calculate_crc32_xfer(char *p, unsigned int length);
passelin 2:124a066878cc 151 uint64_t calculate_crc40_gsm(char *p, unsigned int length);
passelin 2:124a066878cc 152 uint64_t calculate_crc64(char *p, unsigned int length);
passelin 2:124a066878cc 153 uint64_t calculate_crc64_1b(char *p, unsigned int length);
passelin 2:124a066878cc 154 uint64_t calculate_crc64_we(char *p, unsigned int length);
passelin 2:124a066878cc 155 uint64_t calculate_crc64_jones(char *p, unsigned int length);
passelin 2:124a066878cc 156
passelin 2:124a066878cc 157 #endif /* _LIB_CRC_H_ */