39 lines
857 B
C
39 lines
857 B
C
/**
|
|
* @file can.h
|
|
*
|
|
* @brief Header file for Controller Area Network (CAN) functionality in the ChainLube application.
|
|
*
|
|
* This file provides functions and structures related to Controller Area Network (CAN)
|
|
* communication for the ChainLube project. It includes functions for initializing CAN,
|
|
* processing CAN messages, and retrieving wheel speed from CAN data.
|
|
*
|
|
* @author Marcel Peterkau
|
|
* @date 09.01.2024
|
|
*/
|
|
|
|
#ifndef _CAN_H_
|
|
#define _CAN_H_
|
|
|
|
#include <Arduino.h>
|
|
#include <mcp_can.h>
|
|
#include <SPI.h>
|
|
#include "common.h"
|
|
#include "globals.h"
|
|
#include "dtc.h"
|
|
#include "debugger.h"
|
|
|
|
// CAN frame structure definition
|
|
struct can_frame
|
|
{
|
|
unsigned long can_id;
|
|
uint8_t can_dlc;
|
|
uint8_t data[8] __attribute__((aligned(8)));
|
|
};
|
|
|
|
// Function prototypes
|
|
void Init_CAN();
|
|
void CAN_Process();
|
|
uint32_t Process_CAN_WheelSpeed();
|
|
|
|
#endif
|