39 lines
857 B
C
Raw Normal View History

/**
* @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
*/
2022-02-04 21:28:49 +01:00
#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"
2023-09-25 07:21:33 +02:00
#include "debugger.h"
2022-02-04 21:28:49 +01:00
// CAN frame structure definition
2022-02-04 23:34:51 +01:00
struct can_frame
{
2022-02-15 23:27:25 +01:00
unsigned long can_id;
2022-02-04 23:34:51 +01:00
uint8_t can_dlc;
uint8_t data[8] __attribute__((aligned(8)));
2022-02-04 21:28:49 +01:00
};
// Function prototypes
2022-02-04 21:28:49 +01:00
void Init_CAN();
2023-09-25 07:21:33 +02:00
void CAN_Process();
2022-02-04 21:28:49 +01:00
uint32_t Process_CAN_WheelSpeed();
#endif