63 lines
1.4 KiB
C
63 lines
1.4 KiB
C
//
|
|
// Created by cfif on 17.11.22.
|
|
//
|
|
|
|
#ifndef LIN_FLAGCHIP_H
|
|
#define LIN_FLAGCHIP_H
|
|
|
|
#include "LinIO.h"
|
|
#include "cmsis_os2.h"
|
|
#include "fc7xxx_driver_adc.h"
|
|
#include "fc7xxx_driver_pcc.h"
|
|
#include "interrupt_manager.h"
|
|
#include "fc7xxx_driver_lin.h"
|
|
|
|
// LIN protocol ID definition
|
|
#define LIN_MASTER_SEND_ID (0x3FU)
|
|
#define LIN_MASTER_RECEIVE_ID (0x02U)
|
|
#define LIN_MASTER_GO_TO_SLEEP_ID (0x03U)
|
|
|
|
typedef void (*lin_callback_ext_t)(tLinData *env, uint8_t u8LinIndex, void *linState);
|
|
|
|
typedef struct {
|
|
|
|
FCUART_Type *UART;
|
|
|
|
uint8_t UART_INDEX;
|
|
|
|
tLinData linData;
|
|
|
|
lin_config_t g_linMasterConfig;
|
|
lin_xfer_state_t g_xferMasterState;
|
|
|
|
lin_callback_ext_t LinExtCallbackHandler;
|
|
void *envCallExtBack;
|
|
|
|
} tLinFlagchip;
|
|
|
|
void LIN_Initial(
|
|
tLinFlagchip *env,
|
|
FCUART_Type *uart,
|
|
uint32_t BoundRate,
|
|
|
|
uint8 UART_INDEX, // UART0 = 0 ... UART7 = 7
|
|
IRQn_Type IRQ_UART, // FCUART0_IRQn ... FCUART7_IRQn
|
|
uint8 UART_PRIORITY,
|
|
|
|
lin_get_interval_time_t LIN_TimerGetTimeIntervalValue,
|
|
lin_callback_t LinCallbackHandler,
|
|
lin_callback_ext_t LinExtCallbackHandler,
|
|
void *envCallExtBack,
|
|
|
|
const uint8_t *classicPID,
|
|
uint8_t numOfClassicPID
|
|
);
|
|
|
|
void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state);
|
|
|
|
void Get_LIN_Result(tLinFlagchip *env);
|
|
|
|
tLinIO vLinGetIo(tLinFlagchip *env);
|
|
|
|
#endif //LIN_FLAGCHIP_H
|