69 lines
1.0 KiB
C
69 lines
1.0 KiB
C
/*
|
|
* can.h
|
|
*
|
|
* Created on: Jun 12, 2025
|
|
* Author: janek
|
|
*/
|
|
|
|
#ifndef INC_CAN_H_
|
|
#define INC_CAN_H_
|
|
|
|
#include "can_halal.h"
|
|
|
|
#define CAN_ID_TX 0x420
|
|
#define CAN_ID_RX_R2D 0x410
|
|
#define CAN_ID_RX_AMS 0x00A
|
|
|
|
typedef union {
|
|
struct {
|
|
uint8_t ts_state : 1;
|
|
uint8_t NC1 : 1;
|
|
uint8_t NC2 : 1;
|
|
uint8_t NC3 : 1;
|
|
uint8_t NC4 : 1;
|
|
uint8_t NC5 : 1;
|
|
uint8_t NC6 : 1;
|
|
uint8_t sdc_closed : 1;
|
|
};
|
|
uint8_t ams_rx;
|
|
} ams_info;
|
|
|
|
typedef union {
|
|
struct {
|
|
uint8_t ts_green : 1;
|
|
uint8_t imd_error : 1;
|
|
uint8_t ams_error : 1;
|
|
uint8_t NC1 : 1;
|
|
uint8_t NC2 : 1;
|
|
uint8_t NC3 : 1;
|
|
uint8_t NC4 : 1;
|
|
uint8_t NC5 : 1;
|
|
};
|
|
uint8_t ams_led;
|
|
}led_info;
|
|
|
|
typedef union {
|
|
struct {
|
|
ams_info ams_status;
|
|
led_info led_status;
|
|
};
|
|
uint16_t ams_bitmask;
|
|
} rx_acc;
|
|
|
|
typedef union{
|
|
struct{
|
|
uint8_t r2d : 1;
|
|
uint8_t tson : 1;
|
|
uint8_t racemode : 1;
|
|
uint8_t sdc_in : 1;
|
|
uint8_t sdc_out : 1;
|
|
};
|
|
uint8_t dash_send;
|
|
}dash_tx_t;
|
|
|
|
void can_init(CAN_HandleTypeDef* hcan);
|
|
void can_send();
|
|
void can_rxupdateFrame();
|
|
|
|
#endif /* INC_CAN_H_ */
|