Init
This commit is contained in:
parent
8bc4d26df5
commit
9903a989f7
|
|
@ -62,12 +62,12 @@ void USART2_IRQHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// RX
|
// RX
|
||||||
void DMA1_Channel7_IRQHandler(void) {
|
void DMA1_Channel3_IRQHandler(void) {
|
||||||
SerialPort_IrqProcessing_DmaRxLoop(&SERIAL_PORTS.Rs485_USART2);
|
SerialPort_IrqProcessing_DmaRxLoop(&SERIAL_PORTS.Rs485_USART2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TX
|
// TX
|
||||||
void DMA2_Channel7_IRQHandler(void) {
|
void DMA1_Channel4_IRQHandler(void) {
|
||||||
SerialPort_IrqProcessing_DmaTx(&SERIAL_PORTS.Rs485_USART2);
|
SerialPort_IrqProcessing_DmaTx(&SERIAL_PORTS.Rs485_USART2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ static void vSerialPort_InitUSART2(tSerialPortArtery *env) {
|
||||||
|
|
||||||
vSerialPortInitDmaWithNameAndSniffer(
|
vSerialPortInitDmaWithNameAndSniffer(
|
||||||
env, USART2, 115200,
|
env, USART2, 115200,
|
||||||
1, 7, 2, 7,
|
1, 3, 1, 4,
|
||||||
false, 0xFF,
|
false, 0xFF,
|
||||||
buf_USART2_DMA, sizeof(buf_USART2_DMA),
|
buf_USART2_DMA, sizeof(buf_USART2_DMA),
|
||||||
1024, 0
|
1024, 0
|
||||||
|
|
@ -97,79 +97,9 @@ static void vSerialPort_InitUSART2(tSerialPortArtery *env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
uint8_t buf_UART4_DMA[256];
|
|
||||||
|
|
||||||
// IDLE прерывание
|
|
||||||
void USART4_IRQHandler() {
|
|
||||||
SerialPort_IrqProcessing_UartIdle(&SERIAL_PORTS.LIN1_UART4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// RX
|
|
||||||
void DMA1_Channel3_IRQHandler(void) {
|
|
||||||
SerialPort_IrqProcessing_DmaRxLoop(&SERIAL_PORTS.LIN1_UART4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TX
|
|
||||||
void DMA1_Channel4_IRQHandler(void) {
|
|
||||||
SerialPort_IrqProcessing_DmaTx(&SERIAL_PORTS.LIN1_UART4);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void UART4_IRQHandler(void) {
|
|
||||||
SerialPort_IrqProcessing_UartLin(&SERIAL_PORTS.LIN1_UART4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Настройка порта
|
|
||||||
static void vSerialPort_InitUSART4(tSerialPortArtery *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_1;
|
|
||||||
GPIO_InitStruct.gpio_pull = GPIO_PULL_NONE;
|
|
||||||
gpio_init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.gpio_pins = GPIO_PINS_0;
|
|
||||||
gpio_init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE1, GPIO_MUX_8);
|
|
||||||
gpio_pin_mux_config(GPIOA, GPIO_PINS_SOURCE0, GPIO_MUX_8);
|
|
||||||
/*
|
|
||||||
vSerialPortInitDmaWithNameAndSniffer(
|
|
||||||
env, UART4, 9600,
|
|
||||||
1, 3, 1, 4,
|
|
||||||
false, 0xFF,
|
|
||||||
buf_UART4_DMA, sizeof(buf_UART4_DMA),
|
|
||||||
256, 0
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
vSerialPortLinInit(
|
|
||||||
env,
|
|
||||||
UART4,
|
|
||||||
false,
|
|
||||||
9600,
|
|
||||||
UART4_IRQn,
|
|
||||||
CRM_UART4_PERIPH_CLOCK,
|
|
||||||
0xFF,
|
|
||||||
16,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SerialPorts_Init(tRs485DirectionPins *directionPins) {
|
void SerialPorts_Init(tRs485DirectionPins *directionPins) {
|
||||||
tSerialPorts *env = &SERIAL_PORTS;
|
tSerialPorts *env = &SERIAL_PORTS;
|
||||||
|
|
||||||
// LIN5
|
|
||||||
vSerialPort_InitUSART4(&env->LIN1_UART4);
|
|
||||||
SERIAL_PORTS.LIN1_UART4_IO = vSerialPortGetIo(&SERIAL_PORTS.LIN1_UART4);
|
|
||||||
|
|
||||||
|
|
||||||
vSerialPort_InitUSART3(&env->DEBUG_USART3);
|
vSerialPort_InitUSART3(&env->DEBUG_USART3);
|
||||||
SERIAL_PORTS.DEBUG_USART3_IO = vSerialPortGetIo(&SERIAL_PORTS.DEBUG_USART3);
|
SERIAL_PORTS.DEBUG_USART3_IO = vSerialPortGetIo(&SERIAL_PORTS.DEBUG_USART3);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,24 +27,6 @@ typedef struct {
|
||||||
// tSerialPortIO Rs232_IO;
|
// tSerialPortIO Rs232_IO;
|
||||||
|
|
||||||
|
|
||||||
tSerialPortArtery LIN1_UART4;
|
|
||||||
tSerialPortIO LIN1_UART4_IO;
|
|
||||||
/*
|
|
||||||
tSerialPortArtery LIN2_UART5;
|
|
||||||
tSerialPortIO LIN2_UART5_IO;
|
|
||||||
|
|
||||||
tSerialPortArtery LIN3_USART6;
|
|
||||||
tSerialPortIO LIN3_USART6_IO;
|
|
||||||
|
|
||||||
tSerialPortArtery LIN4_UART7;
|
|
||||||
tSerialPortIO LIN4_UART7_IO;
|
|
||||||
|
|
||||||
tSerialPortArtery LIN5_UART8;
|
|
||||||
tSerialPortIO LIN5_UART8_IO;
|
|
||||||
|
|
||||||
tSerialPortArtery LIN6_USART1;
|
|
||||||
tSerialPortIO LIN6_USART1_IO;
|
|
||||||
*/
|
|
||||||
tSerialPortArtery DEBUG_USART3;
|
tSerialPortArtery DEBUG_USART3;
|
||||||
tSerialPortIO DEBUG_USART3_IO;
|
tSerialPortIO DEBUG_USART3_IO;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue