Init
This commit is contained in:
commit
7aee7e7249
|
|
@ -0,0 +1,55 @@
|
||||||
|
//
|
||||||
|
// Created by cfif on 05.05.23.
|
||||||
|
//
|
||||||
|
#include "SerialLinPorts.h"
|
||||||
|
#include "at32f435_437.h"
|
||||||
|
|
||||||
|
tSerialLinPorts SERIAL_LIN_PORTS;
|
||||||
|
|
||||||
|
/*
|
||||||
|
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);
|
||||||
|
|
||||||
|
vSerialPortLinInit(
|
||||||
|
env,
|
||||||
|
UART4,
|
||||||
|
false,
|
||||||
|
9600,
|
||||||
|
UART4_IRQn,
|
||||||
|
CRM_UART4_PERIPH_CLOCK,
|
||||||
|
0xFF,
|
||||||
|
16,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SerialLinPorts_Init() {
|
||||||
|
tSerialLinPorts *env = &SERIAL_LIN_PORTS;
|
||||||
|
|
||||||
|
// LIN5
|
||||||
|
vSerialPort_InitUSART4(&env->LIN1_UART4);
|
||||||
|
SERIAL_LIN_PORTS.LIN1_UART4_IO = vSerialPortGetIo(&SERIAL_LIN_PORTS.LIN1_UART4);
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// Created by cfif on 05.05.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef WATER_BOX_BSD_SERIALPORTSLIN_H
|
||||||
|
#define WATER_BOX_BSD_SERIALPORTSLIN_H
|
||||||
|
|
||||||
|
#include "SerialPortArtery.h"
|
||||||
|
#include "GpioPin.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/*
|
||||||
|
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;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
} tSerialLinPorts;
|
||||||
|
|
||||||
|
extern tSerialLinPorts SERIAL_LIN_PORTS;
|
||||||
|
|
||||||
|
#endif //WATER_BOX_BSD_SERIALPORTSLIN_H
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue