Move doc comments to header
This commit is contained in:
		@ -39,21 +39,8 @@ const uint16_t crc16_table[256] = {
 | 
			
		||||
    0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341,
 | 
			
		||||
    0x4100, 0x81C1, 0x8081, 0x4040};
 | 
			
		||||
 | 
			
		||||
/*	Defines UART and DMA Handle
 | 
			
		||||
 *  Always use the Init Routine before using any other function of the Libary
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void init_BQCom(UART_HandleTypeDef* uarthandle) { bq_uart = uarthandle; }
 | 
			
		||||
 | 
			
		||||
/* Input Message Buffer with the Last two Bytes set to 0. The Last Bytes will be
 | 
			
		||||
 * the CRC after use of the Function
 | 
			
		||||
 *
 | 
			
		||||
 * Returns 0 if the buffer is to small
 | 
			
		||||
 *
 | 
			
		||||
 * Returns 1 if the Function was successfull
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
uint16_t Calculate_CRC(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  uint16_t wCRC = 0;
 | 
			
		||||
 | 
			
		||||
@ -74,13 +61,6 @@ uint16_t Calculate_CRC(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*Checks if the CRC is correct
 | 
			
		||||
 *
 | 
			
		||||
 * Returns 0 if the Buffer is too small or the CRC is incorrect
 | 
			
		||||
 *
 | 
			
		||||
 * Returns 1 if the CRC is correct
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
uint16_t Check_CRC(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  uint16_t wCRC = 0;
 | 
			
		||||
 | 
			
		||||
@ -106,17 +86,6 @@ uint16_t Check_CRC(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Writes data to a register of the BQ76
 | 
			
		||||
 *
 | 
			
		||||
 * registeraddress specifies the register
 | 
			
		||||
 * Makros are available in BQ_Register_Definitions.h
 | 
			
		||||
 *
 | 
			
		||||
 * registersize defines the register size in bytes
 | 
			
		||||
 *
 | 
			
		||||
 * data defines the data written to the BQ
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
uint32_t BQ_Write_Register(uint8_t registeraddress, uint8_t registersize,
 | 
			
		||||
                           uint32_t data) {
 | 
			
		||||
  uint8_t message[registersize + 5];
 | 
			
		||||
@ -136,13 +105,6 @@ uint32_t BQ_Write_Register(uint8_t registeraddress, uint8_t registersize,
 | 
			
		||||
  return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*Read the Data of a Register specified by its Address
 | 
			
		||||
 *
 | 
			
		||||
 * Makros for register names are available in BQ_Register_Definitions.h
 | 
			
		||||
 *
 | 
			
		||||
 * registersize defines the register size in bytes
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
uint8_t BQ_Read_Register(uint8_t registeraddress, uint8_t registersize,
 | 
			
		||||
                         uint32_t* data) {
 | 
			
		||||
  uint8_t message[6] = {0};
 | 
			
		||||
@ -210,26 +172,14 @@ BQ_Comm_Status BQ_ReadMeasurements(uint8_t* buffer, uint8_t bufferlength) {
 | 
			
		||||
  return BQ_COMM_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Hardware Layer Implementation of the UART Transmit
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
uint8_t BQ_UART_Transmit(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  HAL_StatusTypeDef uartstate =
 | 
			
		||||
      HAL_UART_Transmit(bq_uart, message_buffer, bufferlength, BQUARTTIMEOUT);
 | 
			
		||||
  return (uint8_t)uartstate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Hardware Layer Implementation of the UART Receive
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
uint8_t BQ_UART_Receive(uint8_t* message_buffer, uint16_t bufferlength) {
 | 
			
		||||
  HAL_StatusTypeDef uartstate =
 | 
			
		||||
      HAL_UART_Receive(bq_uart, message_buffer, bufferlength, BQUARTTIMEOUT);
 | 
			
		||||
  return (uint8_t)uartstate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*Resets the Communication Interface of the BQ76
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
uint8_t Communication_Reset() { return 0; }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user