Change firmware to use C++ main
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.c
|
||||
* @brief : Main program body
|
||||
* @file : init.c
|
||||
* @brief : Init program body
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "init.h"
|
||||
#include "adc.h"
|
||||
#include "usb_device.h"
|
||||
#include "gpio.h"
|
||||
@@ -64,7 +64,7 @@ void SystemClock_Config(void);
|
||||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
int main(void)
|
||||
void init(void)
|
||||
{
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
@@ -93,16 +93,6 @@ int main(void)
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +105,7 @@ void SystemClock_Config(void)
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI14|RCC_OSCILLATORTYPE_HSI48;
|
||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||
@@ -126,7 +116,7 @@ void SystemClock_Config(void)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1;
|
||||
@@ -172,7 +162,7 @@ void Error_Handler(void)
|
||||
* @retval None
|
||||
*/
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
{
|
||||
/* USER CODE BEGIN 6 */
|
||||
/* User can add his own implementation to report the file name and line number,
|
||||
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
13
AdaptiveBrightnessFirmware/Src/main.cpp
Normal file
13
AdaptiveBrightnessFirmware/Src/main.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "init.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
init();
|
||||
|
||||
while(true) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* File Name : stm32f0xx_hal_msp.c
|
||||
* Description : This file provides code for the MSP Initialization
|
||||
* Description : This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
@@ -20,7 +20,7 @@
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "init.h"
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "init.h"
|
||||
#include "stm32f0xx_it.h"
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
@@ -62,7 +62,7 @@ extern PCD_HandleTypeDef hpcd_USB_FS;
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M0 Processor Interruption and Exception Handlers */
|
||||
/* Cortex-M0 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
|
||||
Reference in New Issue
Block a user