Обновление
This commit is contained in:
parent
4fa7491ae6
commit
6101d47316
31
Lins.c
31
Lins.c
|
|
@ -8,7 +8,9 @@
|
||||||
|
|
||||||
tLinPorts LIN_PORTS;
|
tLinPorts LIN_PORTS;
|
||||||
|
|
||||||
const uint8_t classicPID[20] = {
|
#define numOfClassicPID 20
|
||||||
|
|
||||||
|
const uint8_t classicPID[numOfClassicPID] = {
|
||||||
CFR_INI,
|
CFR_INI,
|
||||||
CFR_SET,
|
CFR_SET,
|
||||||
CFR_MOD,
|
CFR_MOD,
|
||||||
|
|
@ -30,7 +32,7 @@ const uint8_t classicPID[20] = {
|
||||||
DFR_IDE,
|
DFR_IDE,
|
||||||
RFR_IDE
|
RFR_IDE
|
||||||
};
|
};
|
||||||
#define numOfClassicPID 20
|
|
||||||
|
|
||||||
static void Lin0CallbackHandler(uint8_t u8LinIndex, void *state) {
|
static void Lin0CallbackHandler(uint8_t u8LinIndex, void *state) {
|
||||||
LIN_PORTS.lin0.LinExtCallbackHandler(LIN_PORTS.lin0.envCallExtBack, u8LinIndex, state);
|
LIN_PORTS.lin0.LinExtCallbackHandler(LIN_PORTS.lin0.envCallExtBack, u8LinIndex, state);
|
||||||
|
|
@ -40,15 +42,14 @@ void FCUART4_RxTx_IRQHandler(void) {
|
||||||
LIN_DrvIRQHandler(LIN_PORTS.lin0.UART_INDEX);
|
LIN_DrvIRQHandler(LIN_PORTS.lin0.UART_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
tLinData *Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler,
|
tLinData *Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler) {
|
||||||
void *Lin_envCallExtBack) {
|
|
||||||
|
|
||||||
tLinPorts *env = &LIN_PORTS;
|
tLinPorts *env = &LIN_PORTS;
|
||||||
|
|
||||||
PORT_InitType tInitStruct = {0};
|
PORT_InitType tInitStruct = {0};
|
||||||
GPIO_InitType tGpioInitStruct = {0};
|
GPIO_InitType tGpioInitStruct = {0};
|
||||||
|
|
||||||
/* Port D12: MUX = ALT3, UART4_RX */
|
// Port D12: MUX = ALT3, UART4_RX
|
||||||
tInitStruct.u32PortPins = PORT_PIN_12;
|
tInitStruct.u32PortPins = PORT_PIN_12;
|
||||||
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_12_FCUART4_RX;
|
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_12_FCUART4_RX;
|
||||||
tInitStruct.bPullEn = true;
|
tInitStruct.bPullEn = true;
|
||||||
|
|
@ -59,7 +60,7 @@ tLinData *Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler,
|
||||||
tGpioInitStruct.ePinDirection = GPIO_IN;
|
tGpioInitStruct.ePinDirection = GPIO_IN;
|
||||||
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||||
|
|
||||||
/* Port D5: MUX = ALT3, UART4_TX */
|
// Port D5: MUX = ALT3, UART4_TX
|
||||||
tInitStruct.u32PortPins = PORT_PIN_5;
|
tInitStruct.u32PortPins = PORT_PIN_5;
|
||||||
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_5_FCUART4_TX;
|
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_5_FCUART4_TX;
|
||||||
PORT_InitPins(PORT_D, &tInitStruct);
|
PORT_InitPins(PORT_D, &tInitStruct);
|
||||||
|
|
@ -69,15 +70,15 @@ tLinData *Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler,
|
||||||
tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
||||||
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||||
|
|
||||||
/* Port D18: MUX = GPIO output */
|
// Port D18: MUX = GPIO output ENABLE
|
||||||
//tInitStruct.u32PortPins = PORT_PIN_18;
|
tInitStruct.u32PortPins = PORT_PIN_18;
|
||||||
//tInitStruct.uPortPinMux.u32PortPinMode = PORT_GPIO_MODE;
|
tInitStruct.uPortPinMux.u32PortPinMode = PORT_GPIO_MODE;
|
||||||
//PORT_InitPins(PORT_D, &tInitStruct);
|
PORT_InitPins(PORT_D, &tInitStruct);
|
||||||
|
|
||||||
//tGpioInitStruct.u32GpioPins = GPIO_PIN_18;
|
tGpioInitStruct.u32GpioPins = GPIO_PIN_18;
|
||||||
//tGpioInitStruct.ePinDirection = GPIO_OUT;
|
tGpioInitStruct.ePinDirection = GPIO_OUT;
|
||||||
//tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
||||||
//GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||||
|
|
||||||
LIN_Initial(
|
LIN_Initial(
|
||||||
&env->lin0,
|
&env->lin0,
|
||||||
|
|
@ -91,7 +92,7 @@ tLinData *Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler,
|
||||||
NULL,
|
NULL,
|
||||||
Lin0CallbackHandler,
|
Lin0CallbackHandler,
|
||||||
Lin_ExtCallbackHandler,
|
Lin_ExtCallbackHandler,
|
||||||
Lin_envCallExtBack,
|
&env->lin0.linData,
|
||||||
|
|
||||||
classicPID,
|
classicPID,
|
||||||
numOfClassicPID
|
numOfClassicPID
|
||||||
|
|
|
||||||
3
Lins.h
3
Lins.h
|
|
@ -42,7 +42,6 @@ typedef struct {
|
||||||
|
|
||||||
extern tLinPorts LIN_PORTS;
|
extern tLinPorts LIN_PORTS;
|
||||||
|
|
||||||
tLinData* Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler,
|
tLinData* Lin0_Init(lin_callback_ext_t Lin_ExtCallbackHandler);
|
||||||
void *Lin_envCallExtBack);
|
|
||||||
|
|
||||||
#endif //FLAG_LINS_H
|
#endif //FLAG_LINS_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue