R1 code for micro:bit based train controller code, requires second micro:bit running tx code to operate - see https://meanderingpi.wordpress.com/ for more information
Fork of mbed-dev-bin by
TARGET_NRF51_MICROBIT/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/crc16/crc16.h@4:1a27ae39e33f, 2017-05-23 (annotated)
- Committer:
- DavidMS
- Date:
- Tue May 23 10:42:56 2017 +0000
- Revision:
- 4:1a27ae39e33f
- Parent:
- 0:e1a608bb55e8
First working micro:bit motor control rx code, need be run with matching tx code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jamesadevine | 0:e1a608bb55e8 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
jamesadevine | 0:e1a608bb55e8 | 2 | * |
jamesadevine | 0:e1a608bb55e8 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
jamesadevine | 0:e1a608bb55e8 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
jamesadevine | 0:e1a608bb55e8 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
jamesadevine | 0:e1a608bb55e8 | 6 | * |
jamesadevine | 0:e1a608bb55e8 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
jamesadevine | 0:e1a608bb55e8 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
jamesadevine | 0:e1a608bb55e8 | 9 | * the file. |
jamesadevine | 0:e1a608bb55e8 | 10 | * |
jamesadevine | 0:e1a608bb55e8 | 11 | */ |
jamesadevine | 0:e1a608bb55e8 | 12 | |
jamesadevine | 0:e1a608bb55e8 | 13 | /** @file |
jamesadevine | 0:e1a608bb55e8 | 14 | * |
jamesadevine | 0:e1a608bb55e8 | 15 | * @defgroup crc_compute CRC compute |
jamesadevine | 0:e1a608bb55e8 | 16 | * @{ |
jamesadevine | 0:e1a608bb55e8 | 17 | * @ingroup hci_transport |
jamesadevine | 0:e1a608bb55e8 | 18 | * |
jamesadevine | 0:e1a608bb55e8 | 19 | * @brief This module implements the CRC-16 calculation in the blocks. |
jamesadevine | 0:e1a608bb55e8 | 20 | */ |
jamesadevine | 0:e1a608bb55e8 | 21 | |
jamesadevine | 0:e1a608bb55e8 | 22 | #ifndef CRC16_H__ |
jamesadevine | 0:e1a608bb55e8 | 23 | #define CRC16_H__ |
jamesadevine | 0:e1a608bb55e8 | 24 | |
jamesadevine | 0:e1a608bb55e8 | 25 | #include <stdint.h> |
jamesadevine | 0:e1a608bb55e8 | 26 | |
jamesadevine | 0:e1a608bb55e8 | 27 | #ifdef __cplusplus |
jamesadevine | 0:e1a608bb55e8 | 28 | extern "C" { |
jamesadevine | 0:e1a608bb55e8 | 29 | #endif |
jamesadevine | 0:e1a608bb55e8 | 30 | |
jamesadevine | 0:e1a608bb55e8 | 31 | /**@brief Function for calculating CRC-16 in blocks. |
jamesadevine | 0:e1a608bb55e8 | 32 | * |
jamesadevine | 0:e1a608bb55e8 | 33 | * Feed each consecutive data block into this function, along with the current value of p_crc as |
jamesadevine | 0:e1a608bb55e8 | 34 | * returned by the previous call of this function. The first call of this function should pass NULL |
jamesadevine | 0:e1a608bb55e8 | 35 | * as the initial value of the crc in p_crc. |
jamesadevine | 0:e1a608bb55e8 | 36 | * |
jamesadevine | 0:e1a608bb55e8 | 37 | * @param[in] p_data The input data block for computation. |
jamesadevine | 0:e1a608bb55e8 | 38 | * @param[in] size The size of the input data block in bytes. |
jamesadevine | 0:e1a608bb55e8 | 39 | * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. |
jamesadevine | 0:e1a608bb55e8 | 40 | * |
jamesadevine | 0:e1a608bb55e8 | 41 | * @return The updated CRC-16 value, based on the input supplied. |
jamesadevine | 0:e1a608bb55e8 | 42 | */ |
jamesadevine | 0:e1a608bb55e8 | 43 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); |
jamesadevine | 0:e1a608bb55e8 | 44 | |
jamesadevine | 0:e1a608bb55e8 | 45 | #ifdef __cplusplus |
jamesadevine | 0:e1a608bb55e8 | 46 | } |
jamesadevine | 0:e1a608bb55e8 | 47 | #endif |
jamesadevine | 0:e1a608bb55e8 | 48 | |
jamesadevine | 0:e1a608bb55e8 | 49 | #endif // CRC16_H__ |
jamesadevine | 0:e1a608bb55e8 | 50 | |
jamesadevine | 0:e1a608bb55e8 | 51 | /** @} */ |