/* USER CODE BEGIN Header */
|
/**
|
******************************************************************************
|
* @file can.h
|
* @brief This file contains all the function prototypes for
|
* the can.c file
|
******************************************************************************
|
* @attention
|
*
|
* Copyright (c) 2023 STMicroelectronics.
|
* All rights reserved.
|
*
|
* This software is licensed under terms that can be found in the LICENSE file
|
* in the root directory of this software component.
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
*
|
******************************************************************************
|
*/
|
/* USER CODE END Header */
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
#ifndef __CAN_H__
|
#define __CAN_H__
|
|
#ifdef __cplusplus
|
extern "C" {
|
#endif
|
|
/* Includes ------------------------------------------------------------------*/
|
#include "main.h"
|
|
/* USER CODE BEGIN Includes */
|
#include "usart.h"
|
#include "ringbuf.h"
|
/* USER CODE END Includes */
|
|
extern CAN_HandleTypeDef hcan1;
|
|
/* USER CODE BEGIN Private defines */
|
typedef struct can_s
|
{
|
int fd;/* compatible with Linux API, not used */
|
ring_buffer_t xRxBuffer; /* receive data ring buffer */
|
} can_t;
|
|
extern can_t can;
|
/* USER CODE END Private defines */
|
|
void MX_CAN1_Init(void);
|
|
/* USER CODE BEGIN Prototypes */
|
extern can_t *can_init(CAN_HandleTypeDef *hcan);
|
extern int can_send(can_t *pcan, char *data, int bytes);
|
extern int can_recv(can_t *pcan, char *buf, int size, uint32_t timeout);
|
extern void can_term(can_t *pcan);
|
/* USER CODE END Prototypes */
|
|
#ifdef __cplusplus
|
}
|
#endif
|
|
#endif /* __CAN_H__ */
|