Обновление
This commit is contained in:
parent
1ceff47557
commit
32b49bf18b
|
|
@ -17,18 +17,21 @@
|
||||||
#define LIN_MASTER_RECEIVE_ID (0x02U)
|
#define LIN_MASTER_RECEIVE_ID (0x02U)
|
||||||
#define LIN_MASTER_GO_TO_SLEEP_ID (0x03U)
|
#define LIN_MASTER_GO_TO_SLEEP_ID (0x03U)
|
||||||
|
|
||||||
|
typedef void (*lin_callback_ext_t)(tLinData *env, uint8_t u8LinIndex, void *linState);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
uint8_t UART_INDEX;
|
|
||||||
FCUART_Type *UART;
|
FCUART_Type *UART;
|
||||||
|
|
||||||
osMessageQueueId_t rxDataQueue;
|
uint8_t UART_INDEX;
|
||||||
|
|
||||||
|
tLinData linData;
|
||||||
|
|
||||||
lin_config_t g_linMasterConfig;
|
lin_config_t g_linMasterConfig;
|
||||||
lin_xfer_state_t g_xferMasterState;
|
lin_xfer_state_t g_xferMasterState;
|
||||||
|
|
||||||
uint8_t g_aTxBuffer[8];
|
lin_callback_ext_t LinExtCallbackHandler;
|
||||||
uint8_t g_aRxBuffer[8];
|
void *envCallExtBack;
|
||||||
|
|
||||||
} tLinFlagchip;
|
} tLinFlagchip;
|
||||||
|
|
||||||
|
|
@ -42,7 +45,9 @@ void LIN_Initial(
|
||||||
uint8 UART_PRIORITY,
|
uint8 UART_PRIORITY,
|
||||||
|
|
||||||
lin_get_interval_time_t LIN_TimerGetTimeIntervalValue,
|
lin_get_interval_time_t LIN_TimerGetTimeIntervalValue,
|
||||||
lin_callback_t LinCallbackHandler
|
lin_callback_t LinCallbackHandler,
|
||||||
|
lin_callback_ext_t LinExtCallbackHandler,
|
||||||
|
void *envCallExtBack
|
||||||
);
|
);
|
||||||
|
|
||||||
void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state);
|
void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ static const PCC_ClkSrcType s_ePccUartTable[] =
|
||||||
PCC_CLK_FCUART6,
|
PCC_CLK_FCUART6,
|
||||||
PCC_CLK_FCUART7
|
PCC_CLK_FCUART7
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state) {
|
void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state) {
|
||||||
lin_xfer_state_t *pXferState = state;
|
lin_xfer_state_t *pXferState = state;
|
||||||
//uint32_t s_countIndex = 0U;
|
//uint32_t s_countIndex = 0U;
|
||||||
|
|
@ -106,7 +106,7 @@ void GetLinCallbackHandler(tLinFlagchip *env, uint8_t u8LinIndex, void *state) {
|
||||||
|
|
||||||
osMessageQueuePut(env->rxDataQueue, (uint8_t *) &pXferState->currentEventId, 0x0, 0U);
|
osMessageQueuePut(env->rxDataQueue, (uint8_t *) &pXferState->currentEventId, 0x0, 0U);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void LIN_Initial(
|
void LIN_Initial(
|
||||||
tLinFlagchip *env,
|
tLinFlagchip *env,
|
||||||
|
|
@ -118,13 +118,18 @@ void LIN_Initial(
|
||||||
uint8 UART_PRIORITY,
|
uint8 UART_PRIORITY,
|
||||||
|
|
||||||
lin_get_interval_time_t LIN_TimerGetTimeIntervalValue,
|
lin_get_interval_time_t LIN_TimerGetTimeIntervalValue,
|
||||||
lin_callback_t LinCallbackHandler
|
lin_callback_t LinCallbackHandler,
|
||||||
|
lin_callback_ext_t LinExtCallbackHandler,
|
||||||
|
void *envCallExtBack
|
||||||
) {
|
) {
|
||||||
|
|
||||||
env->UART_INDEX = UART_INDEX;
|
env->UART_INDEX = UART_INDEX;
|
||||||
env->UART = uart;
|
env->UART = uart;
|
||||||
env->rxDataQueue = osMessageQueueNew(1, 1, NULL);
|
|
||||||
|
|
||||||
|
env->linData.rxDataQueue = osMessageQueueNew(1, 1, NULL);
|
||||||
|
|
||||||
|
env->LinExtCallbackHandler = LinExtCallbackHandler;
|
||||||
|
env->envCallExtBack = envCallExtBack;
|
||||||
|
|
||||||
LIN_DrvGetDefaultConfig(LIN_NODE_MASTER, &env->g_linMasterConfig);
|
LIN_DrvGetDefaultConfig(LIN_NODE_MASTER, &env->g_linMasterConfig);
|
||||||
env->g_linMasterConfig.baudRate = BoundRate;
|
env->g_linMasterConfig.baudRate = BoundRate;
|
||||||
|
|
@ -149,7 +154,7 @@ static uint8_t vLinRunCommand(tLinFlagchip *env, uint8_t command, uint32_t timeo
|
||||||
LIN_DrvSendHeader(env->UART_INDEX, command);
|
LIN_DrvSendHeader(env->UART_INDEX, command);
|
||||||
|
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
if (osMessageQueueGet(env->rxDataQueue, &state, NULL, timeout) == osOK) {
|
if (osMessageQueueGet(env->linData.rxDataQueue, &state, NULL, timeout) == osOK) {
|
||||||
lin_event_id_t id = state;
|
lin_event_id_t id = state;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue