|
|
@ -18,7 +18,7 @@
|
|
|
|
/* USER CODE END Header */
|
|
|
|
/* USER CODE END Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "main.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "images.h"
|
|
|
|
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
#include "tusb.h"
|
|
|
|
#include "tusb.h"
|
|
|
@ -47,8 +47,6 @@ DMA_HandleTypeDef hdma_spi1_tx;
|
|
|
|
|
|
|
|
|
|
|
|
UART_HandleTypeDef huart2;
|
|
|
|
UART_HandleTypeDef huart2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PCD_HandleTypeDef hpcd_USB_FS;
|
|
|
|
PCD_HandleTypeDef hpcd_USB_FS;
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE BEGIN PV */
|
|
|
|
/* USER CODE BEGIN PV */
|
|
|
@ -62,7 +60,6 @@ int SPI_Rx_Done_Flag = 0;
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
|
|
void SystemClock_Config(void);
|
|
|
|
void SystemClock_Config(void);
|
|
|
|
static void MX_GPIO_Init(void);
|
|
|
|
static void MX_GPIO_Init(void);
|
|
|
|
|
|
|
|
|
|
|
|
static void MX_DMA_Init(void);
|
|
|
|
static void MX_DMA_Init(void);
|
|
|
|
static void MX_USART2_UART_Init(void);
|
|
|
|
static void MX_USART2_UART_Init(void);
|
|
|
|
static void MX_SPI1_Init(void);
|
|
|
|
static void MX_SPI1_Init(void);
|
|
|
@ -221,13 +218,25 @@ int send_CDC_Bulk(){
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
void SysTick_Init(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SysTick_Config(SystemCoreClock / 10000); // Set SysTick interrupt to occur every 100us
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void delay_us(uint32_t us)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t start = SysTick->VAL;
|
|
|
|
|
|
|
|
uint32_t ticks = us * 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ((start - SysTick->VAL) < ticks);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief The application entry point.
|
|
|
|
* @brief The application entry point.
|
|
|
|
* @retval int
|
|
|
|
* @retval int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int main(void)
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
@ -271,13 +280,15 @@ int main(void)
|
|
|
|
// Wait for power stabilization
|
|
|
|
// Wait for power stabilization
|
|
|
|
//HAL_Delay(1000);
|
|
|
|
//HAL_Delay(1000);
|
|
|
|
|
|
|
|
|
|
|
|
#define CDC_BUFF_SIZE 10000
|
|
|
|
tud_task();
|
|
|
|
|
|
|
|
|
|
|
|
int last_sent_idx = 0;
|
|
|
|
int last_sent_idx = 0;
|
|
|
|
int buff_stop_idx = 0;
|
|
|
|
int buff_stop_idx = 0;
|
|
|
|
uint16_t image_size = 0;
|
|
|
|
uint16_t image_size = 0;
|
|
|
|
uint8_t cdc_buff[CDC_BUFF_SIZE];
|
|
|
|
uint8_t cdc_buff[CDC_BUFF_SIZE];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cam_Init(&hi2c1, &hspi1);
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END 2 */
|
|
|
|
/* USER CODE END 2 */
|
|
|
|
|
|
|
|
|
|
|
|
/* Infinite loop */
|
|
|
|
/* Infinite loop */
|
|
|
@ -288,6 +299,8 @@ int main(void)
|
|
|
|
|
|
|
|
|
|
|
|
if(buff_stop_idx >= (int)image_size){
|
|
|
|
if(buff_stop_idx >= (int)image_size){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LED_Off();
|
|
|
|
|
|
|
|
|
|
|
|
buff_stop_idx = 0;
|
|
|
|
buff_stop_idx = 0;
|
|
|
|
last_sent_idx = 0;
|
|
|
|
last_sent_idx = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -298,7 +311,7 @@ int main(void)
|
|
|
|
|
|
|
|
|
|
|
|
tud_task();
|
|
|
|
tud_task();
|
|
|
|
|
|
|
|
|
|
|
|
Cam_Init(&hi2c1, &hspi1);
|
|
|
|
Cam_Refresh(&hi2c1, &hspi1);
|
|
|
|
|
|
|
|
|
|
|
|
tud_task();
|
|
|
|
tud_task();
|
|
|
|
|
|
|
|
|
|
|
@ -309,6 +322,8 @@ int main(void)
|
|
|
|
image_size = Cam_FIFO_length(&hspi1);
|
|
|
|
image_size = Cam_FIFO_length(&hspi1);
|
|
|
|
Cam_Start_Burst_Read(&hspi1);
|
|
|
|
Cam_Start_Burst_Read(&hspi1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LED_On();
|
|
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
//HAL_SPI_Receive(&hspi1, cdc_buff, CDC_BUFF_SIZE, HAL_MAX_DELAY);
|
|
|
|
//HAL_SPI_Receive(&hspi1, cdc_buff, CDC_BUFF_SIZE, HAL_MAX_DELAY);
|
|
|
@ -331,16 +346,17 @@ int main(void)
|
|
|
|
int current_sending_idx = 0;
|
|
|
|
int current_sending_idx = 0;
|
|
|
|
do{
|
|
|
|
do{
|
|
|
|
tud_task();
|
|
|
|
tud_task();
|
|
|
|
|
|
|
|
tud_cdc_write(&cdc_buff[current_sending_idx], CDC_FRAME_SIZE);
|
|
|
|
tud_cdc_write(&cdc_buff[current_sending_idx], 50);
|
|
|
|
current_sending_idx = current_sending_idx + CDC_FRAME_SIZE;
|
|
|
|
|
|
|
|
last_sent_idx = last_sent_idx + CDC_FRAME_SIZE;
|
|
|
|
tud_cdc_write_flush();
|
|
|
|
tud_cdc_write_flush();
|
|
|
|
current_sending_idx = current_sending_idx + 50;
|
|
|
|
//Delay between sends
|
|
|
|
last_sent_idx = last_sent_idx + 50;
|
|
|
|
int i = 0;
|
|
|
|
HAL_Delay(3);
|
|
|
|
for(;i<4000;i++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while(last_sent_idx < buff_stop_idx);
|
|
|
|
while(last_sent_idx < buff_stop_idx);
|
|
|
|
|
|
|
|
|
|
|
|
LED_On();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END WHILE */
|
|
|
|
/* USER CODE END WHILE */
|
|
|
|
|
|
|
|
|
|
|
@ -350,25 +366,25 @@ int main(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief System Clock Configuration
|
|
|
|
* @brief System Clock Configuration
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void SystemClock_Config(void)
|
|
|
|
void SystemClock_Config(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
|
|
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
|
|
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
|
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
|
|
|
|
|
|
|
|
|
|
/** Configure the main internal regulator output voltage
|
|
|
|
/** Configure the main internal regulator output voltage
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
|
|
|
|
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Error_Handler();
|
|
|
|
Error_Handler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
|
|
* in the RCC_OscInitTypeDef structure.
|
|
|
|
* in the RCC_OscInitTypeDef structure.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSI;
|
|
|
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSI;
|
|
|
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|
|
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|
|
|
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
|
|
|
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
|
|
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
|
|
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
|
|
@ -385,8 +401,9 @@ void SystemClock_Config(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Initializes the CPU, AHB and APB buses clocks
|
|
|
|
/** Initializes the CPU, AHB and APB buses clocks
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
|
|
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
|
|
|
|
|
|
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
|
|
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
|
|
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
|
|
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
|
|
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
|
|
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
|
|
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
|
|
@ -399,10 +416,10 @@ void SystemClock_Config(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief I2C1 Initialization Function
|
|
|
|
* @brief I2C1 Initialization Function
|
|
|
|
* @param None
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_I2C1_Init(void)
|
|
|
|
static void MX_I2C1_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -428,14 +445,14 @@ static void MX_I2C1_Init(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Configure Analogue filter
|
|
|
|
/** Configure Analogue filter
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
|
|
|
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Error_Handler();
|
|
|
|
Error_Handler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Configure Digital filter
|
|
|
|
/** Configure Digital filter
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
|
|
|
|
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Error_Handler();
|
|
|
|
Error_Handler();
|
|
|
@ -443,13 +460,14 @@ static void MX_I2C1_Init(void)
|
|
|
|
/* USER CODE BEGIN I2C1_Init 2 */
|
|
|
|
/* USER CODE BEGIN I2C1_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END I2C1_Init 2 */
|
|
|
|
/* USER CODE END I2C1_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief SPI1 Initialization Function
|
|
|
|
* @brief SPI1 Initialization Function
|
|
|
|
* @param None
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_SPI1_Init(void)
|
|
|
|
static void MX_SPI1_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -468,7 +486,7 @@ static void MX_SPI1_Init(void)
|
|
|
|
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
|
|
|
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
|
|
|
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
|
|
|
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
|
|
|
hspi1.Init.NSS = SPI_NSS_SOFT;
|
|
|
|
hspi1.Init.NSS = SPI_NSS_SOFT;
|
|
|
|
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128;
|
|
|
|
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
|
|
|
|
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
|
|
|
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
|
|
|
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
|
|
|
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
|
|
|
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
|
|
|
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
|
|
@ -482,13 +500,14 @@ static void MX_SPI1_Init(void)
|
|
|
|
/* USER CODE BEGIN SPI1_Init 2 */
|
|
|
|
/* USER CODE BEGIN SPI1_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END SPI1_Init 2 */
|
|
|
|
/* USER CODE END SPI1_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief USART2 Initialization Function
|
|
|
|
* @brief USART2 Initialization Function
|
|
|
|
* @param None
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_USART2_UART_Init(void)
|
|
|
|
static void MX_USART2_UART_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -516,13 +535,14 @@ static void MX_USART2_UART_Init(void)
|
|
|
|
/* USER CODE BEGIN USART2_Init 2 */
|
|
|
|
/* USER CODE BEGIN USART2_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END USART2_Init 2 */
|
|
|
|
/* USER CODE END USART2_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief USB Initialization Function
|
|
|
|
* @brief USB Initialization Function
|
|
|
|
* @param None
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_USB_PCD_Init(void)
|
|
|
|
static void MX_USB_PCD_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -548,11 +568,12 @@ static void MX_USB_PCD_Init(void)
|
|
|
|
/* USER CODE BEGIN USB_Init 2 */
|
|
|
|
/* USER CODE BEGIN USB_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE END USB_Init 2 */
|
|
|
|
/* USER CODE END USB_Init 2 */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Enable DMA controller clock
|
|
|
|
* Enable DMA controller clock
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_DMA_Init(void)
|
|
|
|
static void MX_DMA_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -566,13 +587,14 @@ static void MX_DMA_Init(void)
|
|
|
|
/* DMA1_Channel3_IRQn interrupt configuration */
|
|
|
|
/* DMA1_Channel3_IRQn interrupt configuration */
|
|
|
|
HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 0, 0);
|
|
|
|
HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 0, 0);
|
|
|
|
HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);
|
|
|
|
HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief GPIO Initialization Function
|
|
|
|
* @brief GPIO Initialization Function
|
|
|
|
* @param None
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void MX_GPIO_Init(void)
|
|
|
|
static void MX_GPIO_Init(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
@ -586,7 +608,7 @@ static void MX_GPIO_Init(void)
|
|
|
|
HAL_GPIO_WritePin(DEBUG_LED_GPIO_Port, DEBUG_LED_Pin, GPIO_PIN_RESET);
|
|
|
|
HAL_GPIO_WritePin(DEBUG_LED_GPIO_Port, DEBUG_LED_Pin, GPIO_PIN_RESET);
|
|
|
|
|
|
|
|
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
|
|
HAL_GPIO_WritePin(GPIOB, CHIP_SELECT_Pin | LD3_Pin, GPIO_PIN_RESET);
|
|
|
|
HAL_GPIO_WritePin(GPIOB, CHIP_SELECT_Pin|LD3_Pin, GPIO_PIN_RESET);
|
|
|
|
|
|
|
|
|
|
|
|
/*Configure GPIO pin : DEBUG_LED_Pin */
|
|
|
|
/*Configure GPIO pin : DEBUG_LED_Pin */
|
|
|
|
GPIO_InitStruct.Pin = DEBUG_LED_Pin;
|
|
|
|
GPIO_InitStruct.Pin = DEBUG_LED_Pin;
|
|
|
@ -596,11 +618,12 @@ static void MX_GPIO_Init(void)
|
|
|
|
HAL_GPIO_Init(DEBUG_LED_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
HAL_GPIO_Init(DEBUG_LED_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
|
|
|
|
/*Configure GPIO pins : CHIP_SELECT_Pin LD3_Pin */
|
|
|
|
/*Configure GPIO pins : CHIP_SELECT_Pin LD3_Pin */
|
|
|
|
GPIO_InitStruct.Pin = CHIP_SELECT_Pin | LD3_Pin;
|
|
|
|
GPIO_InitStruct.Pin = CHIP_SELECT_Pin|LD3_Pin;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* USER CODE BEGIN 4 */
|
|
|
|
/* USER CODE BEGIN 4 */
|
|
|
@ -617,9 +640,9 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
|
|
|
|
/* USER CODE END 4 */
|
|
|
|
/* USER CODE END 4 */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief This function is executed in case of error occurrence.
|
|
|
|
* @brief This function is executed in case of error occurrence.
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void Error_Handler(void)
|
|
|
|
void Error_Handler(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* USER CODE BEGIN Error_Handler_Debug */
|
|
|
|
/* USER CODE BEGIN Error_Handler_Debug */
|
|
|
@ -631,14 +654,14 @@ void Error_Handler(void)
|
|
|
|
/* USER CODE END Error_Handler_Debug */
|
|
|
|
/* USER CODE END Error_Handler_Debug */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_FULL_ASSERT
|
|
|
|
#ifdef USE_FULL_ASSERT
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Reports the name of the source file and the source line number
|
|
|
|
* @brief Reports the name of the source file and the source line number
|
|
|
|
* where the assert_param error has occurred.
|
|
|
|
* where the assert_param error has occurred.
|
|
|
|
* @param file: pointer to the source file name
|
|
|
|
* @param file: pointer to the source file name
|
|
|
|
* @param line: assert_param error line source number
|
|
|
|
* @param line: assert_param error line source number
|
|
|
|
* @retval None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void assert_failed(uint8_t *file, uint32_t line)
|
|
|
|
void assert_failed(uint8_t *file, uint32_t line)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* USER CODE BEGIN 6 */
|
|
|
|
/* USER CODE BEGIN 6 */
|
|
|
|