第一次提交
This commit is contained in:
42
Bsp/bsp_lin.h
Normal file
42
Bsp/bsp_lin.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef _BSP_LIN_H
|
||||
#define _BSP_LIN_H
|
||||
#include "at32a423.h"
|
||||
#define Lin_Speed 19200
|
||||
|
||||
//LIN<49><4E><EFBFBD><EFBFBD>״̬
|
||||
typedef enum
|
||||
{
|
||||
BREAK_GET = 0,
|
||||
SYNCH_GET,
|
||||
PID_GET,
|
||||
MSG_GET,
|
||||
CHECKSUM_GET,
|
||||
}lin_rxstate_enum;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LIN_OK = 0,
|
||||
FIFO_VOID, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SYNC_ERR, //ͬ<><CDAC><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>
|
||||
PID_ERR, //PID<49><44><EFBFBD><EFBFBD>
|
||||
NO_RESPONES, //<2F><><EFBFBD><EFBFBD>Ӧ
|
||||
CYHECK_ERR, //<2F><><EFBFBD>ݳ<EFBFBD><DDB3>ȴ<EFBFBD><C8B4><EFBFBD>
|
||||
FORMAT_ERR, //У<><D0A3><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD>
|
||||
}lin_error_enum;
|
||||
|
||||
#pragma pack (1)
|
||||
typedef struct
|
||||
{
|
||||
uint8_t sync; //ͬ<><CDAC><EFBFBD>Σ<EFBFBD><CEA3>̶<EFBFBD>ֵ0x55
|
||||
uint8_t frameid; //֡ID
|
||||
uint8_t pid; //PID
|
||||
uint8_t datalen; //LIN<49><4E><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>Ч<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
uint8_t data[8]; //<2F><><EFBFBD>ݶΣ<DDB6>lin<69>涨<EFBFBD><E6B6A8><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD>ֽڣ<D6BD>
|
||||
uint8_t checksum; //У<><D0A3><EFBFBD><EFBFBD>
|
||||
}lin_msg_struct;
|
||||
#pragma pack()
|
||||
|
||||
void lin_init(void);
|
||||
uint8_t rx_ring_buffer_get_lin_msg(lin_msg_struct * p_lin_msg);
|
||||
void USART3_IRQHandler(void);
|
||||
#endif
|
||||
Reference in New Issue
Block a user