/* VectorNav HSI Calibration Library v1.0.0.2
 *
 * Copyright (c) 2018 VectorNav Technologies, LLC
 *
 * This source code is proprietary to and copyrighted by VectorNav Technologies, LLC and is
 * available solely under license from VectorNav. All rights reserved. If you do not have a
 * license to use this source code from VectorNav, any use hereof is strictly prohibited by
 * U.S. law and other applicable law. This source code is restricted for use solely with the
 * products of VectorNav and as otherwise set forth in any agreement with VectorNav. Any
 * disclosure of this source code to the public or to any third party is also prohibited.
 */
#ifndef _VNERRDET_H_
#define _VNERRDET_H_

/** \brief Error-detection capabilities. */

#include <stddef.h>
#include "vnenum.h"
#include "vnint.h"

#ifdef __cplusplus
extern "C" {
#endif

/**\brief Computes the 8-bit XOR checksum of the provided data.
 * \param[in] data Pointer to the start of data to perform the checksum of.
 * \param[in] length The number of bytes to include in the checksum.
 * \return The computed checksum. */
uint8_t
VnChecksum8_compute(
    char const *data,
    size_t length);

/**\brief Computes the 16-bit CRC16-CCITT of the provided data.
 * \param[in] data Pointer to the start of data to perform the CRC of.
 * \param[in] length The number of bytes to include in the CRC.
 * \return The computed CRC. */
uint16_t
VnCrc16_compute(
    char const *data,
    size_t length);

#ifdef __cplusplus
}
#endif

#endif
