buzz run_led uart4
parent
53b74fea75
commit
76c254d9fd
|
@ -112,7 +112,7 @@
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1398882809" name="CpuId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1398882809" name="CpuId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1532730982" name="CpuCoreId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1532730982" name="CpuCoreId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1861067852" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1861067852" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1239010509" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.3 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F107VCTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../USB_DEVICE/Target | ..//CMSIS/Driver/Include | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 | ../Drivers/CMSIS/Device/ST/STM32F1xx/Include | ../Drivers/CMSIS/Include | ../Core/Inc | ../USB_DEVICE/App | ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy | ../Drivers/STM32F1xx_HAL_Driver/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc || || || USE_HAL_DRIVER | STM32F107xC || || Drivers | CMSIS | Core/Startup | Middlewares | Core | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || " valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1239010509" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.3 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F107VCTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../USB_DEVICE/Target | ..//CMSIS/Driver/Include | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 | ../Drivers/CMSIS/Device/ST/STM32F1xx/Include | ../Drivers/CMSIS/Include | ../Core/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc | ../USB_DEVICE/App | ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy | ../Drivers/STM32F1xx_HAL_Driver/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc || || || USE_HAL_DRIVER | STM32F107xC || || Drivers | CMSIS | Core/Startup | Middlewares | Core | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || " valueType="string"/>
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.238068216" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.238068216" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
<builder buildPath="${workspace_loc:/NaviKit_stm32}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.95113451" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
<builder buildPath="${workspace_loc:/NaviKit_stm32}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.95113451" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1535045086" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1535045086" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||||
|
|
|
@ -67,10 +67,8 @@
|
||||||
#define configUSE_MUTEXES 1
|
#define configUSE_MUTEXES 1
|
||||||
#define configQUEUE_REGISTRY_SIZE 8
|
#define configQUEUE_REGISTRY_SIZE 8
|
||||||
#define configUSE_RECURSIVE_MUTEXES 1
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
#define configUSE_APPLICATION_TASK_TAG 1
|
|
||||||
#define configUSE_COUNTING_SEMAPHORES 1
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
#define configUSE_TICKLESS_IDLE 1
|
|
||||||
|
|
||||||
/* Co-routine definitions. */
|
/* Co-routine definitions. */
|
||||||
#define configUSE_CO_ROUTINES 0
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
@ -150,17 +148,4 @@ standard names. */
|
||||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||||
/* USER CODE END Defines */
|
/* USER CODE END Defines */
|
||||||
|
|
||||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
|
||||||
void PreSleepProcessing(uint32_t *ulExpectedIdleTime);
|
|
||||||
void PostSleepProcessing(uint32_t *ulExpectedIdleTime);
|
|
||||||
#endif /* defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) */
|
|
||||||
|
|
||||||
/* The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros
|
|
||||||
allow the application writer to add additional code before and after the MCU is
|
|
||||||
placed into the low power state respectively. */
|
|
||||||
#if configUSE_TICKLESS_IDLE == 1
|
|
||||||
#define configPRE_SLEEP_PROCESSING PreSleepProcessing
|
|
||||||
#define configPOST_SLEEP_PROCESSING PostSleepProcessing
|
|
||||||
#endif /* configUSE_TICKLESS_IDLE == 1 */
|
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
#include "gpio.h"
|
#include "navikit.h"
|
||||||
|
#include "stdbool.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
@ -38,10 +39,8 @@
|
||||||
void MX_GPIO_Init(void);
|
void MX_GPIO_Init(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
void Beep(uint32_t time_ms);
|
||||||
|
|
||||||
void demoEnumCtlInit();
|
|
||||||
void demoLedInit();
|
|
||||||
void demoLedBlink();
|
|
||||||
/* USER CODE END Prototypes */
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -58,8 +58,9 @@ void Error_Handler(void);
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define POWER_BUTTON_Pin GPIO_PIN_2
|
#define PWR_BUTTON_Pin GPIO_PIN_2
|
||||||
#define POWER_BUTTON_GPIO_Port GPIOE
|
#define PWR_BUTTON_GPIO_Port GPIOE
|
||||||
|
#define PWR_BUTTON_EXTI_IRQn EXTI2_IRQn
|
||||||
#define LED_RUN_Pin GPIO_PIN_3
|
#define LED_RUN_Pin GPIO_PIN_3
|
||||||
#define LED_RUN_GPIO_Port GPIOE
|
#define LED_RUN_GPIO_Port GPIOE
|
||||||
#define SYS_WKUP_Pin GPIO_PIN_0
|
#define SYS_WKUP_Pin GPIO_PIN_0
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* navikit.h
|
||||||
|
*
|
||||||
|
* Created on: Apr 17, 2020
|
||||||
|
* Author: oarap
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_NAVIKIT_H_
|
||||||
|
#define INC_NAVIKIT_H_
|
||||||
|
|
||||||
|
#include "stdbool.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool pwr_button_status;
|
||||||
|
}NaviKit_t;
|
||||||
|
extern NaviKit_t NaviKit;
|
||||||
|
|
||||||
|
#endif /* INC_NAVIKIT_H_ */
|
|
@ -56,6 +56,7 @@ void DebugMon_Handler(void);
|
||||||
void PVD_IRQHandler(void);
|
void PVD_IRQHandler(void);
|
||||||
void FLASH_IRQHandler(void);
|
void FLASH_IRQHandler(void);
|
||||||
void RCC_IRQHandler(void);
|
void RCC_IRQHandler(void);
|
||||||
|
void EXTI2_IRQHandler(void);
|
||||||
void TIM1_UP_IRQHandler(void);
|
void TIM1_UP_IRQHandler(void);
|
||||||
void I2C1_EV_IRQHandler(void);
|
void I2C1_EV_IRQHandler(void);
|
||||||
void I2C1_ER_IRQHandler(void);
|
void I2C1_ER_IRQHandler(void);
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
#include "navikit.h"
|
||||||
|
|
||||||
|
#include "stdbool.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
@ -72,6 +75,13 @@ const osThreadAttr_t IWDGRefreshTask_attributes = {
|
||||||
.priority = (osPriority_t) osPriorityHigh,
|
.priority = (osPriority_t) osPriorityHigh,
|
||||||
.stack_size = 128 * 4
|
.stack_size = 128 * 4
|
||||||
};
|
};
|
||||||
|
/* Definitions for ButtonDetect */
|
||||||
|
osThreadId_t ButtonDetectHandle;
|
||||||
|
const osThreadAttr_t ButtonDetect_attributes = {
|
||||||
|
.name = "ButtonDetect",
|
||||||
|
.priority = (osPriority_t) osPriorityLow,
|
||||||
|
.stack_size = 128 * 4
|
||||||
|
};
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* USER CODE BEGIN FunctionPrototypes */
|
/* USER CODE BEGIN FunctionPrototypes */
|
||||||
|
@ -80,26 +90,11 @@ const osThreadAttr_t IWDGRefreshTask_attributes = {
|
||||||
void StartDefaultTask(void *argument);
|
void StartDefaultTask(void *argument);
|
||||||
void StartLedBlinkTask(void *argument);
|
void StartLedBlinkTask(void *argument);
|
||||||
void StartIWDGRefreshTask(void *argument);
|
void StartIWDGRefreshTask(void *argument);
|
||||||
|
void StartButtonDetect(void *argument);
|
||||||
|
|
||||||
extern void MX_USB_DEVICE_Init(void);
|
extern void MX_USB_DEVICE_Init(void);
|
||||||
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
||||||
|
|
||||||
/* Pre/Post sleep processing prototypes */
|
|
||||||
void PreSleepProcessing(uint32_t *ulExpectedIdleTime);
|
|
||||||
void PostSleepProcessing(uint32_t *ulExpectedIdleTime);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PREPOSTSLEEP */
|
|
||||||
__weak void PreSleepProcessing(uint32_t *ulExpectedIdleTime)
|
|
||||||
{
|
|
||||||
/* place for user code */
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak void PostSleepProcessing(uint32_t *ulExpectedIdleTime)
|
|
||||||
{
|
|
||||||
/* place for user code */
|
|
||||||
}
|
|
||||||
/* USER CODE END PREPOSTSLEEP */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FreeRTOS initialization
|
* @brief FreeRTOS initialization
|
||||||
* @param None
|
* @param None
|
||||||
|
@ -136,6 +131,9 @@ void MX_FREERTOS_Init(void) {
|
||||||
/* creation of IWDGRefreshTask */
|
/* creation of IWDGRefreshTask */
|
||||||
IWDGRefreshTaskHandle = osThreadNew(StartIWDGRefreshTask, NULL, &IWDGRefreshTask_attributes);
|
IWDGRefreshTaskHandle = osThreadNew(StartIWDGRefreshTask, NULL, &IWDGRefreshTask_attributes);
|
||||||
|
|
||||||
|
/* creation of ButtonDetect */
|
||||||
|
ButtonDetectHandle = osThreadNew(StartButtonDetect, NULL, &ButtonDetect_attributes);
|
||||||
|
|
||||||
/* USER CODE BEGIN RTOS_THREADS */
|
/* USER CODE BEGIN RTOS_THREADS */
|
||||||
/* add threads, ... */
|
/* add threads, ... */
|
||||||
|
|
||||||
|
@ -155,7 +153,9 @@ void StartDefaultTask(void *argument)
|
||||||
/* init code for USB_DEVICE */
|
/* init code for USB_DEVICE */
|
||||||
MX_USB_DEVICE_Init();
|
MX_USB_DEVICE_Init();
|
||||||
/* USER CODE BEGIN StartDefaultTask */
|
/* USER CODE BEGIN StartDefaultTask */
|
||||||
demoEnumCtlInit();
|
|
||||||
|
HAL_GPIO_WritePin(ENUM_CTL_GPIO_Port,ENUM_CTL_Pin, GPIO_PIN_SET);
|
||||||
|
// Beep(100);
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -176,12 +176,10 @@ void StartLedBlinkTask(void *argument)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN StartLedBlinkTask */
|
/* USER CODE BEGIN StartLedBlinkTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
demoLedInit();
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
// HAL_GPIO_TogglePin(LED_RUN_GPIO_Port,LED_RUN_Pin);
|
HAL_GPIO_TogglePin(LED_RUN_GPIO_Port,LED_RUN_Pin);
|
||||||
|
// printf("1\n");
|
||||||
demoLedBlink();
|
|
||||||
osDelay(500);
|
osDelay(500);
|
||||||
}
|
}
|
||||||
/* USER CODE END StartLedBlinkTask */
|
/* USER CODE END StartLedBlinkTask */
|
||||||
|
@ -201,12 +199,41 @@ void StartIWDGRefreshTask(void *argument)
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
// printf("iwdg refreshed\n");
|
// printf("2\n");
|
||||||
osDelay(1000);
|
osDelay(1000);
|
||||||
}
|
}
|
||||||
/* USER CODE END StartIWDGRefreshTask */
|
/* USER CODE END StartIWDGRefreshTask */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Header_StartButtonDetect */
|
||||||
|
/**
|
||||||
|
* @brief Function implementing the ButtonDetect thread.
|
||||||
|
* @param argument: Not used
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header_StartButtonDetect */
|
||||||
|
void StartButtonDetect(void *argument)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN StartButtonDetect */
|
||||||
|
static bool last_pwr_button_status = false;
|
||||||
|
/* Infinite loop */
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if(NaviKit.pwr_button_status != last_pwr_button_status)
|
||||||
|
{
|
||||||
|
last_pwr_button_status = NaviKit.pwr_button_status;
|
||||||
|
Beep(100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last_pwr_button_status = NaviKit.pwr_button_status;
|
||||||
|
}
|
||||||
|
// printf("3\n");
|
||||||
|
osDelay(10);
|
||||||
|
}
|
||||||
|
/* USER CODE END StartButtonDetect */
|
||||||
|
}
|
||||||
|
|
||||||
/* Private application code --------------------------------------------------*/
|
/* Private application code --------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Application */
|
/* USER CODE BEGIN Application */
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
extern NaviKit_t NaviKit;
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
@ -63,11 +64,11 @@ void MX_GPIO_Init(void)
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(BUZZ_CTL_GPIO_Port, BUZZ_CTL_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(BUZZ_CTL_GPIO_Port, BUZZ_CTL_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pins : PEPin PEPin */
|
/*Configure GPIO pin : PtPin */
|
||||||
GPIO_InitStruct.Pin = POWER_BUTTON_Pin|COULOMB_ALCC_Pin;
|
GPIO_InitStruct.Pin = PWR_BUTTON_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
HAL_GPIO_Init(PWR_BUTTON_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PEPin PEPin PEPin PEPin
|
/*Configure GPIO pins : PEPin PEPin PEPin PEPin
|
||||||
PEPin PEPin */
|
PEPin PEPin */
|
||||||
|
@ -107,32 +108,40 @@ void MX_GPIO_Init(void)
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(CHRG_STATUS_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(CHRG_STATUS_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pin : PtPin */
|
||||||
|
GPIO_InitStruct.Pin = COULOMB_ALCC_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(COULOMB_ALCC_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* EXTI interrupt init*/
|
||||||
|
HAL_NVIC_SetPriority(EXTI2_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
void demoEnumCtlInit()
|
|
||||||
{
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_8, GPIO_PIN_SET);
|
void Beep(uint32_t time_ms)
|
||||||
}
|
|
||||||
void demoLedInit()
|
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
HAL_GPIO_WritePin(BUZZ_CTL_GPIO_Port,BUZZ_CTL_Pin, GPIO_PIN_SET);
|
||||||
GPIO_InitStruct.Pin = POWER_BUTTON_Pin;
|
osDelay(time_ms);
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
HAL_GPIO_WritePin(BUZZ_CTL_GPIO_Port,BUZZ_CTL_Pin, GPIO_PIN_RESET);
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
HAL_GPIO_Init(POWER_BUTTON_GPIO_Port, &GPIO_InitStruct);
|
|
||||||
}
|
}
|
||||||
void demoLedBlink()
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
HAL_GPIO_TogglePin(POWER_BUTTON_GPIO_Port,POWER_BUTTON_Pin);
|
if(GPIO_Pin==PWR_BUTTON_Pin)
|
||||||
|
{
|
||||||
|
if(HAL_GPIO_ReadPin(PWR_BUTTON_GPIO_Port, PWR_BUTTON_Pin)==GPIO_PIN_SET)
|
||||||
|
{//Rising edge trigger
|
||||||
|
NaviKit.pwr_button_status = false;
|
||||||
|
}
|
||||||
|
if(HAL_GPIO_ReadPin(PWR_BUTTON_GPIO_Port, PWR_BUTTON_Pin)==GPIO_PIN_RESET)
|
||||||
|
{//falling edge trigger
|
||||||
|
NaviKit.pwr_button_status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
@ -96,7 +95,7 @@ int main(void)
|
||||||
MX_IWDG_Init();
|
MX_IWDG_Init();
|
||||||
MX_UART4_Init();
|
MX_UART4_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
//HAL_IWDG_Refresh(&hiwdg);
|
||||||
printf("Core initial successfully\n");
|
printf("Core initial successfully\n");
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* navikit.c
|
||||||
|
*
|
||||||
|
* Created on: Apr 17, 2020
|
||||||
|
* Author: oarap
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "navikit.h"
|
||||||
|
NaviKit_t NaviKit;
|
|
@ -205,6 +205,20 @@ void RCC_IRQHandler(void)
|
||||||
/* USER CODE END RCC_IRQn 1 */
|
/* USER CODE END RCC_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles EXTI line2 interrupt.
|
||||||
|
*/
|
||||||
|
void EXTI2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN EXTI2_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI2_IRQn 0 */
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
|
||||||
|
/* USER CODE BEGIN EXTI2_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI2_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles TIM1 update interrupt.
|
* @brief This function handles TIM1 update interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,15 +37,15 @@
|
||||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
||||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="1000"/>
|
||||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="E:\source\NaviKit_stm32\Debug\st-link_gdbserver_log.txt"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="E:\source\NaviKit_stm32\Debug\st-link_gdbserver_log.txt"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="none"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="system_reset"/>
|
||||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="enable"/>
|
||||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||||
|
@ -76,6 +76,9 @@
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<listEntry value="4"/>
|
<listEntry value="4"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
|
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||||
|
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||||
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>
|
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>
|
||||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
|
|
@ -25,11 +25,17 @@ ARM.CMSIS.5.6.0_SwParameter=CMSISOoDriverJjUSARTJjCustom\:true;DeviceJjOSOoTickJ
|
||||||
FREERTOS.FootprintOK=true
|
FREERTOS.FootprintOK=true
|
||||||
FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1
|
FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1
|
||||||
FREERTOS.INCLUDE_xTaskGetHandle=1
|
FREERTOS.INCLUDE_xTaskGetHandle=1
|
||||||
FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK
|
FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK,configUSE_IDLE_HOOK,configUSE_TICK_HOOK,configUSE_MALLOC_FAILED_HOOK,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY
|
||||||
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;LedBlinkTask,8,128,StartLedBlinkTask,Default,NULL,Dynamic,NULL,NULL;IWDGRefreshTask,40,128,StartIWDGRefreshTask,Default,NULL,Dynamic,NULL,NULL
|
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;LedBlinkTask,8,128,StartLedBlinkTask,Default,NULL,Dynamic,NULL,NULL;IWDGRefreshTask,40,128,StartIWDGRefreshTask,Default,NULL,Dynamic,NULL,NULL;ButtonDetect,8,128,StartButtonDetect,Default,NULL,Dynamic,NULL,NULL
|
||||||
|
FREERTOS.configGENERATE_RUN_TIME_STATS=0
|
||||||
FREERTOS.configMAX_TASK_NAME_LEN=32
|
FREERTOS.configMAX_TASK_NAME_LEN=32
|
||||||
FREERTOS.configUSE_APPLICATION_TASK_TAG=1
|
FREERTOS.configUSE_APPLICATION_TASK_TAG=0
|
||||||
FREERTOS.configUSE_TICKLESS_IDLE=1
|
FREERTOS.configUSE_IDLE_HOOK=0
|
||||||
|
FREERTOS.configUSE_MALLOC_FAILED_HOOK=0
|
||||||
|
FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=0
|
||||||
|
FREERTOS.configUSE_TICKLESS_IDLE=0
|
||||||
|
FREERTOS.configUSE_TICK_HOOK=0
|
||||||
|
FREERTOS.configUSE_TRACE_FACILITY=1
|
||||||
File.Version=6
|
File.Version=6
|
||||||
GPIO.groupedBy=Group By Peripherals
|
GPIO.groupedBy=Group By Peripherals
|
||||||
IWDG.IPParameters=Prescaler,Reload
|
IWDG.IPParameters=Prescaler,Reload
|
||||||
|
@ -91,6 +97,7 @@ MxCube.Version=5.6.0
|
||||||
MxDb.Version=DB.5.0.60
|
MxDb.Version=DB.5.0.60
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
NVIC.EXTI2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.FLASH_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
NVIC.FLASH_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.ForceEnableDMAVector=true
|
NVIC.ForceEnableDMAVector=true
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
@ -220,10 +227,12 @@ PE15.GPIOParameters=GPIO_Label
|
||||||
PE15.GPIO_Label=USB3_VBUS_CTL_4
|
PE15.GPIO_Label=USB3_VBUS_CTL_4
|
||||||
PE15.Locked=true
|
PE15.Locked=true
|
||||||
PE15.Signal=GPIO_Output
|
PE15.Signal=GPIO_Output
|
||||||
PE2.GPIOParameters=GPIO_Label
|
PE2.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||||
PE2.GPIO_Label=POWER_BUTTON
|
PE2.GPIO_Label=PWR_BUTTON
|
||||||
|
PE2.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
|
||||||
|
PE2.GPIO_PuPd=GPIO_PULLUP
|
||||||
PE2.Locked=true
|
PE2.Locked=true
|
||||||
PE2.Signal=GPIO_Input
|
PE2.Signal=GPXTI2
|
||||||
PE3.GPIOParameters=GPIO_Label
|
PE3.GPIOParameters=GPIO_Label
|
||||||
PE3.GPIO_Label=LED_RUN
|
PE3.GPIO_Label=LED_RUN
|
||||||
PE3.Locked=true
|
PE3.Locked=true
|
||||||
|
@ -284,6 +293,8 @@ RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||||
RCC.TimSysFreq_Value=72000000
|
RCC.TimSysFreq_Value=72000000
|
||||||
RCC.USBFreq_Value=48000000
|
RCC.USBFreq_Value=48000000
|
||||||
RCC.VCOOutput2Freq_Value=8000000
|
RCC.VCOOutput2Freq_Value=8000000
|
||||||
|
SH.GPXTI2.0=GPIO_EXTI2
|
||||||
|
SH.GPXTI2.ConfNb=1
|
||||||
UART4.IPParameters=VirtualMode
|
UART4.IPParameters=VirtualMode
|
||||||
UART4.VirtualMode=Asynchronous
|
UART4.VirtualMode=Asynchronous
|
||||||
USB_DEVICE.CLASS_NAME_FS=CDC
|
USB_DEVICE.CLASS_NAME_FS=CDC
|
||||||
|
|
Loading…
Reference in New Issue