This commit is contained in:
cfif 2026-06-01 10:11:45 +03:00
parent 915198c636
commit 167e9a5b4e
2 changed files with 248 additions and 14 deletions

View File

@ -6,11 +6,14 @@
tSerialLinPorts SERIAL_LIN_PORTS;
//начало--------------------------------- Настройка порта LIN1 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN1 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN1 ---------------------------------------------------------
void UART4_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN1_UART4);
}
// Настройка порта
static void vSerialPort_InitUSART4(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
@ -41,13 +44,244 @@ static void vSerialPort_InitUSART4(tSerialPortLinArtery *env) {
0
);
}
//конец--------------------------------- Настройка порта LIN1 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN1 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN1 ----------------------------------------------------------
//начало--------------------------------- Настройка порта LIN2 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN2 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN2 ---------------------------------------------------------
void UART5_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN2_UART5);
}
static void vSerialPort_InitUART5(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
gpio_default_para_init(&GPIO_InitStruct);
GPIO_InitStruct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
GPIO_InitStruct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
GPIO_InitStruct.gpio_mode = GPIO_MODE_MUX;
GPIO_InitStruct.gpio_pins = GPIO_PINS_11;
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOE, &GPIO_InitStruct);
GPIO_InitStruct.gpio_pins = GPIO_PINS_10;
gpio_init(GPIOE, &GPIO_InitStruct);
gpio_pin_mux_config(GPIOE, GPIO_PINS_SOURCE11, GPIO_MUX_8);
gpio_pin_mux_config(GPIOE, GPIO_PINS_SOURCE10, GPIO_MUX_8);
vSerialPortLinInit(
env,
UART5,
false,
9600,
UART5_IRQn,
CRM_UART5_PERIPH_CLOCK,
0xFF,
16,
0
);
}
//конец--------------------------------- Настройка порта LIN2 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN2 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN2 ----------------------------------------------------------
//начало--------------------------------- Настройка порта LIN3 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN3 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN3 ---------------------------------------------------------
void USART6_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN3_USART6);
}
static void vSerialPort_InitUSART6(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
gpio_default_para_init(&GPIO_InitStruct);
GPIO_InitStruct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
GPIO_InitStruct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
GPIO_InitStruct.gpio_mode = GPIO_MODE_MUX;
GPIO_InitStruct.gpio_pins = GPIO_PINS_7;
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.gpio_pins = GPIO_PINS_4;
gpio_init(GPIOA, &GPIO_InitStruct);
gpio_pin_mux_config(GPIOC, GPIO_PINS_SOURCE7, GPIO_MUX_8);
gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE4, GPIO_MUX_8);
vSerialPortLinInit(
env,
USART6,
false,
9600,
USART6_IRQn,
CRM_USART6_PERIPH_CLOCK,
0xFF,
16,
0
);
}
//конец--------------------------------- Настройка порта LIN3 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN3 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN3 ----------------------------------------------------------
//начало--------------------------------- Настройка порта LIN4 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN4 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN4 ---------------------------------------------------------
void UART7_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN4_UART7);
}
static void vSerialPort_InitUART7(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
gpio_default_para_init(&GPIO_InitStruct);
GPIO_InitStruct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
GPIO_InitStruct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
GPIO_InitStruct.gpio_mode = GPIO_MODE_MUX;
GPIO_InitStruct.gpio_pins = GPIO_PINS_6;
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOF, &GPIO_InitStruct);
GPIO_InitStruct.gpio_pins = GPIO_PINS_7;
gpio_init(GPIOF, &GPIO_InitStruct);
gpio_pin_mux_config(GPIOF, GPIO_PINS_SOURCE6, GPIO_MUX_8);
gpio_pin_mux_config(GPIOF, GPIO_PINS_SOURCE7, GPIO_MUX_8);
vSerialPortLinInit(
env,
UART7,
false,
9600,
UART7_IRQn,
CRM_UART7_PERIPH_CLOCK,
0xFF,
16,
0
);
}
//конец--------------------------------- Настройка порта LIN4 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN4 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN4 ----------------------------------------------------------
//начало--------------------------------- Настройка порта LIN5 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN5 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN5 ---------------------------------------------------------
void UART8_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN5_UART8);
}
static void vSerialPort_InitUART8(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
gpio_default_para_init(&GPIO_InitStruct);
GPIO_InitStruct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
GPIO_InitStruct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
GPIO_InitStruct.gpio_mode = GPIO_MODE_MUX;
GPIO_InitStruct.gpio_pins = GPIO_PINS_3;
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.gpio_pins = GPIO_PINS_2;
gpio_init(GPIOC, &GPIO_InitStruct);
gpio_pin_mux_config(GPIOC, GPIO_PINS_SOURCE3, GPIO_MUX_8);
gpio_pin_mux_config(GPIOC, GPIO_PINS_SOURCE2, GPIO_MUX_8);
vSerialPortLinInit(
env,
UART8,
false,
9600,
UART8_IRQn,
CRM_UART8_PERIPH_CLOCK,
0xFF,
16,
0
);
}
//конец--------------------------------- Настройка порта LIN5 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN5 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN5 ----------------------------------------------------------
//начало--------------------------------- Настройка порта LIN6 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN6 ---------------------------------------------------------
//начало--------------------------------- Настройка порта LIN6 ---------------------------------------------------------
void USART1_IRQHandler(void) {
SerialPort_IrqProcessing_UartLin(&SERIAL_LIN_PORTS.LIN6_USART1);
}
static void vSerialPort_InitUSART1(tSerialPortLinArtery *env) {
gpio_init_type GPIO_InitStruct;
gpio_default_para_init(&GPIO_InitStruct);
GPIO_InitStruct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
GPIO_InitStruct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
GPIO_InitStruct.gpio_mode = GPIO_MODE_MUX;
GPIO_InitStruct.gpio_pins = GPIO_PINS_3;
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
gpio_init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.gpio_pins = GPIO_PINS_6;
gpio_init(GPIOB, &GPIO_InitStruct);
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE3, GPIO_MUX_7);
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE6, GPIO_MUX_7);
vSerialPortLinInit(
env,
USART1,
false,
9600,
USART1_IRQn,
CRM_USART1_PERIPH_CLOCK,
0xFF,
16,
0
);
}
//конец--------------------------------- Настройка порта LIN6 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN6 ----------------------------------------------------------
//конец--------------------------------- Настройка порта LIN6 ----------------------------------------------------------
void SerialLinPorts_Init() {
tSerialLinPorts *env = &SERIAL_LIN_PORTS;
// LIN5
// LIN1 (LIN5)
vSerialPort_InitUSART4(&env->LIN1_UART4);
SERIAL_LIN_PORTS.LIN1_UART4_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN1_UART4);
// LIN2
vSerialPort_InitUART5(&env->LIN2_UART5);
SERIAL_LIN_PORTS.LIN2_UART5_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN2_UART5);
// LIN3
vSerialPort_InitUSART6(&env->LIN3_USART6);
SERIAL_LIN_PORTS.LIN3_USART6_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN3_USART6);
// LIN4
vSerialPort_InitUART7(&env->LIN4_UART7);
SERIAL_LIN_PORTS.LIN4_UART7_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN4_UART7);
// LIN5
vSerialPort_InitUART8(&env->LIN5_UART8);
SERIAL_LIN_PORTS.LIN5_UART8_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN5_UART8);
// LIN6
vSerialPort_InitUSART1(&env->LIN6_USART1);
SERIAL_LIN_PORTS.LIN6_USART1_IO = vSerialPorLinGetIo(&SERIAL_LIN_PORTS.LIN6_USART1);
}

View File

@ -13,22 +13,22 @@ typedef struct {
tSerialPortLinArtery LIN1_UART4;
tSerialPortLinIO LIN1_UART4_IO;
/*
tSerialPortArtery LIN2_UART5;
tSerialPortIO LIN2_UART5_IO;
tSerialPortArtery LIN3_USART6;
tSerialPortIO LIN3_USART6_IO;
tSerialPortLinArtery LIN2_UART5;
tSerialPortLinIO LIN2_UART5_IO;
tSerialPortArtery LIN4_UART7;
tSerialPortIO LIN4_UART7_IO;
tSerialPortLinArtery LIN3_USART6;
tSerialPortLinIO LIN3_USART6_IO;
tSerialPortArtery LIN5_UART8;
tSerialPortIO LIN5_UART8_IO;
tSerialPortLinArtery LIN4_UART7;
tSerialPortLinIO LIN4_UART7_IO;
tSerialPortLinArtery LIN5_UART8;
tSerialPortLinIO LIN5_UART8_IO;
tSerialPortLinArtery LIN6_USART1;
tSerialPortLinIO LIN6_USART1_IO;
tSerialPortArtery LIN6_USART1;
tSerialPortIO LIN6_USART1_IO;
*/
} tSerialLinPorts;