Обновление
This commit is contained in:
commit
9d49933faf
|
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// Created by Cfif on 14.12.23.
|
||||
//
|
||||
#include <stdbool.h>
|
||||
#include "fc7xxx_driver_port.h"
|
||||
#include "fc7xxx_driver_gpio.h"
|
||||
#include "Lins.h"
|
||||
|
||||
tLins LINS;
|
||||
|
||||
void LinCallbackHandler(uint8_t u8LinIndex, void *state) {
|
||||
GetLinCallbackHandler(&LINS.lin, u8LinIndex, state);
|
||||
}
|
||||
|
||||
void FCUART4_RxTx_IRQHandler(void) {
|
||||
LIN_DrvIRQHandler(LINS.lin.UART_INDEX);
|
||||
}
|
||||
|
||||
void Lins_Init() {
|
||||
tLins *env = &LINS;
|
||||
|
||||
PORT_InitType tInitStruct = {0};
|
||||
GPIO_InitType tGpioInitStruct = {0};
|
||||
|
||||
/* Port D12: MUX = ALT3, UART4_RX */
|
||||
tInitStruct.u32PortPins = PORT_PIN_12;
|
||||
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_12_FCUART4_RX;
|
||||
tInitStruct.bPullEn = true;
|
||||
tInitStruct.ePullSel = PORT_PULL_UP;
|
||||
PORT_InitPins(PORT_D, &tInitStruct);
|
||||
|
||||
tGpioInitStruct.u32GpioPins = GPIO_PIN_12;
|
||||
tGpioInitStruct.ePinDirection = GPIO_IN;
|
||||
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||
|
||||
/* Port D5: MUX = ALT3, UART4_TX */
|
||||
tInitStruct.u32PortPins = PORT_PIN_5;
|
||||
tInitStruct.uPortPinMux.u32PortPinMode = PORTD_5_FCUART4_TX;
|
||||
PORT_InitPins(PORT_D, &tInitStruct);
|
||||
|
||||
tGpioInitStruct.u32GpioPins = GPIO_PIN_5;
|
||||
tGpioInitStruct.ePinDirection = GPIO_OUT;
|
||||
tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
||||
GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||
|
||||
/* Port D18: MUX = GPIO output */
|
||||
//tInitStruct.u32PortPins = PORT_PIN_18;
|
||||
//tInitStruct.uPortPinMux.u32PortPinMode = PORT_GPIO_MODE;
|
||||
//PORT_InitPins(PORT_D, &tInitStruct);
|
||||
|
||||
//tGpioInitStruct.u32GpioPins = GPIO_PIN_18;
|
||||
//tGpioInitStruct.ePinDirection = GPIO_OUT;
|
||||
//tGpioInitStruct.ePinLevel = GPIO_HIGH;
|
||||
//GPIO_InitPins(GPIO_D, &tGpioInitStruct);
|
||||
|
||||
LIN_Initial(
|
||||
&env->lin,
|
||||
FCUART4,
|
||||
19200,
|
||||
|
||||
4, // UART0 = 0 ... UART7 = 7
|
||||
FCUART4_IRQn, // FCUART0_IRQn ... FCUART7_IRQn
|
||||
0xFF,
|
||||
|
||||
NULL,
|
||||
LinCallbackHandler
|
||||
);
|
||||
|
||||
env->linIo = vLinGetIo(&env->lin);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Created by ilya on 14.12.23.
|
||||
//
|
||||
|
||||
#ifndef FLAG_LINS_H
|
||||
#define FLAG_LINS_H
|
||||
|
||||
#include "LinFlagchip.h"
|
||||
|
||||
typedef struct {
|
||||
tLinFlagchip lin;
|
||||
tLinIO linIo;
|
||||
} tLins;
|
||||
|
||||
extern tLins LINS;
|
||||
|
||||
void Lins_Init();
|
||||
|
||||
#endif //FLAG_LINS_H
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"dep": [
|
||||
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"./"
|
||||
],
|
||||
"srcs": [
|
||||
"./**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue