/**
|
******************************************************************************
|
* @file : BSP.c
|
* @brief : Board Speciafic program
|
******************************************************************************
|
*
|
******************************************************************************
|
*/
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "BSP.h"
|
|
#include "Globaldef.h"
|
#include "Functions.h"
|
#if (BOARD_TYPE == 14)
|
#include "fp0.h"
|
#endif
|
|
/*
|
if ((nCurTick &0xff) ==0)
|
{
|
if (freqdir) { freq+=1+freq/10;if (freq>=1500) {freq=1500;freqdir=0;}}
|
else {freq-=1+freq/10;if (freq<=10) {freq=10;freqdir=1;} }
|
}
|
*/
|
|
/*
|
static int outputsum=0;
|
static int freq=10;
|
static int freqdir=1;
|
static int phase=0;
|
static int somb=0;
|
static int len=0;
|
static int curbb=0;
|
|
if ((nCurTick &0x3ff) ==1)
|
{
|
curbb++;
|
if (curbb+1==len)
|
{
|
// freq=0;
|
}else if (curbb>=len)
|
{
|
somb=musictab1[cur_musicpos*2];
|
len=musictab1[cur_musicpos*2+1];
|
freq=freqtab[somb];
|
curbb=0;cur_musicpos++; if (cur_musicpos >= Totalmusiccount) {cur_musicpos=0;}
|
}
|
}
|
if ((nCurTick &0x3ff) ==0x1ff)
|
{
|
if (curbb+1==len)
|
{
|
freq=0;
|
}
|
}
|
phase+=freq;
|
if (phase>=5000) {phase-=5000;}
|
|
|
if (outtype==1)
|
{
|
outputsum+=freq;
|
if (outputsum>=5000)
|
{
|
//LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_3);
|
LL_GPIO_TogglePin(GPIOB,LL_GPIO_PIN_3);
|
outputsum-=5000;
|
}
|
else
|
{
|
//LL_GPIO_ResetOutputPin(GPIOB,LL_GPIO_PIN_3);
|
}
|
}else if (outtype==2)
|
{
|
const int volume = 2500;
|
int amp;
|
if (phase<1250)
|
{
|
amp=2500+sintab[(phase -0)*256/1250]*volume/256;
|
|
}else if (phase <2500)
|
{
|
amp=2500+sintab[(2500-1-phase)*256/1250]*volume/256;
|
}else if (phase <3750)
|
{
|
amp=2500-sintab[(phase-2500)*256/1250]*volume/256;
|
}else
|
{
|
amp=2500-sintab[(5000-1-phase)*256/1250]*volume/256;
|
}
|
outputsum+=amp;
|
if (outputsum>=5000)
|
{
|
LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_3);
|
//LL_GPIO_TogglePin(GPIOB,LL_GPIO_PIN_3);
|
outputsum-=5000;
|
}
|
else
|
{
|
LL_GPIO_ResetOutputPin(GPIOB,LL_GPIO_PIN_3);
|
}
|
}
|
*/
|
|
|
/**
|
* @brief System Clock Configuration
|
* @retval None
|
*/
|
|
void SystemClock_Config(void)
|
{
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
/** Initializes the CPU, AHB and APB busses clocks
|
*/
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
// RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
|
#if (XLAT_FREQ == 12)
|
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV3;
|
#else
|
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;
|
#endif
|
|
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
{
|
Error_Handler();
|
}
|
/** Initializes the CPU, AHB and APB busses clocks
|
*/
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
|RCC_CLOCKTYPE_PCLK1;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
{
|
Error_Handler();
|
}
|
|
//RCC_OscInitTypeDef RCC_OscInitStruct;
|
//RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_PeriphCLKInitTypeDef PeriphClkInit;
|
|
/**Initializes the CPU, AHB and APB busses clocks
|
*/
|
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
|
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_SYSCLK;
|
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
{
|
_Error_Handler(__FILE__, __LINE__);
|
}
|
|
/**Configure the Systick interrupt time
|
*/
|
// HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000);
|
HAL_SYSTICK_Config(48000000/10000);
|
|
/**Configure the Systick
|
*/
|
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
|
/* SysTick_IRQn interrupt configuration */
|
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
|
}
|
|
void MX_IWDG_Init(void)
|
{
|
|
/* USER CODE BEGIN IWDG_Init 0 */
|
|
/* USER CODE END IWDG_Init 0 */
|
|
/* USER CODE BEGIN IWDG_Init 1 */
|
|
/* USER CODE END IWDG_Init 1 */
|
LL_IWDG_Enable(IWDG);
|
LL_IWDG_EnableWriteAccess(IWDG);
|
LL_IWDG_SetPrescaler(IWDG, LL_IWDG_PRESCALER_64);
|
LL_IWDG_SetReloadCounter(IWDG, 4095);
|
while (LL_IWDG_IsReady(IWDG) != 1)
|
{
|
}
|
|
LL_IWDG_SetWindow(IWDG, 4095);
|
LL_IWDG_ReloadCounter(IWDG);
|
/* USER CODE BEGIN IWDG_Init 2 */
|
|
/* USER CODE END IWDG_Init 2 */
|
|
}
|
/**
|
* @brief TIM6 Initialization Function
|
* @param None
|
* @retval None
|
*/
|
void MX_TIM6_Init(void)
|
{
|
|
/* USER CODE BEGIN TIM6_Init 0 */
|
|
/* USER CODE END TIM6_Init 0 */
|
|
LL_TIM_InitTypeDef TIM_InitStruct = {0};
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM6);
|
|
/* TIM6 interrupt Init */
|
NVIC_SetPriority(TIM6_IRQn, 0);
|
NVIC_EnableIRQ(TIM6_IRQn);
|
|
/* USER CODE BEGIN TIM6_Init 1 */
|
|
/* USER CODE END TIM6_Init 1 */
|
TIM_InitStruct.Prescaler = 47;
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
TIM_InitStruct.Autoreload = 999;
|
LL_TIM_Init(TIM6, &TIM_InitStruct);
|
LL_TIM_DisableARRPreload(TIM6);
|
/* USER CODE BEGIN TIM6_Init 2 */
|
LL_TIM_EnableIT_UPDATE(TIM6);
|
/* USER CODE END TIM6_Init 2 */
|
|
}
|
/* ADC init function */
|
void MX_ADC_Init(void)
|
{
|
|
LL_ADC_InitTypeDef ADC_InitStruct;
|
LL_ADC_REG_InitTypeDef ADC_REG_InitStruct;
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_ADC1);
|
|
/**Configure Regular Channel
|
*/
|
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_0|LL_ADC_CHANNEL_1);
|
|
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR|LL_ADC_PATH_INTERNAL_VREFINT);
|
|
/**Configure Regular Channel
|
*/
|
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_TEMPSENSOR|LL_ADC_CHANNEL_VREFINT);
|
|
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR|LL_ADC_PATH_INTERNAL_VREFINT);
|
|
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
*/
|
ADC_InitStruct.Clock = LL_ADC_CLOCK_ASYNC;
|
ADC_InitStruct.Resolution = LL_ADC_RESOLUTION_12B;
|
ADC_InitStruct.DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
|
ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE;
|
LL_ADC_Init(ADC1, &ADC_InitStruct);
|
|
ADC_REG_InitStruct.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
|
ADC_REG_InitStruct.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
|
ADC_REG_InitStruct.ContinuousMode = LL_ADC_REG_CONV_SINGLE;
|
ADC_REG_InitStruct.DMATransfer = LL_ADC_REG_DMA_TRANSFER_LIMITED;
|
ADC_REG_InitStruct.Overrun = LL_ADC_REG_OVR_DATA_PRESERVED;
|
LL_ADC_REG_Init(ADC1, &ADC_REG_InitStruct);
|
|
LL_ADC_REG_SetSequencerScanDirection(ADC1, LL_ADC_REG_SEQ_SCAN_DIR_FORWARD);
|
|
LL_ADC_SetSamplingTimeCommonChannels(ADC1, LL_ADC_SAMPLINGTIME_28CYCLES_5);
|
|
LL_ADC_EnableIT_EOC(ADC1);
|
|
LL_ADC_DisableIT_EOS(ADC1);
|
|
LL_ADC_StartCalibration(ADC1);
|
|
// LL_ADC_EnableInternalRegulator(ADC1);
|
|
// ADC_TempSensorCmd(ENABLE);//?????????
|
// ADC_VrefintCmd(ENABLE); //????????
|
|
|
//ADC_TempSensorCmd(ENABLE);//
|
//ADC_ChannelConfig();
|
//ADC_VrefintCmd(ENABLE); //
|
|
while( LL_ADC_IsCalibrationOnGoing(ADC1));
|
LL_ADC_Enable(ADC1);
|
/*
|
LL_ADC_REG_SetDMATransfer(ADC1,LL_ADC_REG_DMA_TRANSFER_UNLIMITED);
|
LL_ADC_REG_StartConversion(ADC1);
|
*/
|
}
|
|
/* SPI1 init function */
|
void MX_SPI1_Init(void)
|
{
|
|
LL_SPI_InitTypeDef SPI_InitStruct = {0};
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SPI1);
|
|
/**SPI1 GPIO Configuration
|
PA5 ------> SPI1_SCK
|
PA6 ------> SPI1_MISO
|
PA7 ------> SPI1_MOSI
|
*/
|
// GPIO_InitStruct.Pin = LL_GPIO_PIN_5;
|
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
// GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
// GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
/**SPI1 GPIO Configuration
|
PB3 ------> SPI1_SCK
|
PB4 ------> SPI1_MISO
|
PB5 ------> SPI1_MOSI
|
*/
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_5;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
/* SPI1 interrupt Init */
|
NVIC_SetPriority(SPI1_IRQn, 0);
|
// NVIC_EnableIRQ(SPI1_IRQn);
|
/* USER CODE BEGIN SPI1_Init 1 */
|
|
#if (BOARD_TYPE == 13)
|
|
NVIC_EnableIRQ(SPI1_IRQn);
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_HIGH; //LL_SPI_POLARITY_LOW;
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE;
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
|
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
SPI_InitStruct.CRCPoly = 7;
|
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
|
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
|
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
// LL_SPI_EnableNSSPulseMgt(SPI1);
|
|
#elif (BOARD_TYPE == 14)
|
|
NVIC_EnableIRQ(SPI1_IRQn);
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
SPI_InitStruct.Mode = LL_SPI_MODE_SLAVE;
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_LOW;
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE;
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
|
SPI_InitStruct.BitOrder = LL_SPI_LSB_FIRST;
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
SPI_InitStruct.CRCPoly = 7;
|
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
|
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
LL_SPI_DisableNSSPulseMgt(SPI1);
|
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
// LL_SPI_EnableNSSPulseMgt(SPI1);
|
|
#else
|
|
/* USER CODE END SPI1_Init 1 */
|
|
/* SPI1 parameter configuration*/
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
|
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
SPI_InitStruct.CRCPoly = 7;
|
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
|
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
|
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
// LL_SPI_EnableNSSPulseMgt(SPI1);
|
|
/* USER CODE BEGIN SPI1_Init 2 */
|
|
#endif
|
|
LL_SPI_Enable(SPI1);
|
/* USER CODE END SPI1_Init 2 */
|
}
|
|
/* SPI2 init function */
|
void MX_SPI2_Init(void)
|
{
|
|
LL_SPI_InitTypeDef SPI_InitStruct = {0};
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2);
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
/**SPI2 GPIO Configuration
|
PB13 ------> SPI2_SCK
|
PB14 ------> SPI2_MISO
|
PB15 ------> SPI2_MOSI
|
*/
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_13;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_14;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
/* SPI2 interrupt Init */
|
//NVIC_SetPriority(SPI2_IRQn, 0);
|
//NVIC_EnableIRQ(SPI2_IRQn);
|
/* USER CODE BEGIN SPI2_Init 1 */
|
|
/* USER CODE END SPI2_Init 1 */
|
|
/* SPI2 parameter configuration*/
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_HIGH;//LL_SPI_POLARITY_LOW;
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; //LL_SPI_PHASE_1EDGE;
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
|
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
SPI_InitStruct.CRCPoly = 7;
|
LL_SPI_Init(SPI2, &SPI_InitStruct);
|
LL_SPI_SetStandard(SPI2, LL_SPI_PROTOCOL_MOTOROLA);
|
LL_SPI_EnableNSSPulseMgt(SPI2);
|
/* USER CODE BEGIN SP21_Init 2 */
|
LL_SPI_Enable(SPI2);
|
/* USER CODE END SPI2_Init 2 */
|
}
|
|
|
/* USART1 init function */
|
void MX_USART1_UART_Init(void)
|
{
|
|
LL_USART_InitTypeDef USART_InitStruct;
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct;
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_USART1);
|
|
/**USART1 GPIO Configuration
|
// PA1 ------> USART1_DE
|
PA9 ------> USART1_TX
|
PA10 ------> USART1_RX
|
*/
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_1;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
/* USART1 DMA Init */
|
|
/* USART1_TX Init */
|
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_2, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PRIORITY_LOW);
|
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MODE_NORMAL);
|
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PERIPH_NOINCREMENT);
|
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MEMORY_INCREMENT);
|
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PDATAALIGN_BYTE);
|
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MDATAALIGN_BYTE);
|
|
/* USART1_RX Init */
|
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_3, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
|
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PRIORITY_LOW);
|
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MODE_NORMAL);
|
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PERIPH_NOINCREMENT);
|
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MEMORY_INCREMENT);
|
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PDATAALIGN_BYTE);
|
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MDATAALIGN_BYTE);
|
|
/* USART1 interrupt Init */
|
NVIC_SetPriority(USART1_IRQn, 0);
|
NVIC_EnableIRQ(USART1_IRQn);
|
|
USART_InitStruct.BaudRate = Uart1Baud;
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
LL_USART_Init(USART1, &USART_InitStruct);
|
// LL_USART_EnableDEMode(USART1);
|
// LL_USART_SetDESignalPolarity(USART1, LL_USART_DE_POLARITY_LOW);
|
// LL_USART_SetDEAssertionTime(USART1, 1);
|
// LL_USART_SetDEDeassertionTime(USART1, 1);
|
// LL_USART_EnableOneBitSamp(USART1);
|
LL_USART_EnableAutoBaudRate(USART1);
|
LL_USART_SetAutoBaudRateMode(USART1, LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE);
|
LL_USART_DisableOverrunDetect(USART1);
|
LL_USART_ConfigAsyncMode(USART1);
|
LL_USART_Enable(USART1);
|
}
|
|
|
/* USART2 init function */
|
void MX_USART2_UART_Init(void)
|
{
|
|
LL_USART_InitTypeDef USART_InitStruct = {0};
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
/* Peripheral clock enable */
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
|
/**USART2 GPIO Configuration
|
PA1 ------> USART2_DE
|
PA2 ------> USART2_TX
|
PA3 ------> USART2_RX
|
*/
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_3;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_1;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
/* USART2 DMA Init */
|
|
/* USART2_TX Init */
|
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_4, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PRIORITY_LOW);
|
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MODE_NORMAL);
|
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PERIPH_NOINCREMENT);
|
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MEMORY_INCREMENT);
|
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PDATAALIGN_BYTE);
|
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MDATAALIGN_BYTE);
|
|
/* USART2_RX Init */
|
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
|
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PRIORITY_LOW);
|
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MODE_NORMAL);
|
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PERIPH_NOINCREMENT);
|
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MEMORY_INCREMENT);
|
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PDATAALIGN_BYTE);
|
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MDATAALIGN_BYTE);
|
|
/* USART2 interrupt Init */
|
NVIC_SetPriority(USART2_IRQn, 0);
|
NVIC_EnableIRQ(USART2_IRQn);
|
|
NVIC_SetPriority(PendSV_IRQn, 255);
|
NVIC_EnableIRQ(PendSV_IRQn);
|
// NVIC_SetPendingIRQ(PendSV_IRQn);
|
|
USART_InitStruct.BaudRate = Uart2Baud;
|
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_8;
|
LL_USART_Init(USART2, &USART_InitStruct);
|
|
LL_USART_EnableDEMode(USART2);
|
LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_LOW);
|
// LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_HIGH);
|
LL_USART_SetDEAssertionTime(USART2, 3);
|
LL_USART_SetDEDeassertionTime(USART2, 3);
|
// LL_USART_EnableOneBitSamp(USART2);
|
// LL_USART_EnableAutoBaudRate(USART2);
|
// LL_USART_SetAutoBaudRateMode(USART2, LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE);
|
LL_USART_DisableOverrunDetect(USART2);
|
LL_USART_ConfigAsyncMode(USART2);
|
LL_USART_Enable(USART2);
|
}
|
|
/**
|
* Enable DMA controller clock
|
*/
|
void MX_DMA_Init(void)
|
{
|
/* Init with LL driver */
|
/* DMA controller clock enable */
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1);
|
|
/* DMA interrupt init */
|
/* DMA1_Channel2_3_IRQn interrupt configuration */
|
NVIC_SetPriority(DMA1_Channel2_3_IRQn, 0);
|
NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);
|
NVIC_SetPriority(DMA1_Channel4_5_IRQn, 0);
|
NVIC_EnableIRQ(DMA1_Channel4_5_IRQn);
|
}
|
|
/** Configure pins as
|
* Analog
|
* Input
|
* Output
|
* EVENT_OUT
|
* EXTI
|
*/
|
void MX_GPIO_Init(void)
|
{
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct;
|
|
/* GPIO Ports Clock Enable */
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOF);
|
/**/
|
|
|
/**/
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6 |LL_GPIO_PIN_7;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7 ;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_8|LL_GPIO_PIN_11;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_8);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_0|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
if (GetBoardType()==2)
|
{
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15;
|
|
}
|
else if (GetBoardType()==9 || GetBoardType()==10 || GetBoardType()==15 )
|
{
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
LL_GPIO_PIN_11|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10|
|
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15;
|
}
|
else if ( GetBoardType() == 11 )
|
{
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
LL_GPIO_PIN_2|LL_GPIO_PIN_10|LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15;
|
} else if (BOARD_TYPE == 14)
|
{
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
LL_GPIO_PIN_10|LL_GPIO_PIN_11|LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15;
|
} else
|
{
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
LL_GPIO_PIN_0|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10|
|
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15;
|
}
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_LOW;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
// RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO,ENABLE );
|
// PWR_BackupAccessCmd( ENABLE );/* ????RTC??????*/
|
// RCC_LSEConfig( RCC_LSE_OFF ); /* ????????,PC14+PC15??????IO*/
|
// BKP_TamperPinCmd(DISABLE); /* ????????,PC13??????IO*/
|
|
#if (BORAD_TYPE == 13)
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15 ;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
#elif (BOARD_TYPE == 14)
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_8);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_9 ; //RST_PIN in
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = SYN_PIN ; //SYN_PIN Pin in
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(SYN_PORT, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = ACK_PIN ; //ACK_PIN Pin out
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL;
|
LL_GPIO_Init(ACK_PORT, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7 ; //485DE Pin out
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL;
|
LL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
|
GPIO_InitStruct.Pin = OE_PIN ; // OE Pin in
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(OE_PORT, &GPIO_InitStruct);
|
|
#elif (BOARD_TYPE == 15)
|
|
// Radio Pins
|
// busy pin
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
// Dio 1 pin
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_12;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
//Sel pin
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_15;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
|
//RST pin
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
#endif
|
|
}
|