Initial commit
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
commit
0f722b27aa
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Build
|
||||
|
||||
steps:
|
||||
- name: Submodules
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git submodule update --init --recursive
|
||||
|
||||
- name: Build
|
||||
image: "git.minori.work/embedded_sdk/embedded-builder-arm:12.2.mpacbti-rel1"
|
||||
commands:
|
||||
- mkdir build && cd build
|
||||
- cmake -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi.cmake ..
|
||||
- make pudding_lwnode_template_FLASH.elf
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "SDK"]
|
||||
path = SDK
|
||||
url = https://github.com/STMicroelectronics/STM32CubeWL.git
|
|
@ -0,0 +1,676 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides set of firmware functions to manage:
|
||||
* - LEDs and push-buttons available on STM32WLXX-Nucleo
|
||||
* Kit from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL
|
||||
* @brief This file provides set of firmware functions to manage LEDs and push-buttons
|
||||
* on STM32WLXX-Nucleo Kit from STMicroelectronics.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported Variables
|
||||
* @{
|
||||
*/
|
||||
EXTI_HandleTypeDef hpb_exti[BUTTONn];
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
UART_HandleTypeDef hcom_uart[COMn];
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Defines LOW LEVEL Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL Private Typedef
|
||||
* @{
|
||||
*/
|
||||
typedef void (* BSP_EXTI_LineCallback) (void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables
|
||||
* @{
|
||||
*/
|
||||
static GPIO_TypeDef* LED_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT};
|
||||
|
||||
static const uint16_t LED_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN};
|
||||
|
||||
static GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {BUTTON_SW1_GPIO_PORT, BUTTON_SW2_GPIO_PORT, BUTTON_SW3_GPIO_PORT};
|
||||
|
||||
static const uint16_t BUTTON_PIN[BUTTONn] = {BUTTON_SW1_PIN, BUTTON_SW2_PIN, BUTTON_SW3_PIN};
|
||||
|
||||
static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_SW1_EXTI_IRQn, BUTTON_SW2_EXTI_IRQn, BUTTON_SW3_EXTI_IRQn};
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
static USART_TypeDef* COM_USART[COMn] = {COM1_UART};
|
||||
|
||||
#if (USE_COM_LOG > 0)
|
||||
static COM_TypeDef COM_ActiveLogPort = COM1;
|
||||
#endif
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
static uint32_t IsComMspCbValid[COMn] = {0};
|
||||
#endif
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Functions LOW LEVEL Private Functions
|
||||
* @{
|
||||
*/
|
||||
static void BUTTON_SW1_EXTI_Callback(void);
|
||||
static void BUTTON_SW2_EXTI_Callback(void);
|
||||
static void BUTTON_SW3_EXTI_Callback(void);
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
static void COM1_MspInit(UART_HandleTypeDef *huart);
|
||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart);
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This method returns the STM32WLXX NUCLEO BSP Driver revision
|
||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||
*/
|
||||
uint32_t BSP_GetVersion(void)
|
||||
{
|
||||
return (int32_t)__STM32WLXX_NUCLEO_BSP_VERSION;
|
||||
}
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_LED_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configures LED GPIO.
|
||||
* @param Led: LED to be configured.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Init(Led_TypeDef Led)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure = {0};
|
||||
|
||||
/* Enable the GPIO_LED Clock */
|
||||
LEDx_GPIO_CLK_ENABLE(Led);
|
||||
|
||||
/* Configure the GPIO_LED pin */
|
||||
gpio_init_structure.Pin = LED_PIN[Led];
|
||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure);
|
||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit LEDs.
|
||||
* @param Led: LED to be de-init.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_DeInit(Led_TypeDef Led)
|
||||
{
|
||||
/* Turn off LED */
|
||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||
|
||||
/* DeInit the GPIO_LED pin */
|
||||
HAL_GPIO_DeInit(LED_PORT[Led], LED_PIN[Led]);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns selected LED On.
|
||||
* @param Led: Specifies the Led to be set on.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_On(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns selected LED Off.
|
||||
* @param Led: Specifies the Led to be set off.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the selected LED.
|
||||
* @param Led: Specifies the Led to be toggled.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led)
|
||||
{
|
||||
HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the status of the selected LED.
|
||||
* @param Led Specifies the Led to get its state.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg LED1
|
||||
* @arg LED2
|
||||
* @arg LED3
|
||||
* @retval LED status
|
||||
*/
|
||||
int32_t BSP_LED_GetState(Led_TypeDef Led)
|
||||
{
|
||||
return (int32_t)HAL_GPIO_ReadPin(LED_PORT[Led], LED_PIN[Led]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_BUTTON_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configures Button GPIO and EXTI Line.
|
||||
* @param Button: Specifies the Button to be configured.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg BUTTON_SW1
|
||||
* @arg BUTTON_SW2
|
||||
* @arg BUTTON_SW3
|
||||
* @param ButtonMode: Specifies Button mode.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line with interrupt
|
||||
* generation capability
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure = {0};
|
||||
static BSP_EXTI_LineCallback button_callback[BUTTONn] = {BUTTON_SW1_EXTI_Callback, BUTTON_SW2_EXTI_Callback, BUTTON_SW3_EXTI_Callback};
|
||||
static uint32_t button_interrupt_priority[BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY, BSP_BUTTON_USER_IT_PRIORITY, BSP_BUTTON_USER_IT_PRIORITY};
|
||||
static const uint32_t button_exti_line[BUTTONn] = {BUTTON_SW1_EXTI_LINE, BUTTON_SW2_EXTI_LINE, BUTTON_SW3_EXTI_LINE};
|
||||
|
||||
/* Enable the BUTTON Clock */
|
||||
BUTTONx_GPIO_CLK_ENABLE(Button);
|
||||
|
||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||
gpio_init_structure.Pull = GPIO_PULLUP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
if(ButtonMode == BUTTON_MODE_GPIO)
|
||||
{
|
||||
/* Configure Button pin as input */
|
||||
gpio_init_structure.Mode = GPIO_MODE_INPUT;
|
||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||
}
|
||||
else /* (ButtonMode == BUTTON_MODE_EXTI) */
|
||||
{
|
||||
/* Configure Button pin as input with External interrupt */
|
||||
gpio_init_structure.Mode = GPIO_MODE_IT_FALLING;
|
||||
|
||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||
|
||||
(void)HAL_EXTI_GetHandle(&hpb_exti[Button], button_exti_line[Button]);
|
||||
(void)HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID, button_callback[Button]);
|
||||
|
||||
/* Enable and set Button EXTI Interrupt to the lowest priority */
|
||||
HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), button_interrupt_priority[Button], 0x00);
|
||||
HAL_NVIC_EnableIRQ((BUTTON_IRQn[Button]));
|
||||
}
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Push Button DeInit.
|
||||
* @param Button: Button to be configured
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg BUTTON_SW1
|
||||
* @arg BUTTON_SW2
|
||||
* @arg BUTTON_SW3
|
||||
* @note PB DeInit does not disable the GPIO clock
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button)
|
||||
{
|
||||
HAL_NVIC_DisableIRQ((BUTTON_IRQn[Button]));
|
||||
HAL_GPIO_DeInit(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the selected Button state.
|
||||
* @param Button: Specifies the Button to be checked.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg BUTTON_SW1
|
||||
* @arg BUTTON_SW2
|
||||
* @arg BUTTON_SW3
|
||||
* @retval The Button GPIO pin value.
|
||||
*/
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button)
|
||||
{
|
||||
return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Push-Button interrupt requests.
|
||||
* @param Button Specifies the pin connected EXTI line
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button)
|
||||
{
|
||||
HAL_EXTI_IRQHandler(&hpb_exti[Button]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BSP Push Button callback
|
||||
* @param Button: Specifies the Button to be checked.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg BUTTON_SW1
|
||||
* @arg BUTTON_SW2
|
||||
* @arg BUTTON_SW3
|
||||
* @retval None.
|
||||
*/
|
||||
__weak void BSP_PB_Callback(Button_TypeDef Button)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(Button);
|
||||
|
||||
/* This function should be implemented by the user application.
|
||||
It is called into this driver when an event on Button is triggered. */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_COM_Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval BSP error code
|
||||
*/
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM > COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
|
||||
/* Init the UART Msp */
|
||||
COM1_MspInit(&hcom_uart[COM]);
|
||||
#else
|
||||
if(IsComMspCbValid == 0U)
|
||||
{
|
||||
if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE)
|
||||
{
|
||||
return BSP_ERROR_MSP_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(MX_LPUART1_Init(&hcom_uart[COM], COM_Init) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* USART configuration */
|
||||
hcom_uart[COM].Instance = COM_USART[COM];
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
|
||||
COM1_MspDeInit(&hcom_uart[COM]);
|
||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
|
||||
|
||||
if(HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param huart USART handle
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval HAL error code
|
||||
*/
|
||||
__weak HAL_StatusTypeDef MX_LPUART1_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init)
|
||||
{
|
||||
/* USART configuration */
|
||||
huart->Instance = COM_USART[COM1];
|
||||
huart->Init.BaudRate = COM_Init->BaudRate;
|
||||
huart->Init.Mode = UART_MODE_TX_RX;
|
||||
huart->Init.Parity = (uint32_t)COM_Init->Parity;
|
||||
huart->Init.WordLength = COM_Init->WordLength;
|
||||
huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
|
||||
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
|
||||
huart->Init.OverSampling = UART_OVERSAMPLING_8;
|
||||
|
||||
return HAL_UART_Init(huart);
|
||||
}
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
/**
|
||||
* @brief Register Default COM Msp Callbacks
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* Register default MspInit/MspDeInit Callback */
|
||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, COM1_MspInit) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, COM1_MspDeInit) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsComMspCbValid[COM] = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
/* BSP status */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register COM Msp Callback registering
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* Register MspInit/MspDeInit Callbacks */
|
||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsComMspCbValid[COM] = 1U;
|
||||
}
|
||||
}
|
||||
/* BSP status */
|
||||
return ret;
|
||||
}
|
||||
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
||||
|
||||
#if (USE_COM_LOG > 0)
|
||||
/**
|
||||
* @brief Select the active COM port.
|
||||
* @param COM COM port to be activated.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
|
||||
{
|
||||
if(COM_ActiveLogPort != COM)
|
||||
{
|
||||
COM_ActiveLogPort = COM;
|
||||
}
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Redirect console output to COM
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
int __io_putchar (int ch)
|
||||
#else
|
||||
int fputc (int ch, FILE *f)
|
||||
#endif /* __GNUC__ */
|
||||
{
|
||||
(void) HAL_UART_Transmit(&hcom_uart [COM_ActiveLogPort], (uint8_t *) &ch, 1, COM_POLL_TIMEOUT);
|
||||
return ch;
|
||||
}
|
||||
#endif /* USE_COM_LOG */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Button SW1 EXTI line detection callback.
|
||||
* @retval None
|
||||
*/
|
||||
static void BUTTON_SW1_EXTI_Callback(void)
|
||||
{
|
||||
BSP_PB_Callback(BUTTON_SW1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Button SW2 EXTI line detection callback.
|
||||
* @retval None
|
||||
*/
|
||||
static void BUTTON_SW2_EXTI_Callback(void)
|
||||
{
|
||||
BSP_PB_Callback(BUTTON_SW2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Button SW3 EXTI line detection callback.
|
||||
* @retval None
|
||||
*/
|
||||
static void BUTTON_SW3_EXTI_Callback(void)
|
||||
{
|
||||
BSP_PB_Callback(BUTTON_SW3);
|
||||
}
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/**
|
||||
* @brief Initializes COM1 MSP.
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(huart);
|
||||
|
||||
/* Enable GPIO clock */
|
||||
COM1_TX_GPIO_CLK_ENABLE();
|
||||
COM1_RX_GPIO_CLK_ENABLE();
|
||||
|
||||
/* Enable USART clock */
|
||||
COM1_CLK_ENABLE();
|
||||
|
||||
/* Configure USART Tx as alternate function */
|
||||
gpio_init_structure.Pin = COM1_TX_PIN;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
gpio_init_structure.Pull = GPIO_PULLUP;
|
||||
gpio_init_structure.Alternate = COM1_TX_AF;
|
||||
HAL_GPIO_Init(COM1_TX_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
/* Configure USART Rx as alternate function */
|
||||
gpio_init_structure.Pin = COM1_RX_PIN;
|
||||
gpio_init_structure.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init_structure.Alternate = COM1_RX_AF;
|
||||
HAL_GPIO_Init(COM1_RX_GPIO_PORT, &gpio_init_structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitialize COM1 MSP part
|
||||
* @param huart UART handle
|
||||
* @retval BSP status
|
||||
*/
|
||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(huart);
|
||||
|
||||
/* COM GPIO pin configuration */
|
||||
gpio_init_structure.Pin = COM1_TX_PIN;
|
||||
HAL_GPIO_DeInit(COM1_TX_GPIO_PORT, gpio_init_structure.Pin);
|
||||
|
||||
gpio_init_structure.Pin = COM1_RX_PIN;
|
||||
HAL_GPIO_DeInit(COM1_RX_GPIO_PORT, gpio_init_structure.Pin);
|
||||
|
||||
/* Disable USART clock */
|
||||
COM1_CLK_DISABLE();
|
||||
}
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -0,0 +1,356 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for stm32wlxx_nucleo.c
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLXX_NUCLEO_H
|
||||
#define STM32WLXX_NUCLEO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo_errno.h"
|
||||
#include "stm32wlxx_nucleo_conf.h"
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
#if (USE_COM_LOG > 0)
|
||||
#ifndef __GNUC__
|
||||
#include "stdio.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO STM32WLXX-NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL LOW LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LED1 = 0,
|
||||
LED2 = 1,
|
||||
LED3 = 2,
|
||||
/* Color led aliases */
|
||||
LED_BLUE = LED1,
|
||||
LED_GREEN = LED2,
|
||||
LED_RED = LED3
|
||||
}Led_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_SW1 = 0,
|
||||
BUTTON_SW2 = 1,
|
||||
BUTTON_SW3 = 2,
|
||||
}Button_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
}ButtonMode_TypeDef;
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0U,
|
||||
COMn
|
||||
}COM_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_STOPBITS_1 = UART_STOPBITS_1,
|
||||
COM_STOPBITS_2 = UART_STOPBITS_2,
|
||||
}COM_StopBitsTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_PARITY_NONE = UART_PARITY_NONE,
|
||||
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
||||
COM_PARITY_ODD = UART_PARITY_ODD,
|
||||
}COM_ParityTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
||||
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
||||
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
||||
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
||||
}COM_HwFlowCtlTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
|
||||
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
||||
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
||||
}COM_WordLengthTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t BaudRate;
|
||||
COM_WordLengthTypeDef WordLength;
|
||||
COM_StopBitsTypeDef StopBits;
|
||||
COM_ParityTypeDef Parity;
|
||||
COM_HwFlowCtlTypeDef HwFlowCtl;
|
||||
}COM_InitTypeDef;
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
typedef struct
|
||||
{
|
||||
pUART_CallbackTypeDef pMspInitCb;
|
||||
pUART_CallbackTypeDef pMspDeInitCb;
|
||||
}BSP_COM_Cb_t;
|
||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ABSENT = 0,
|
||||
PRESENT = 1,
|
||||
}Presence_TypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief STM32WLXX NUCLEO BSP Driver version number
|
||||
*/
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_SUB1 (0x02U) /*!< [23:16] sub1 version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION ((__STM32WLXX_NUCLEO_BSP_VERSION_MAIN << 24)\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_SUB1 << 16)\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_SUB2 << 8 )\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_RC))
|
||||
|
||||
/**
|
||||
* @brief Define for STM32WLXX_NUCLEO board
|
||||
*/
|
||||
#if !defined (USE_STM32WLXX_NUCLEO)
|
||||
#define USE_STM32WLXX_NUCLEO
|
||||
#endif
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED Constants
|
||||
* @{
|
||||
*/
|
||||
#define LEDn 3
|
||||
|
||||
#define LED1_PIN GPIO_PIN_15
|
||||
#define LED1_GPIO_PORT GPIOB
|
||||
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
#define LED2_PIN GPIO_PIN_9
|
||||
#define LED2_GPIO_PORT GPIOB
|
||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
#define LED3_PIN GPIO_PIN_11
|
||||
#define LED3_GPIO_PORT GPIOB
|
||||
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
|
||||
#define LEDx_GPIO_CLK_ENABLE(__INDEX__) __HAL_RCC_GPIOB_CLK_ENABLE() /* All Led on same port */
|
||||
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) __HAL_RCC_GPIOB_CLK_DISABLE() /* All Led on same port */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON Constants
|
||||
* @{
|
||||
*/
|
||||
#define BUTTONn 3
|
||||
|
||||
/**
|
||||
* @brief Key push-buttons
|
||||
*/
|
||||
#define BUTTON_SW1_PIN GPIO_PIN_0
|
||||
#define BUTTON_SW1_GPIO_PORT GPIOA
|
||||
#define BUTTON_SW1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define BUTTON_SW1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define BUTTON_SW1_EXTI_LINE EXTI_LINE_0
|
||||
#ifdef CORE_CM0PLUS
|
||||
#define BUTTON_SW1_EXTI_IRQn EXTI1_0_IRQn
|
||||
#else
|
||||
#define BUTTON_SW1_EXTI_IRQn EXTI0_IRQn
|
||||
#endif
|
||||
#define H_EXTI_0 hpb_exti[BUTTON_SW1]
|
||||
|
||||
#define BUTTON_SW2_PIN GPIO_PIN_1
|
||||
#define BUTTON_SW2_GPIO_PORT GPIOA
|
||||
#define BUTTON_SW2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define BUTTON_SW2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define BUTTON_SW2_EXTI_LINE EXTI_LINE_1
|
||||
#ifdef CORE_CM0PLUS
|
||||
#define BUTTON_SW2_EXTI_IRQn EXTI1_0_IRQn
|
||||
#else
|
||||
#define BUTTON_SW2_EXTI_IRQn EXTI1_IRQn
|
||||
#endif
|
||||
#define H_EXTI_1 hpb_exti[BUTTON_SW2]
|
||||
|
||||
#define BUTTON_SW3_PIN GPIO_PIN_6
|
||||
#define BUTTON_SW3_GPIO_PORT GPIOC
|
||||
#define BUTTON_SW3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define BUTTON_SW3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
#define BUTTON_SW3_EXTI_LINE EXTI_LINE_6
|
||||
#ifdef CORE_CM0PLUS
|
||||
#define BUTTON_SW3_EXTI_IRQn EXTI15_4_IRQn
|
||||
#else
|
||||
#define BUTTON_SW3_EXTI_IRQn EXTI9_5_IRQn
|
||||
#endif
|
||||
#define H_EXTI_6 hpb_exti[BUTTON_SW3]
|
||||
|
||||
#define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if ((__INDEX__) == BUTTON_SW1) BUTTON_SW1_GPIO_CLK_ENABLE(); else \
|
||||
if ((__INDEX__) == BUTTON_SW2) BUTTON_SW2_GPIO_CLK_ENABLE(); else \
|
||||
if ((__INDEX__) == BUTTON_SW3) BUTTON_SW3_GPIO_CLK_ENABLE();} while(0)
|
||||
|
||||
#define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) do { if ((__INDEX__) == BUTTON_SW1) BUTTON_SW1_GPIO_CLK_DISABLE(); else \
|
||||
if ((__INDEX__) == BUTTON_SW2) BUTTON_SW2_GPIO_CLK_DISABLE(); else \
|
||||
if ((__INDEX__) == BUTTON_SW3) BUTTON_SW3_GPIO_CLK_DISABLE();} while(0)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM Port Constants
|
||||
* @{
|
||||
*/
|
||||
#define COM1_UART LPUART1
|
||||
#define COM1_CLK_ENABLE() __HAL_RCC_LPUART1_CLK_ENABLE()
|
||||
#define COM1_CLK_DISABLE() __HAL_RCC_LPUART1_CLK_DISABLE()
|
||||
|
||||
#define COM1_TX_PIN GPIO_PIN_2
|
||||
#define COM1_TX_GPIO_PORT GPIOA
|
||||
#define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define COM1_TX_AF GPIO_AF8_LPUART1
|
||||
|
||||
#define COM1_RX_PIN GPIO_PIN_3
|
||||
#define COM1_RX_GPIO_PORT GPIOA
|
||||
#define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define COM1_RX_AF GPIO_AF8_LPUART1
|
||||
#define COM_POLL_TIMEOUT 1000
|
||||
|
||||
#define MX_UART_InitTypeDef COM_InitTypeDef
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0)*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Variables
|
||||
* @{
|
||||
*/
|
||||
extern EXTI_HandleTypeDef hpb_exti[];
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
extern UART_HandleTypeDef hcom_uart[];
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint32_t BSP_GetVersion(void);
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_LED_Functions LOW LEVEL LED Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t BSP_LED_Init(Led_TypeDef Led);
|
||||
int32_t BSP_LED_DeInit(Led_TypeDef Led);
|
||||
int32_t BSP_LED_On(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Off(Led_TypeDef Led);
|
||||
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
||||
int32_t BSP_LED_GetState(Led_TypeDef Led);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_BUTTON_Functions LOW LEVEL BUTTON Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
void BSP_PB_Callback(Button_TypeDef Button);
|
||||
void BSP_PB_IRQHandler(Button_TypeDef Button);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_COM_Functions LOW LEVEL COM Port Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
||||
#if (USE_COM_LOG > 0)
|
||||
int32_t BSP_COM_SelectLogPort (COM_TypeDef COM);
|
||||
#endif
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
|
||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback);
|
||||
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
||||
HAL_StatusTypeDef MX_LPUART1_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* (USE_BSP_COM_FEATURE > 0) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_H */
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief STM32WLxx_Nucleo board configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLXX_NUCLEO_CONF_H
|
||||
#define STM32WLXX_NUCLEO_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_CONFIG CONFIG
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_CONFIG_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* COM usage define */
|
||||
#define USE_BSP_COM_FEATURE 0U
|
||||
|
||||
/* COM log define */
|
||||
#define USE_COM_LOG 0U
|
||||
|
||||
/* IRQ priorities */
|
||||
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_CONF_H */
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo_errno.h
|
||||
* @author MCD Application Team
|
||||
* @brief Error Code.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLXX_NUCLEO_ERRNO_H
|
||||
#define STM32WLXX_NUCLEO_ERRNO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Common Error codes */
|
||||
#define BSP_ERROR_NONE 0
|
||||
#define BSP_ERROR_NO_INIT -1
|
||||
#define BSP_ERROR_WRONG_PARAM -2
|
||||
#define BSP_ERROR_BUSY -3
|
||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||
#define BSP_ERROR_BUS_FAILURE -8
|
||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||
#define BSP_ERROR_MSP_FAILURE -10
|
||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_ERRNO_H */
|
|
@ -0,0 +1,222 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo_radio.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides set of firmware functions to manage:
|
||||
* - RF circuitry available on STM32WLXX-Nucleo
|
||||
* Kit from STMicroelectronics
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo_radio.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL
|
||||
* @brief This file provides set of firmware functions to Radio switch
|
||||
* available on STM32WLXX-Nucleo Kit from STMicroelectronics.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Init Radio Switch
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_RADIO_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure = {0};
|
||||
|
||||
/* Enable the Radio Switch Clock */
|
||||
RF_SW_CTRL3_GPIO_CLK_ENABLE();
|
||||
|
||||
/* Configure the Radio Switch pin */
|
||||
gpio_init_structure.Pin = RF_SW_CTRL1_PIN;
|
||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
||||
HAL_GPIO_Init(RF_SW_CTRL1_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
gpio_init_structure.Pin = RF_SW_CTRL2_PIN;
|
||||
HAL_GPIO_Init(RF_SW_CTRL2_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
gpio_init_structure.Pin = RF_SW_CTRL3_PIN;
|
||||
HAL_GPIO_Init(RF_SW_CTRL3_GPIO_PORT, &gpio_init_structure);
|
||||
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_RESET);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit Radio Switch
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_RADIO_DeInit(void)
|
||||
{
|
||||
RF_SW_CTRL3_GPIO_CLK_ENABLE();
|
||||
|
||||
/* Turn off switch */
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_RESET);
|
||||
|
||||
/* DeInit the Radio Switch pin */
|
||||
HAL_GPIO_DeInit(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN);
|
||||
HAL_GPIO_DeInit(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN);
|
||||
HAL_GPIO_DeInit(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure Radio Switch.
|
||||
* @param Config: Specifies the Radio RF switch path to be set.
|
||||
* This parameter can be one of following parameters:
|
||||
* @arg RADIO_SWITCH_OFF
|
||||
* @arg RADIO_SWITCH_RX
|
||||
* @arg RADIO_SWITCH_RFO_LP
|
||||
* @arg RADIO_SWITCH_RFO_HP
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_RADIO_ConfigRFSwitch(BSP_RADIO_Switch_TypeDef Config)
|
||||
{
|
||||
switch (Config)
|
||||
{
|
||||
case RADIO_SWITCH_OFF:
|
||||
{
|
||||
/* Turn off switch */
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_RESET);
|
||||
break;
|
||||
}
|
||||
case RADIO_SWITCH_RX:
|
||||
{
|
||||
/*Turns On in Rx Mode the RF Switch */
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_RESET);
|
||||
break;
|
||||
}
|
||||
case RADIO_SWITCH_RFO_LP:
|
||||
{
|
||||
/*Turns On in Tx Low Power the RF Switch */
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_SET);
|
||||
break;
|
||||
}
|
||||
case RADIO_SWITCH_RFO_HP:
|
||||
{
|
||||
/*Turns On in Tx High Power the RF Switch */
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL3_GPIO_PORT, RF_SW_CTRL3_PIN, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL1_GPIO_PORT, RF_SW_CTRL1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(RF_SW_CTRL2_GPIO_PORT, RF_SW_CTRL2_PIN, GPIO_PIN_SET);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return Board Configuration
|
||||
* @retval
|
||||
* RADIO_CONF_RFO_LP_HP
|
||||
* RADIO_CONF_RFO_LP
|
||||
* RADIO_CONF_RFO_HP
|
||||
*/
|
||||
int32_t BSP_RADIO_GetTxConfig(void)
|
||||
{
|
||||
//return RADIO_CONF_RFO_LP_HP;
|
||||
return RADIO_CONF_RFO_HP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get If TCXO is to be present on board
|
||||
* @note never remove called by MW,
|
||||
* @retval
|
||||
* RADIO_CONF_TCXO_NOT_SUPPORTED
|
||||
* RADIO_CONF_TCXO_SUPPORTED
|
||||
*/
|
||||
int32_t BSP_RADIO_IsTCXO(void)
|
||||
{
|
||||
//return RADIO_CONF_TCXO_SUPPORTED;
|
||||
return RADIO_CONF_TCXO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get If DCDC is to be present on board
|
||||
* @note never remove called by MW,
|
||||
* @retval
|
||||
* RADIO_CONF_DCDC_NOT_SUPPORTED
|
||||
* RADIO_CONF_DCDC_SUPPORTED
|
||||
*/
|
||||
int32_t BSP_RADIO_IsDCDC(void)
|
||||
{
|
||||
return RADIO_CONF_DCDC_SUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return RF Output Max Power Configuration
|
||||
* @retval
|
||||
* RADIO_CONF_RFO_LP_MAX_15_dBm for LP mode
|
||||
* RADIO_CONF_RFO_HP_MAX_22_dBm for HP mode
|
||||
*/
|
||||
int32_t BSP_RADIO_GetRFOMaxPowerConfig(BSP_RADIO_RFOMaxPowerConfig_TypeDef Config)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if(Config == RADIO_RFO_LP_MAXPOWER)
|
||||
{
|
||||
ret = RADIO_CONF_RFO_LP_MAX_15_dBm;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = RADIO_CONF_RFO_HP_MAX_22_dBm;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo_radio.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for stm32wlxx_nucleo_radio.c
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLXX_NUCLEO_RADIO_H
|
||||
#define STM32WLXX_NUCLEO_RADIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo_errno.h"
|
||||
#include "stm32wlxx_nucleo_conf.h"
|
||||
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO STM32WLXX-NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL RADIO LOW LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_Exported_Types RADIO LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RADIO_SWITCH_OFF = 0,
|
||||
RADIO_SWITCH_RX = 1,
|
||||
RADIO_SWITCH_RFO_LP = 2,
|
||||
RADIO_SWITCH_RFO_HP = 3,
|
||||
}BSP_RADIO_Switch_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RADIO_RFO_LP_MAXPOWER = 0,
|
||||
RADIO_RFO_HP_MAXPOWER,
|
||||
} BSP_RADIO_RFOMaxPowerConfig_TypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_Exported_Constants RADIO LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_RADIOCONFIG RADIO LOW LEVEL RADIO CONFIG Constants
|
||||
* @{
|
||||
*/
|
||||
#define RADIO_CONF_RFO_LP_HP 0U
|
||||
#define RADIO_CONF_RFO_LP 1U
|
||||
#define RADIO_CONF_RFO_HP 2U
|
||||
|
||||
#define RADIO_CONF_TCXO_NOT_SUPPORTED 0U
|
||||
#define RADIO_CONF_TCXO_SUPPORTED 1U
|
||||
|
||||
#define RADIO_CONF_DCDC_NOT_SUPPORTED 0U
|
||||
#define RADIO_CONF_DCDC_SUPPORTED 1U
|
||||
|
||||
#define RADIO_CONF_RFO_HP_MAX_22_dBm ((int32_t) 22)
|
||||
#define RADIO_CONF_RFO_HP_MAX_20_dBm ((int32_t) 20)
|
||||
#define RADIO_CONF_RFO_HP_MAX_17_dBm ((int32_t) 17)
|
||||
#define RADIO_CONF_RFO_HP_MAX_14_dBm ((int32_t) 14)
|
||||
#define RADIO_CONF_RFO_LP_MAX_15_dBm ((int32_t) 15)
|
||||
#define RADIO_CONF_RFO_LP_MAX_14_dBm ((int32_t) 14)
|
||||
#define RADIO_CONF_RFO_LP_MAX_10_dBm ((int32_t) 10)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_RFSWITCH RADIO LOW LEVEL RF SWITCH Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define RF_SW_CTRL3_PIN GPIO_PIN_6
|
||||
#define RF_SW_CTRL3_GPIO_PORT GPIOA
|
||||
#define RF_SW_CTRL3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define RF_SW_CTRL3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
|
||||
#define RF_SW_CTRL1_PIN GPIO_PIN_7
|
||||
#define RF_SW_CTRL1_GPIO_PORT GPIOA
|
||||
#define RF_SW_CTRL1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define RF_SW_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
|
||||
#define RF_SW_CTRL2_PIN GPIO_PIN_5
|
||||
#define RF_SW_CTRL2_GPIO_PORT GPIOC
|
||||
#define RF_SW_CTRL2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define RF_SW_CTRL2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
|
||||
#define RF_TCXO_VCC_PIN GPIO_PIN_0
|
||||
#define RF_TCXO_VCC_GPIO_PORT GPIOB
|
||||
#define RF_TCXO_VCC_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define RF_TCXO_VCC_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_RADIO_LOW_LEVEL_Exported_Functions RADIO LOW LEVEL Exported Functions
|
||||
* @{
|
||||
*/
|
||||
int32_t BSP_RADIO_Init(void);
|
||||
int32_t BSP_RADIO_DeInit(void);
|
||||
int32_t BSP_RADIO_ConfigRFSwitch(BSP_RADIO_Switch_TypeDef Config);
|
||||
int32_t BSP_RADIO_GetTxConfig(void);
|
||||
int32_t BSP_RADIO_IsTCXO(void);
|
||||
int32_t BSP_RADIO_IsDCDC(void);
|
||||
int32_t BSP_RADIO_GetRFOMaxPowerConfig(BSP_RADIO_RFOMaxPowerConfig_TypeDef Config);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_RADIO_H */
|
|
@ -0,0 +1,130 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(pudding_lwnode_template)
|
||||
|
||||
enable_language(CXX)
|
||||
enable_language(ASM)
|
||||
|
||||
# Different linker scripts
|
||||
set(TARGET_LDSCRIPT_FLASH "${CMAKE_SOURCE_DIR}/MX_Generated/STM32WLE5XX_FLASH.ld")
|
||||
|
||||
set(TARGET_SOURCES
|
||||
"BSP/stm32wlxx_nucleo_radio.c"
|
||||
"BSP/stm32wlxx_nucleo.c"
|
||||
"MX_Generated/startup_stm32wle5xx.s"
|
||||
"MX_Generated/Core/Src/gpio.c"
|
||||
"MX_Generated/Core/Src/i2c.c"
|
||||
"MX_Generated/Core/Src/main.c"
|
||||
"MX_Generated/Core/Src/rtc.c"
|
||||
"MX_Generated/Core/Src/stm32wlxx_hal_msp.c"
|
||||
"MX_Generated/Core/Src/stm32wlxx_it.c"
|
||||
"MX_Generated/Core/Src/system_stm32wlxx.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_cortex.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_gpio.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_i2c.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_i2c_ex.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_pwr.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_pwr_ex.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rcc.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rcc_ex.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc.c"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc_ex.c"
|
||||
"src/main.c"
|
||||
)
|
||||
|
||||
set(TARGET_C_DEFINES
|
||||
"STM32WLE5xx"
|
||||
"USE_HAL_DRIVER"
|
||||
"USE_FULL_LL_DRIVER"
|
||||
)
|
||||
|
||||
set(TARGET_C_INCLUDES
|
||||
"BSP"
|
||||
"MX_Generated/Core/Inc"
|
||||
"SDK/Drivers/CMSIS/Core/Include"
|
||||
"SDK/Drivers/CMSIS/Device/ST/STM32WLxx/Include"
|
||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Inc"
|
||||
"include"
|
||||
)
|
||||
|
||||
# Shared libraries linked with application
|
||||
set(TARGET_LIBS
|
||||
"c"
|
||||
"m"
|
||||
"nosys"
|
||||
)
|
||||
|
||||
# Shared library and linker script search paths
|
||||
set(TARGET_LIB_DIRECTORIES
|
||||
|
||||
)
|
||||
|
||||
# Conditional flags
|
||||
# DEBUG
|
||||
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -O0 -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -O0 -g")
|
||||
set(CMAKE_ASM_FLAGS_DEBUG "-DDEBUG -O0 -g")
|
||||
|
||||
# RELEASE
|
||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2")
|
||||
set(CMAKE_ASM_FLAGS_RELEASE "-DNDEBUG -O2")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
|
||||
|
||||
# Final compiler flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-common -fno-builtin -ffreestanding -fdata-sections -ffunction-sections")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-common -fno-builtin -ffreestanding -fdata-sections -ffunction-sections")
|
||||
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
|
||||
# Shared sources, includes and definitions
|
||||
add_compile_definitions(${TARGET_C_DEFINES})
|
||||
include_directories(${TARGET_C_INCLUDES})
|
||||
link_directories(${TARGET_LIB_DIRECTORIES})
|
||||
link_libraries(${TARGET_LIBS})
|
||||
|
||||
# Main targets are added here
|
||||
|
||||
# Create ELF
|
||||
add_executable("${CMAKE_PROJECT_NAME}_FLASH.elf" ${TARGET_SOURCES})
|
||||
target_compile_definitions("${CMAKE_PROJECT_NAME}_FLASH.elf"
|
||||
PRIVATE ${TARGET_C_DEFINES_XIP}
|
||||
)
|
||||
target_link_options("${CMAKE_PROJECT_NAME}_FLASH.elf"
|
||||
PRIVATE "-T${TARGET_LDSCRIPT_FLASH}"
|
||||
PRIVATE "-Wl,--Map=${CMAKE_PROJECT_NAME}_FLASH.map"
|
||||
)
|
||||
set_property(TARGET "${CMAKE_PROJECT_NAME}_FLASH.elf" APPEND
|
||||
PROPERTY ADDITIONAL_CLEAN_FILES "${CMAKE_PROJECT_NAME}_FLASH.map"
|
||||
)
|
||||
add_custom_command(OUTPUT "${CMAKE_PROJECT_NAME}_FLASH.hex"
|
||||
COMMAND ${CMAKE_OBJCOPY} "-O" "ihex" "${CMAKE_PROJECT_NAME}_FLASH.elf" "${CMAKE_PROJECT_NAME}_FLASH.hex"
|
||||
DEPENDS "${CMAKE_PROJECT_NAME}_FLASH.elf"
|
||||
)
|
||||
add_custom_target("${CMAKE_PROJECT_NAME}_FLASH_HEX" DEPENDS "${CMAKE_PROJECT_NAME}_FLASH.hex")
|
||||
if(DEFINED TARGET_TOOLCHAIN_SIZE)
|
||||
add_custom_command(TARGET "${CMAKE_PROJECT_NAME}_FLASH.elf" POST_BUILD
|
||||
COMMAND ${TARGET_TOOLCHAIN_SIZE} "${CMAKE_PROJECT_NAME}_FLASH.elf"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Create ELF
|
||||
add_executable("${CMAKE_PROJECT_NAME}_RAM.elf" ${TARGET_SOURCES})
|
||||
target_link_options("${CMAKE_PROJECT_NAME}_RAM.elf"
|
||||
PRIVATE "-T${TARGET_LDSCRIPT_RAM}"
|
||||
PRIVATE "-Wl,--Map=${CMAKE_PROJECT_NAME}_RAM.map"
|
||||
)
|
||||
set_property(TARGET "${CMAKE_PROJECT_NAME}_RAM.elf" APPEND
|
||||
PROPERTY ADDITIONAL_CLEAN_FILES "${CMAKE_PROJECT_NAME}_RAM.map"
|
||||
)
|
||||
add_custom_command(OUTPUT "${CMAKE_PROJECT_NAME}_RAM.hex"
|
||||
COMMAND ${CMAKE_OBJCOPY} "-O" "ihex" "${CMAKE_PROJECT_NAME}_RAM.elf" "${CMAKE_PROJECT_NAME}_RAM.hex"
|
||||
DEPENDS "${CMAKE_PROJECT_NAME}_RAM.elf"
|
||||
)
|
||||
add_custom_target("${CMAKE_PROJECT_NAME}_RAM_HEX" DEPENDS "${CMAKE_PROJECT_NAME}_RAM.hex")
|
||||
if(DEFINED TARGET_TOOLCHAIN_SIZE)
|
||||
add_custom_command(TARGET "${CMAKE_PROJECT_NAME}_RAM.elf" POST_BUILD
|
||||
COMMAND ${TARGET_TOOLCHAIN_SIZE} "${CMAKE_PROJECT_NAME}_RAM.elf"
|
||||
)
|
||||
endif()
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,52 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the adc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __ADC_H__
|
||||
#define __ADC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern ADC_HandleTypeDef hadc;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_ADC_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ADC_H__ */
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the gpio.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __GPIO_H__
|
||||
#define __GPIO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_GPIO_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__ GPIO_H__ */
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file i2c.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the i2c.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __I2C_H__
|
||||
#define __I2C_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_I2C1_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __I2C_H__ */
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define ALS_INT_Pin GPIO_PIN_0
|
||||
#define ALS_INT_GPIO_Port GPIOA
|
||||
#define ALS_INT_EXTI_IRQn EXTI0_IRQn
|
||||
#define IMU_INT1_Pin GPIO_PIN_1
|
||||
#define IMU_INT1_GPIO_Port GPIOA
|
||||
#define IMU_INT1_EXTI_IRQn EXTI1_IRQn
|
||||
#define IMU_INT2_Pin GPIO_PIN_2
|
||||
#define IMU_INT2_GPIO_Port GPIOA
|
||||
#define IMU_INT2_EXTI_IRQn EXTI2_IRQn
|
||||
#define TOF_GPIO_Pin GPIO_PIN_3
|
||||
#define TOF_GPIO_GPIO_Port GPIOA
|
||||
#define TOF_GPIO_EXTI_IRQn EXTI3_IRQn
|
||||
#define TOF_XSHUT_Pin GPIO_PIN_4
|
||||
#define TOF_XSHUT_GPIO_Port GPIOA
|
||||
#define BTN_Pin GPIO_PIN_0
|
||||
#define BTN_GPIO_Port GPIOB
|
||||
#define LED_Pin GPIO_PIN_2
|
||||
#define LED_GPIO_Port GPIOB
|
||||
#define VBAT_Pin GPIO_PIN_12
|
||||
#define VBAT_GPIO_Port GPIOA
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
|
@ -0,0 +1,52 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the rtc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __RTC_H__
|
||||
#define __RTC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_RTC_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RTC_H__ */
|
||||
|
|
@ -0,0 +1,337 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_hal_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLxx_HAL_CONF_H
|
||||
#define STM32WLxx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#define HAL_MODULE_ENABLED
|
||||
#define HAL_ADC_MODULE_ENABLED
|
||||
/*#define HAL_COMP_MODULE_ENABLED */
|
||||
/*#define HAL_CRC_MODULE_ENABLED */
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
/*#define HAL_DAC_MODULE_ENABLED */
|
||||
/*#define HAL_GTZC_MODULE_ENABLED */
|
||||
/*#define HAL_HSEM_MODULE_ENABLED */
|
||||
#define HAL_I2C_MODULE_ENABLED
|
||||
/*#define HAL_I2S_MODULE_ENABLED */
|
||||
/*#define HAL_IPCC_MODULE_ENABLED */
|
||||
/*#define HAL_IRDA_MODULE_ENABLED */
|
||||
/*#define HAL_IWDG_MODULE_ENABLED */
|
||||
/*#define HAL_LPTIM_MODULE_ENABLED */
|
||||
/*#define HAL_PKA_MODULE_ENABLED */
|
||||
/*#define HAL_RNG_MODULE_ENABLED */
|
||||
#define HAL_RTC_MODULE_ENABLED
|
||||
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/*#define HAL_SMBUS_MODULE_ENABLED */
|
||||
/*#define HAL_SPI_MODULE_ENABLED */
|
||||
/*#define HAL_SUBGHZ_MODULE_ENABLED */
|
||||
/*#define HAL_TIM_MODULE_ENABLED */
|
||||
/*#define HAL_UART_MODULE_ENABLED */
|
||||
/*#define HAL_USART_MODULE_ENABLED */
|
||||
/*#define HAL_WWDG_MODULE_ENABLED */
|
||||
#define HAL_EXTI_MODULE_ENABLED
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
|
||||
/* ########################## Register Callbacks selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules where register callback can be used
|
||||
*/
|
||||
#define USE_HAL_ADC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_COMP_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_DAC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_I2C_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_I2S_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_PKA_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_RNG_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_RTC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SUBGHZ_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE 32000000UL /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT 100UL /*!< Time out for HSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal Multiple Speed oscillator (MSI) default value.
|
||||
* This value is the default MSI range value after Reset.
|
||||
*/
|
||||
#if !defined (MSI_VALUE)
|
||||
#define MSI_VALUE 4000000UL /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* MSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE 16000000UL /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal Low Speed oscillator (LSI) value.
|
||||
*/
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE 32000UL /*!< LSI Typical Value in Hz*/
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
in voltage and temperature. */
|
||||
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE 32768UL /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal Multiple Speed oscillator (HSI48) default value.
|
||||
* This value is the default HSI48 range value after Reset.
|
||||
*/
|
||||
#if !defined (HSI48_VALUE)
|
||||
#define HSI48_VALUE 48000000UL /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI48_VALUE */
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT 5000UL /*!< Time out for LSE start up, in ms */
|
||||
#endif /* LSE_STARTUP_TIMEOUT */
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((1uL <<__NVIC_PRIO_BITS) - 1uL) /*!< tick interrupt priority (lowest by default) */
|
||||
#define USE_RTOS 0U
|
||||
#define PREFETCH_ENABLE 1U
|
||||
#define INSTRUCTION_CACHE_ENABLE 1U
|
||||
#define DATA_CACHE_ENABLE 1U
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1 */
|
||||
|
||||
/* ################## SPI peripheral configuration ########################## */
|
||||
|
||||
/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
|
||||
* Activated: CRC code is present inside driver
|
||||
* Deactivated: CRC code cleaned from driver
|
||||
*/
|
||||
|
||||
#define USE_SPI_CRC 1U
|
||||
|
||||
/* ################## CRYP peripheral configuration ########################## */
|
||||
|
||||
#define USE_HAL_CRYP_SUSPEND_RESUME 1U
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_adc.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_comp.h"
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_dac.h"
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GTZC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_gtzc.h"
|
||||
#endif /* HAL_GTZC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HSEM_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_hsem.h"
|
||||
#endif /* HAL_HSEM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IPCC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_ipcc.h"
|
||||
#endif /* HAL_IPCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_lptim.h"
|
||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PKA_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_pka.h"
|
||||
#endif /* HAL_PKA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RNG_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_rng.h"
|
||||
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_smbus.h"
|
||||
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SUBGHZ_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_subghz.h"
|
||||
#endif /* HAL_SUBGHZ_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32wlxx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLxx_HAL_CONF_H */
|
|
@ -0,0 +1,70 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32WLxx_IT_H
|
||||
#define __STM32WLxx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void EXTI0_IRQHandler(void);
|
||||
void EXTI1_IRQHandler(void);
|
||||
void EXTI2_IRQHandler(void);
|
||||
void EXTI3_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32WLxx_IT_H */
|
|
@ -0,0 +1,123 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the ADC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "adc.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
ADC_HandleTypeDef hadc;
|
||||
|
||||
/* ADC init function */
|
||||
void MX_ADC_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN ADC_Init 0 */
|
||||
|
||||
/* USER CODE END ADC_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN ADC_Init 1 */
|
||||
|
||||
/* USER CODE END ADC_Init 1 */
|
||||
|
||||
/** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
||||
*/
|
||||
hadc.Instance = ADC;
|
||||
hadc.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
|
||||
hadc.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc.Init.ScanConvMode = ADC_SCAN_DISABLE;
|
||||
hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
hadc.Init.LowPowerAutoWait = DISABLE;
|
||||
hadc.Init.LowPowerAutoPowerOff = DISABLE;
|
||||
hadc.Init.ContinuousConvMode = DISABLE;
|
||||
hadc.Init.NbrOfConversion = 1;
|
||||
hadc.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
hadc.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc.Init.Overrun = ADC_OVR_DATA_PRESERVED;
|
||||
hadc.Init.SamplingTimeCommon1 = ADC_SAMPLETIME_1CYCLE_5;
|
||||
hadc.Init.SamplingTimeCommon2 = ADC_SAMPLETIME_1CYCLE_5;
|
||||
hadc.Init.OversamplingMode = DISABLE;
|
||||
hadc.Init.TriggerFrequencyMode = ADC_TRIGGER_FREQ_HIGH;
|
||||
if (HAL_ADC_Init(&hadc) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN ADC_Init 2 */
|
||||
|
||||
/* USER CODE END ADC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(adcHandle->Instance==ADC)
|
||||
{
|
||||
/* USER CODE BEGIN ADC_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC_MspInit 0 */
|
||||
/* ADC clock enable */
|
||||
__HAL_RCC_ADC_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**ADC GPIO Configuration
|
||||
PA12 ------> ADC_IN8
|
||||
*/
|
||||
GPIO_InitStruct.Pin = VBAT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(VBAT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN ADC_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
||||
{
|
||||
|
||||
if(adcHandle->Instance==ADC)
|
||||
{
|
||||
/* USER CODE BEGIN ADC_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ADC_CLK_DISABLE();
|
||||
|
||||
/**ADC GPIO Configuration
|
||||
PA12 ------> ADC_IN8
|
||||
*/
|
||||
HAL_GPIO_DeInit(VBAT_GPIO_Port, VBAT_Pin);
|
||||
|
||||
/* USER CODE BEGIN ADC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -0,0 +1,101 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all used GPIO pins.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "gpio.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Configure GPIO */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/** Configure pins as
|
||||
* Analog
|
||||
* Input
|
||||
* Output
|
||||
* EVENT_OUT
|
||||
* EXTI
|
||||
*/
|
||||
void MX_GPIO_Init(void)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(TOF_XSHUT_GPIO_Port, TOF_XSHUT_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = ALS_INT_Pin|IMU_INT1_Pin|IMU_INT2_Pin|TOF_GPIO_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = TOF_XSHUT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(TOF_XSHUT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = BTN_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(BTN_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = LED_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* EXTI interrupt init*/
|
||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
||||
|
||||
HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
|
||||
HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
|
||||
|
||||
HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
|
@ -0,0 +1,140 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file i2c.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the I2C instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "i2c.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
|
||||
/* I2C1 init function */
|
||||
void MX_I2C1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN I2C1_Init 0 */
|
||||
|
||||
/* USER CODE END I2C1_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN I2C1_Init 1 */
|
||||
|
||||
/* USER CODE END I2C1_Init 1 */
|
||||
hi2c1.Instance = I2C1;
|
||||
hi2c1.Init.Timing = 0x2010091A;
|
||||
hi2c1.Init.OwnAddress1 = 0;
|
||||
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
hi2c1.Init.OwnAddress2 = 0;
|
||||
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if (HAL_I2C_Init(&hi2c1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure Analogue filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure Digital filter
|
||||
*/
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN I2C1_Init 2 */
|
||||
|
||||
/* USER CODE END I2C1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
void HAL_I2C_MspInit(I2C_HandleTypeDef* i2cHandle)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
if(i2cHandle->Instance==I2C1)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_MspInit 0 */
|
||||
|
||||
/* USER CODE END I2C1_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C1;
|
||||
PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**I2C1 GPIO Configuration
|
||||
PA9 ------> I2C1_SCL
|
||||
PA10 ------> I2C1_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* I2C1 clock enable */
|
||||
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||
/* USER CODE BEGIN I2C1_MspInit 1 */
|
||||
|
||||
/* USER CODE END I2C1_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_I2C_MspDeInit(I2C_HandleTypeDef* i2cHandle)
|
||||
{
|
||||
|
||||
if(i2cHandle->Instance==I2C1)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END I2C1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_I2C1_CLK_DISABLE();
|
||||
|
||||
/**I2C1 GPIO Configuration
|
||||
PA9 ------> I2C1_SCL
|
||||
PA10 ------> I2C1_SDA
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10);
|
||||
|
||||
/* USER CODE BEGIN I2C1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END I2C1_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -0,0 +1,195 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.c
|
||||
* @brief : Main program body
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "adc.h"
|
||||
#include "i2c.h"
|
||||
#include "rtc.h"
|
||||
#include "gpio.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
|
||||
/* USER CODE END PTD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void SystemClock_Config(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
void SystemClock_Config_MSI2MHz(void);
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
void SystemClock_Config_MSI2MHz(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
|
||||
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
|
||||
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
|
||||
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
RCC_ClkInitStruct.ClockType =
|
||||
RCC_CLOCKTYPE_HCLK3 | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_NONE;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
|
||||
}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief System Clock Configuration
|
||||
* @retval None
|
||||
*/
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure LSE Drive Capability
|
||||
*/
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||
RCC_OscInitStruct.HSEDiv = RCC_HSE_DIV1;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
|
||||
RCC_OscInitStruct.PLL.PLLN = 18;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV3;
|
||||
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK3|RCC_CLOCKTYPE_HCLK
|
||||
|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|
||||
|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
||||
/**
|
||||
* @brief This function is executed in case of error occurrence.
|
||||
* @retval None
|
||||
*/
|
||||
void Error_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END Error_Handler_Debug */
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief Reports the name of the source file and the source line number
|
||||
* where the assert_param error has occurred.
|
||||
* @param file: pointer to the source file name
|
||||
* @param line: assert_param error line source number
|
||||
* @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,
|
||||
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
/* USER CODE END 6 */
|
||||
}
|
||||
#endif /* USE_FULL_ASSERT */
|
|
@ -0,0 +1,109 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the RTC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "rtc.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
RTC_HandleTypeDef hrtc;
|
||||
|
||||
/* RTC init function */
|
||||
void MX_RTC_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 0 */
|
||||
|
||||
/* USER CODE END RTC_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 1 */
|
||||
|
||||
/* USER CODE END RTC_Init 1 */
|
||||
|
||||
/** Initialize RTC Only
|
||||
*/
|
||||
hrtc.Instance = RTC;
|
||||
hrtc.Init.AsynchPrediv = 127;
|
||||
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
|
||||
hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
|
||||
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
|
||||
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
|
||||
hrtc.Init.OutPutPullUp = RTC_OUTPUT_PULLUP_NONE;
|
||||
hrtc.Init.BinMode = RTC_BINARY_ONLY;
|
||||
if (HAL_RTC_Init(&hrtc) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN RTC_Init 2 */
|
||||
|
||||
/* USER CODE END RTC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
|
||||
{
|
||||
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
if(rtcHandle->Instance==RTC)
|
||||
{
|
||||
/* USER CODE BEGIN RTC_MspInit 0 */
|
||||
|
||||
/* USER CODE END RTC_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
|
||||
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* RTC clock enable */
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
__HAL_RCC_RTCAPB_CLK_ENABLE();
|
||||
/* USER CODE BEGIN RTC_MspInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_RTC_MspDeInit(RTC_HandleTypeDef* rtcHandle)
|
||||
{
|
||||
|
||||
if(rtcHandle->Instance==RTC)
|
||||
{
|
||||
/* USER CODE BEGIN RTC_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END RTC_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_RTC_DISABLE();
|
||||
__HAL_RCC_RTCAPB_CLK_DISABLE();
|
||||
/* USER CODE BEGIN RTC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -0,0 +1,78 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_hal_msp.c
|
||||
* @brief This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* External functions --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ExternalFunctions */
|
||||
|
||||
/* USER CODE END ExternalFunctions */
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
{
|
||||
/* USER CODE BEGIN MspInit 0 */
|
||||
|
||||
/* USER CODE END MspInit 0 */
|
||||
|
||||
/* System interrupt init*/
|
||||
|
||||
/* USER CODE BEGIN MspInit 1 */
|
||||
|
||||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -0,0 +1,259 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "stm32wlxx_it.h"
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory management fault.
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Prefetch fault, memory access fault.
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Undefined instruction or illegal state.
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 0 */
|
||||
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug monitor.
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 0 */
|
||||
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SysTick_IRQn 0 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 0 */
|
||||
HAL_IncTick();
|
||||
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 1 */
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32WLxx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file (startup_stm32wlxx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 0 Interrupt.
|
||||
*/
|
||||
void EXTI0_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN EXTI0_IRQn 0 */
|
||||
|
||||
/* USER CODE END EXTI0_IRQn 0 */
|
||||
HAL_GPIO_EXTI_IRQHandler(ALS_INT_Pin);
|
||||
/* USER CODE BEGIN EXTI0_IRQn 1 */
|
||||
|
||||
/* USER CODE END EXTI0_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 1 Interrupt.
|
||||
*/
|
||||
void EXTI1_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN EXTI1_IRQn 0 */
|
||||
|
||||
/* USER CODE END EXTI1_IRQn 0 */
|
||||
HAL_GPIO_EXTI_IRQHandler(IMU_INT1_Pin);
|
||||
/* USER CODE BEGIN EXTI1_IRQn 1 */
|
||||
|
||||
/* USER CODE END EXTI1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 2 Interrupt.
|
||||
*/
|
||||
void EXTI2_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN EXTI2_IRQn 0 */
|
||||
|
||||
/* USER CODE END EXTI2_IRQn 0 */
|
||||
HAL_GPIO_EXTI_IRQHandler(IMU_INT2_Pin);
|
||||
/* USER CODE BEGIN EXTI2_IRQn 1 */
|
||||
|
||||
/* USER CODE END EXTI2_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 3 Interrupt.
|
||||
*/
|
||||
void EXTI3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN EXTI3_IRQn 0 */
|
||||
|
||||
/* USER CODE END EXTI3_IRQn 0 */
|
||||
HAL_GPIO_EXTI_IRQHandler(TOF_GPIO_Pin);
|
||||
/* USER CODE BEGIN EXTI3_IRQn 1 */
|
||||
|
||||
/* USER CODE END EXTI3_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -0,0 +1,357 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32wlxx.c
|
||||
* @author MCD Application Team
|
||||
* @brief CMSIS Cortex Device Peripheral Access Layer System Source File
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
* This file provides two functions and one global variable to be called from
|
||||
* user application:
|
||||
* - SystemInit(): This function is called at startup just after reset and
|
||||
* before branch to main program. This call is made inside
|
||||
* the "startup_stm32wlxx.s" file.
|
||||
*
|
||||
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
|
||||
* by the user application to setup the SysTick
|
||||
* timer or configure other parameters.
|
||||
*
|
||||
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||
* be called whenever the core clock is changed
|
||||
* during program execution.
|
||||
*
|
||||
* After each device reset the MSI (4 MHz) is used as system clock source.
|
||||
* Then SystemInit() function is called, in "startup_stm32wlxx.s" file, to
|
||||
* configure the system clock before to branch to main program.
|
||||
*
|
||||
* This file configures the system clock as follows:
|
||||
*=============================================================================
|
||||
*-----------------------------------------------------------------------------
|
||||
* System Clock source | MSI
|
||||
*-----------------------------------------------------------------------------
|
||||
* SYSCLK(Hz) | 4000000
|
||||
*-----------------------------------------------------------------------------
|
||||
* HCLK(Hz) | 4000000
|
||||
*-----------------------------------------------------------------------------
|
||||
* AHB Prescaler | 1
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB1 Prescaler | 1
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB2 Prescaler | 1
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLL_M | 1
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLL_N | 8
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLL_P | 7
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLL_Q | 2
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLL_R | 2
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLLSAI1_P | NA
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLLSAI1_Q | NA
|
||||
*-----------------------------------------------------------------------------
|
||||
* PLLSAI1_R | NA
|
||||
*-----------------------------------------------------------------------------
|
||||
* Require 48MHz for USB OTG FS, | Disabled
|
||||
* SDIO and RNG clock |
|
||||
*-----------------------------------------------------------------------------
|
||||
*=============================================================================
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32WLxx_system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32WLxx_System_Private_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "stm32wlxx.h"
|
||||
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE (32000000UL) /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (MSI_VALUE)
|
||||
#define MSI_VALUE (4000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* MSI_VALUE */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE (16000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE (32000UL) /*!< Value of LSI in Hz*/
|
||||
#endif /* LSI_VALUE */
|
||||
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE (32768UL) /*!< Value of LSE in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Note: Following vector table addresses must be defined in line with linker
|
||||
configuration. */
|
||||
/*!< Uncomment the following line if you need to relocate CPU1 CM4 and/or CPU2
|
||||
CM0+ vector table anywhere in Sram or Flash. Else vector table will be kept
|
||||
at address 0x00 which correspond to automatic remap of boot address selected */
|
||||
/* #define USER_VECT_TAB_ADDRESS */
|
||||
#if defined(USER_VECT_TAB_ADDRESS)
|
||||
#ifdef CORE_CM0PLUS
|
||||
/*!< Uncomment this line for user vector table remap in Sram else user remap
|
||||
will be done in Flash. */
|
||||
/* #define VECT_TAB_SRAM */
|
||||
#if defined(VECT_TAB_SRAM)
|
||||
#define VECT_TAB_BASE_ADDRESS SRAM2_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x100. */
|
||||
#define VECT_TAB_OFFSET 0x00008000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x100. */
|
||||
#else
|
||||
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x100. */
|
||||
#define VECT_TAB_OFFSET 0x00020000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x100. */
|
||||
#endif
|
||||
#else /* CORE_CM4 */
|
||||
/*!< Uncomment this line for user vector table remap in Sram else user remap
|
||||
will be done in Flash. */
|
||||
/* #define VECT_TAB_SRAM */
|
||||
#if defined(VECT_TAB_SRAM)
|
||||
#define VECT_TAB_BASE_ADDRESS SRAM1_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#else
|
||||
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
/* The SystemCoreClock variable is updated in three ways:
|
||||
1) from within HAL_Init()
|
||||
2) by calling CMSIS function SystemCoreClockUpdate()
|
||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
*/
|
||||
uint32_t SystemCoreClock = 4000000UL; /*CPU1: M4 on MSI clock after startup (4MHz)*/
|
||||
|
||||
const uint32_t AHBPrescTable[16UL] = {1UL, 3UL, 5UL, 1UL, 1UL, 6UL, 10UL, 32UL, 2UL, 4UL, 8UL, 16UL, 64UL, 128UL, 256UL, 512UL};
|
||||
|
||||
const uint32_t APBPrescTable[8UL] = {0UL, 0UL, 0UL, 0UL, 1UL, 2UL, 3UL, 4UL};
|
||||
|
||||
const uint32_t MSIRangeTable[16UL] = {100000UL, 200000UL, 400000UL, 800000UL, 1000000UL, 2000000UL, \
|
||||
4000000UL, 8000000UL, 16000000UL, 24000000UL, 32000000UL, 48000000UL, 0UL, 0UL, 0UL, 0UL}; /* 0UL values are incorrect cases */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLxx_System_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Setup the microcontroller system.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemInit(void)
|
||||
{
|
||||
#if defined(USER_VECT_TAB_ADDRESS)
|
||||
/* Configure the Vector Table location add offset address ------------------*/
|
||||
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
|
||||
#endif
|
||||
|
||||
/* FPU settings ------------------------------------------------------------*/
|
||||
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||
SCB->CPACR |= ((3UL << (10UL*2UL))|(3UL << (11UL*2UL))); /* set CP10 and CP11 Full Access */
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
||||
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
||||
* be used by the user application to setup the SysTick timer or configure
|
||||
* other parameters.
|
||||
*
|
||||
* @note Each time the core clock (HCLK) changes, this function must be called
|
||||
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||
* based on this variable will be incorrect.
|
||||
*
|
||||
* @note - The system frequency computed by this function is not the real
|
||||
* frequency in the chip. It is calculated based on the predefined
|
||||
* constant and the selected clock source:
|
||||
*
|
||||
* - If SYSCLK source is MSI, SystemCoreClock will contain the MSI_VALUE(*)
|
||||
*
|
||||
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(**)
|
||||
*
|
||||
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
|
||||
*
|
||||
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(***)
|
||||
* or HSI_VALUE(*) or MSI_VALUE(*) multiplied/divided by the PLL factors.
|
||||
*
|
||||
* (*) MSI_VALUE is a constant defined in stm32wlxx_hal.h file (default value
|
||||
* 4 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (**) HSI_VALUE is a constant defined in stm32wlxx_hal_conf.h file (default value
|
||||
* 16 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (***) HSE_VALUE is a constant defined in stm32wlxx_hal_conf.h file (default value
|
||||
* 32 MHz), user has to ensure that HSE_VALUE is same as the real
|
||||
* frequency of the crystal used. Otherwise, this function may
|
||||
* have wrong result.
|
||||
*
|
||||
* - The result of this function could be not correct when using fractional
|
||||
* value for HSE crystal.
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemCoreClockUpdate(void)
|
||||
{
|
||||
uint32_t tmp, msirange, pllvco, pllr, pllsource , pllm;
|
||||
|
||||
/* Get MSI Range frequency--------------------------------------------------*/
|
||||
|
||||
/* Get MSI Range frequency--------------------------------------------------*/
|
||||
if((RCC->CR & RCC_CR_MSIRGSEL) == 0U)
|
||||
{ /* MSISRANGE from RCC_CSR applies */
|
||||
msirange = (RCC->CSR & RCC_CSR_MSISRANGE) >> 8U;
|
||||
}
|
||||
else
|
||||
{ /* MSIRANGE from RCC_CR applies */
|
||||
msirange = (RCC->CR & RCC_CR_MSIRANGE) >> 4U;
|
||||
}
|
||||
/*MSI frequency range in HZ*/
|
||||
msirange = MSIRangeTable[msirange];
|
||||
|
||||
|
||||
/*SystemCoreClock=HAL_RCC_GetSysClockFreq();*/
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
switch (RCC->CFGR & RCC_CFGR_SWS)
|
||||
{
|
||||
case 0x00: /* MSI used as system clock source */
|
||||
SystemCoreClock = msirange;
|
||||
break;
|
||||
|
||||
case 0x04: /* HSI used as system clock source */
|
||||
/* HSI used as system clock source */
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
|
||||
case 0x08: /* HSE used as system clock source */
|
||||
SystemCoreClock = HSE_VALUE;
|
||||
break;
|
||||
|
||||
case 0x0C: /* PLL used as system clock source */
|
||||
/* PLL_VCO = (HSE_VALUE or HSI_VALUE or MSI_VALUE/ PLLM) * PLLN
|
||||
SYSCLK = PLL_VCO / PLLR
|
||||
*/
|
||||
pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
|
||||
pllm = ((RCC->PLLCFGR & RCC_PLLCFGR_PLLM) >> RCC_PLLCFGR_PLLM_Pos) + 1UL ;
|
||||
|
||||
switch (pllsource)
|
||||
{
|
||||
case 0x02: /* HSI used as PLL clock source */
|
||||
pllvco = (HSI_VALUE / pllm);
|
||||
break;
|
||||
|
||||
case 0x03: /* HSE used as PLL clock source */
|
||||
pllvco = (HSE_VALUE / pllm);
|
||||
break;
|
||||
|
||||
default: /* MSI used as PLL clock source */
|
||||
pllvco = (msirange / pllm);
|
||||
break;
|
||||
}
|
||||
|
||||
pllvco = pllvco * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos);
|
||||
pllr = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLR) >> RCC_PLLCFGR_PLLR_Pos) + 1UL);
|
||||
|
||||
SystemCoreClock = pllvco/pllr;
|
||||
break;
|
||||
|
||||
default:
|
||||
SystemCoreClock = msirange;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compute HCLK clock frequency --------------------------------------------*/
|
||||
#if defined(DUAL_CORE) && defined(CORE_CM0PLUS)
|
||||
/* Get HCLK2 prescaler */
|
||||
tmp = AHBPrescTable[((RCC->EXTCFGR & RCC_EXTCFGR_C2HPRE) >> RCC_EXTCFGR_C2HPRE_Pos)];
|
||||
#else
|
||||
/* Get HCLK1 prescaler */
|
||||
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos)];
|
||||
#endif
|
||||
|
||||
/* Core clock frequency */
|
||||
SystemCoreClock = SystemCoreClock / tmp;
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -0,0 +1,201 @@
|
|||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.19.2] date: [Wed Jul 05 08:20:01 CST 2023]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
# Generic Makefile (based on gcc)
|
||||
#
|
||||
# ChangeLog :
|
||||
# 2017-02-10 - Several enhancements + project update mode
|
||||
# 2015-07-22 - first version
|
||||
# ------------------------------------------------
|
||||
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
TARGET = STM32WLE5CBUx
|
||||
|
||||
|
||||
######################################
|
||||
# building variables
|
||||
######################################
|
||||
# debug build?
|
||||
DEBUG = 1
|
||||
# optimization
|
||||
OPT = -Og
|
||||
|
||||
|
||||
#######################################
|
||||
# paths
|
||||
#######################################
|
||||
# Build path
|
||||
BUILD_DIR = build
|
||||
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES = \
|
||||
Core/Src/main.c \
|
||||
Core/Src/stm32wlxx_it.c \
|
||||
Core/Src/stm32wlxx_hal_msp.c \
|
||||
Core/Src/system_stm32wlxx.c \
|
||||
Core/Src/gpio.c \
|
||||
Core/Src/rtc.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rcc.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rcc_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_flash.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_flash_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_gpio.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_dma.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_dma_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_pwr.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_pwr_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_cortex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_exti.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_tim.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_tim_ex.c \
|
||||
Core/Src/i2c.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_i2c.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_i2c_ex.c \
|
||||
Core/Src/adc.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_adc.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_adc_ex.c \
|
||||
/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_ll_adc.c
|
||||
|
||||
# ASM sources
|
||||
ASM_SOURCES = \
|
||||
startup_stm32wle5xx.s
|
||||
|
||||
|
||||
#######################################
|
||||
# binaries
|
||||
#######################################
|
||||
PREFIX = arm-none-eabi-
|
||||
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
|
||||
# either it can be added to the PATH environment variable.
|
||||
ifdef GCC_PATH
|
||||
CC = $(GCC_PATH)/$(PREFIX)gcc
|
||||
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
|
||||
CP = $(GCC_PATH)/$(PREFIX)objcopy
|
||||
SZ = $(GCC_PATH)/$(PREFIX)size
|
||||
else
|
||||
CC = $(PREFIX)gcc
|
||||
AS = $(PREFIX)gcc -x assembler-with-cpp
|
||||
CP = $(PREFIX)objcopy
|
||||
SZ = $(PREFIX)size
|
||||
endif
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary -S
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
# cpu
|
||||
CPU = -mcpu=cortex-m4
|
||||
|
||||
# fpu
|
||||
# NONE for Cortex-M0/M0+/M3
|
||||
|
||||
# float-abi
|
||||
|
||||
|
||||
# mcu
|
||||
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
||||
|
||||
# macros for gcc
|
||||
# AS defines
|
||||
AS_DEFS =
|
||||
|
||||
# C defines
|
||||
C_DEFS = \
|
||||
-DCORE_CM4 \
|
||||
-DUSE_HAL_DRIVER \
|
||||
-DSTM32WLE5xx
|
||||
|
||||
|
||||
# AS includes
|
||||
AS_INCLUDES =
|
||||
|
||||
# C includes
|
||||
C_INCLUDES = \
|
||||
-ICore/Inc \
|
||||
-I/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Inc \
|
||||
-I/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/STM32WLxx_HAL_Driver/Inc/Legacy \
|
||||
-I/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/CMSIS/Device/ST/STM32WLxx/Include \
|
||||
-I/home/imi415/Documents/Hardwares/STM32_Projects/Pudding_LWNode/template/SDK/Drivers/CMSIS/Include
|
||||
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -g -gdwarf-2
|
||||
endif
|
||||
|
||||
|
||||
# Generate dependency information
|
||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
|
||||
|
||||
#######################################
|
||||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = STM32WLE5XX_FLASH.ld
|
||||
|
||||
# libraries
|
||||
LIBS = -lc -lm -lnosys
|
||||
LIBDIR =
|
||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
||||
|
||||
# default action: build all
|
||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
||||
|
||||
|
||||
#######################################
|
||||
# build the application
|
||||
#######################################
|
||||
# list of objects
|
||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
||||
# list of ASM program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(HEX) $< $@
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
#######################################
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
# *** EOF ***
|
|
@ -0,0 +1,233 @@
|
|||
#MicroXplorer Configuration settings - do not modify
|
||||
ADC.IPParameters=NbrOfConversion,SelectedChannel
|
||||
ADC.NbrOfConversion=1
|
||||
ADC.SelectedChannel=ADC_CHANNEL_8
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
I2C1.I2C_Speed_Mode=I2C_Fast
|
||||
I2C1.IPParameters=Timing,I2C_Speed_Mode
|
||||
I2C1.Timing=0x2010091A
|
||||
KeepUserPlacement=false
|
||||
Mcu.CPN=STM32WLE5CBU6
|
||||
Mcu.Family=STM32WL
|
||||
Mcu.IP0=ADC
|
||||
Mcu.IP1=DEBUG
|
||||
Mcu.IP2=I2C1
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=RTC
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IPNb=7
|
||||
Mcu.Name=STM32WLE5CBUx
|
||||
Mcu.Package=UFQFPN48
|
||||
Mcu.Pin0=PB3
|
||||
Mcu.Pin1=PA0
|
||||
Mcu.Pin10=PB2
|
||||
Mcu.Pin11=PA10
|
||||
Mcu.Pin12=PA12
|
||||
Mcu.Pin13=PA13
|
||||
Mcu.Pin14=PC14-OSC32_IN
|
||||
Mcu.Pin15=PC15-OSC32_OUT
|
||||
Mcu.Pin16=PA14
|
||||
Mcu.Pin17=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin18=VP_SYS_VS_Systick
|
||||
Mcu.Pin2=PA1
|
||||
Mcu.Pin3=PA2
|
||||
Mcu.Pin4=PA3
|
||||
Mcu.Pin5=PA4
|
||||
Mcu.Pin6=PA9
|
||||
Mcu.Pin7=OSC_IN
|
||||
Mcu.Pin8=OSC_OUT
|
||||
Mcu.Pin9=PB0-VDD_TCXO
|
||||
Mcu.PinsNb=19
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32WLE5CBUx
|
||||
MxCube.Version=6.8.1
|
||||
MxDb.Version=DB.6.0.81
|
||||
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.EXTI0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.EXTI1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.EXTI2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.EXTI3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
OSC_IN.Locked=true
|
||||
OSC_IN.Mode=HSE-External-Oscillator
|
||||
OSC_IN.Signal=RCC_OSC_IN
|
||||
OSC_OUT.Locked=true
|
||||
OSC_OUT.Mode=HSE-External-Oscillator
|
||||
OSC_OUT.Signal=RCC_OSC_OUT
|
||||
PA0.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PA0.GPIO_Label=ALS_INT
|
||||
PA0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PA0.GPIO_PuPd=GPIO_PULLUP
|
||||
PA0.Locked=true
|
||||
PA0.Signal=GPXTI0
|
||||
PA1.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PA1.GPIO_Label=IMU_INT1
|
||||
PA1.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PA1.GPIO_PuPd=GPIO_PULLUP
|
||||
PA1.Locked=true
|
||||
PA1.Signal=GPXTI1
|
||||
PA10.Locked=true
|
||||
PA10.Mode=I2C
|
||||
PA10.Signal=I2C1_SDA
|
||||
PA12.GPIOParameters=GPIO_Label
|
||||
PA12.GPIO_Label=VBAT
|
||||
PA12.Locked=true
|
||||
PA12.Mode=IN8
|
||||
PA12.Signal=ADC_IN8
|
||||
PA13.Locked=true
|
||||
PA13.Mode=Trace_Asynchronous_SW
|
||||
PA13.Signal=DEBUG_JTMS-SWDIO
|
||||
PA14.Locked=true
|
||||
PA14.Mode=Trace_Asynchronous_SW
|
||||
PA14.Signal=DEBUG_JTCK-SWCLK
|
||||
PA2.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PA2.GPIO_Label=IMU_INT2
|
||||
PA2.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PA2.GPIO_PuPd=GPIO_PULLUP
|
||||
PA2.Locked=true
|
||||
PA2.Signal=GPXTI2
|
||||
PA3.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PA3.GPIO_Label=TOF_GPIO
|
||||
PA3.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PA3.GPIO_PuPd=GPIO_PULLUP
|
||||
PA3.Locked=true
|
||||
PA3.Signal=GPXTI3
|
||||
PA4.GPIOParameters=GPIO_Label
|
||||
PA4.GPIO_Label=TOF_XSHUT
|
||||
PA4.Locked=true
|
||||
PA4.Signal=GPIO_Output
|
||||
PA9.Locked=true
|
||||
PA9.Mode=I2C
|
||||
PA9.Signal=I2C1_SCL
|
||||
PB0-VDD_TCXO.GPIOParameters=GPIO_Label
|
||||
PB0-VDD_TCXO.GPIO_Label=BTN
|
||||
PB0-VDD_TCXO.Locked=true
|
||||
PB0-VDD_TCXO.Signal=GPIO_Input
|
||||
PB2.GPIOParameters=PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP
|
||||
PB2.GPIO_Label=LED
|
||||
PB2.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
|
||||
PB2.GPIO_PuPd=GPIO_NOPULL
|
||||
PB2.Locked=true
|
||||
PB2.PinState=GPIO_PIN_SET
|
||||
PB2.Signal=GPIO_Output
|
||||
PB3.Locked=true
|
||||
PB3.Mode=Trace_Asynchronous_SW
|
||||
PB3.Signal=DEBUG_JTDO-SWO
|
||||
PC14-OSC32_IN.Locked=true
|
||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||
PC15-OSC32_OUT.Locked=true
|
||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||
PCC.SUBGHZ.FrequencyBand=High
|
||||
PCC.SUBGHZ.Modulation=FSK
|
||||
PCC.SUBGHZ.OptionalSettings=false
|
||||
PCC.SUBGHZ.Output.Power=14
|
||||
PCC.SUBGHZ.PowerAmplifier=Low Power
|
||||
PCC.SUBGHZ.RxBoosted=false
|
||||
PCC.SUBGHZ.SMPS=Off
|
||||
PinOutPanel.RotationAngle=0
|
||||
ProjectManager.AskForMigrate=true
|
||||
ProjectManager.BackupPrevious=false
|
||||
ProjectManager.CompilerOptimize=6
|
||||
ProjectManager.ComputerToolchain=false
|
||||
ProjectManager.CoupleFile=true
|
||||
ProjectManager.CustomerFirmwarePackage=../SDK
|
||||
ProjectManager.DefaultFWLocation=false
|
||||
ProjectManager.DeletePrevious=true
|
||||
ProjectManager.DeviceId=STM32WLE5CBUx
|
||||
ProjectManager.FirmwarePackage=STM32Cube FW_WL V1.3.0
|
||||
ProjectManager.FreePins=false
|
||||
ProjectManager.HalAssertFull=false
|
||||
ProjectManager.HeapSize=0x200
|
||||
ProjectManager.KeepUserCode=true
|
||||
ProjectManager.LastFirmware=true
|
||||
ProjectManager.LibraryCopy=2
|
||||
ProjectManager.MainLocation=Core/Src
|
||||
ProjectManager.NoMain=true
|
||||
ProjectManager.PreviousToolchain=
|
||||
ProjectManager.ProjectBuild=false
|
||||
ProjectManager.ProjectFileName=STM32WLE5CBUx.ioc
|
||||
ProjectManager.ProjectName=STM32WLE5CBUx
|
||||
ProjectManager.ProjectStructure=
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_RTC_Init-RTC-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_ADC_Init-ADC-false-HAL-true
|
||||
RCC.AHBFreq_Value=48000000
|
||||
RCC.APB1Freq_Value=48000000
|
||||
RCC.APB1TimFreq_Value=48000000
|
||||
RCC.APB2Freq_Value=48000000
|
||||
RCC.APB2TimFreq_Value=48000000
|
||||
RCC.APB3Freq_Value=48000000
|
||||
RCC.CortexFreq_Value=48000000
|
||||
RCC.FCLKCortexFreq_Value=48000000
|
||||
RCC.FamilyName=M
|
||||
RCC.HCLK3Freq_Value=48000000
|
||||
RCC.HCLKFreq_Value=48000000
|
||||
RCC.HSE_VALUE=32000000
|
||||
RCC.HSI_VALUE=16000000
|
||||
RCC.I2C1Freq_Value=48000000
|
||||
RCC.I2C2Freq_Value=48000000
|
||||
RCC.I2C3Freq_Value=48000000
|
||||
RCC.I2S2Freq_Value=16000000
|
||||
RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,APB3Freq_Value,CortexFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLK3Freq_Value,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2S2Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM3Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_Drive_Capability,LSE_VALUE,MCO1PinFreq_Value,MSIClockRange,PLLM,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLR,PLLRCLKFreq_Value,PLLSourceVirtual,PREFETCH_ENABLE,PWRFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,USART1Freq_Value,USART2Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value
|
||||
RCC.LPTIM1Freq_Value=48000000
|
||||
RCC.LPTIM2Freq_Value=48000000
|
||||
RCC.LPTIM3Freq_Value=48000000
|
||||
RCC.LPUART1Freq_Value=48000000
|
||||
RCC.LSCOPinFreq_Value=32000
|
||||
RCC.LSE_Drive_Capability=RCC_LSEDRIVE_LOW
|
||||
RCC.LSE_VALUE=32768
|
||||
RCC.MCO1PinFreq_Value=48000000
|
||||
RCC.MSIClockRange=RCC_MSIRANGE_5
|
||||
RCC.PLLM=RCC_PLLM_DIV4
|
||||
RCC.PLLN=18
|
||||
RCC.PLLPoutputFreq_Value=72000000
|
||||
RCC.PLLQoutputFreq_Value=72000000
|
||||
RCC.PLLR=RCC_PLLR_DIV3
|
||||
RCC.PLLRCLKFreq_Value=48000000
|
||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||
RCC.PREFETCH_ENABLE=1
|
||||
RCC.PWRFreq_Value=48000000
|
||||
RCC.RNGFreq_Value=32000
|
||||
RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE
|
||||
RCC.RTCFreq_Value=32768
|
||||
RCC.SYSCLKFreq_VALUE=48000000
|
||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||
RCC.USART1Freq_Value=48000000
|
||||
RCC.USART2Freq_Value=48000000
|
||||
RCC.VCOInputFreq_Value=8000000
|
||||
RCC.VCOOutputFreq_Value=144000000
|
||||
RTC.BinMode=RTC_BINARY_ONLY
|
||||
RTC.IPParameters=BinMode
|
||||
SH.GPXTI0.0=GPIO_EXTI0
|
||||
SH.GPXTI0.ConfNb=1
|
||||
SH.GPXTI1.0=GPIO_EXTI1
|
||||
SH.GPXTI1.ConfNb=1
|
||||
SH.GPXTI2.0=GPIO_EXTI2
|
||||
SH.GPXTI2.ConfNb=1
|
||||
SH.GPXTI3.0=GPIO_EXTI3
|
||||
SH.GPXTI3.ConfNb=1
|
||||
VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
|
||||
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
board=custom
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
** LinkerScript
|
||||
** Note: For specific memory allocation, linker and startup files must be customized.
|
||||
** Refer to STM32CubeIDE user guide (UM2609), chapter "Modify the linker script".
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = ORIGIN(RAM1) + LENGTH(RAM1); /* end of "SRAM1" Ram type memory */
|
||||
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
/* Memories definition */
|
||||
MEMORY
|
||||
{
|
||||
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 256K
|
||||
RAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 32K /* Non-backup SRAM1 */
|
||||
RAM2 (xrw) : ORIGIN = 0x20008000, LENGTH = 32K /* Backup SRAM2 */
|
||||
}
|
||||
|
||||
/* Sections */
|
||||
SECTIONS
|
||||
{
|
||||
/* The startup code into "ROM" Rom type memory */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
/* The program code and other data into "ROM" Rom type memory */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.glue_7) /* glue arm to thumb code */
|
||||
*(.glue_7t) /* glue thumb to arm code */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(8);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >ROM
|
||||
|
||||
/* Constant data into "ROM" Rom type memory */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
.ARM.extab : {
|
||||
. = ALIGN(8);
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
.ARM : {
|
||||
. = ALIGN(8);
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
.init_array :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
.fini_array :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
. = ALIGN(8);
|
||||
} >ROM
|
||||
|
||||
/* Used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
/* Initialized data sections into "SRAM1" Ram type memory */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
|
||||
. = ALIGN(8);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
|
||||
} >RAM1 AT> ROM
|
||||
|
||||
/* Uninitialized data section into "SRAM1" Ram type memory */
|
||||
. = ALIGN(8);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss section */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(8);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM1
|
||||
|
||||
/* Data section into "SRAM1" Ram type memory: Non-backup SRAM1 dedicated to CM4 */
|
||||
. = ALIGN(8);
|
||||
RAM1_region :
|
||||
{
|
||||
_sRAM1_region = .; /* define a global symbol at section start */
|
||||
*(.RAM1_region)
|
||||
|
||||
. = ALIGN(8);
|
||||
_eRAM1_region = .; /* define a global symbol at section end */
|
||||
} >RAM1
|
||||
|
||||
/* Data section into "SRAM2" Ram type memory: Backup SRAM2 dedicated to CM4 */
|
||||
. = ALIGN(8);
|
||||
RAM2_region :
|
||||
{
|
||||
_sRAM2_region = .; /* define a global symbol at section start */
|
||||
*(.RAM2_region)
|
||||
|
||||
. = ALIGN(8);
|
||||
_eRAM2_region = .; /* define a global symbol at section end */
|
||||
} >RAM2
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough "SRAM1" Ram type memory left */
|
||||
._user_heap_stack :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(8);
|
||||
} >RAM1
|
||||
|
||||
/* Remove information from the compiler libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
|
@ -0,0 +1,424 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file startup_stm32wle5xx.s
|
||||
* @author MCD Application Team
|
||||
* @brief STM32WLE5xx devices vector table for GCC toolchain.
|
||||
* This module performs:
|
||||
* - Set the initial SP
|
||||
* - Set the initial PC == Reset_Handler,
|
||||
* - Set the vector table entries with the exceptions ISR address,
|
||||
* - Branches to main in the C library (which eventually
|
||||
* calls main()).
|
||||
* After Reset the Cortex-M4 processor is in Thread mode,
|
||||
* priority is Privileged, and the Stack is set to Main.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m4
|
||||
.fpu softvfp
|
||||
.thumb
|
||||
|
||||
.global g_pfnVectors
|
||||
.global Default_Handler
|
||||
|
||||
/* start address for the initialization values of the .data section.
|
||||
defined in linker script */
|
||||
.word _sidata
|
||||
/* start address for the .data section. defined in linker script */
|
||||
.word _sdata
|
||||
/* end address for the .data section. defined in linker script */
|
||||
.word _edata
|
||||
/* start address for the .bss section. defined in linker script */
|
||||
.word _sbss
|
||||
/* end address for the .bss section. defined in linker script */
|
||||
.word _ebss
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor first
|
||||
* starts execution following a reset event. Only the absolutely
|
||||
* necessary set is performed, after which the application
|
||||
* supplied main() routine is called.
|
||||
* @param None
|
||||
* @retval : None
|
||||
*/
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr r0, =_estack
|
||||
mov sp, r0 /* set stack pointer */
|
||||
|
||||
/* Call the clock system initialization function.*/
|
||||
bl SystemInit
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
ldr r0, =_sdata
|
||||
ldr r1, =_edata
|
||||
ldr r2, =_sidata
|
||||
movs r3, #0
|
||||
b LoopCopyDataInit
|
||||
|
||||
CopyDataInit:
|
||||
ldr r4, [r2, r3]
|
||||
str r4, [r0, r3]
|
||||
adds r3, r3, #4
|
||||
|
||||
LoopCopyDataInit:
|
||||
adds r4, r0, r3
|
||||
cmp r4, r1
|
||||
bcc CopyDataInit
|
||||
|
||||
/* Zero fill the bss segment. */
|
||||
ldr r2, =_sbss
|
||||
ldr r4, =_ebss
|
||||
movs r3, #0
|
||||
b LoopFillZerobss
|
||||
|
||||
FillZerobss:
|
||||
str r3, [r2]
|
||||
adds r2, r2, #4
|
||||
|
||||
LoopFillZerobss:
|
||||
cmp r2, r4
|
||||
bcc FillZerobss
|
||||
|
||||
/* Call static constructors */
|
||||
bl __libc_init_array
|
||||
/* Call the application's entry point.*/
|
||||
bl main
|
||||
|
||||
LoopForever:
|
||||
b LoopForever
|
||||
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
* the system state for examination by a debugger.
|
||||
*
|
||||
* @param None
|
||||
* @retval : None
|
||||
*/
|
||||
.section .text.Default_Handler,"ax",%progbits
|
||||
Default_Handler:
|
||||
Infinite_Loop:
|
||||
b Infinite_Loop
|
||||
.size Default_Handler, .-Default_Handler
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* The STM32WLE5xx vector table. Note that the proper constructs
|
||||
* must be placed on this to ensure that it ends up at physical address
|
||||
* 0x0000.0000.
|
||||
*
|
||||
******************************************************************************/
|
||||
.section .isr_vector,"a",%progbits
|
||||
.type g_pfnVectors, %object
|
||||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
g_pfnVectors:
|
||||
.word _estack
|
||||
.word Reset_Handler
|
||||
.word NMI_Handler
|
||||
.word HardFault_Handler
|
||||
.word MemManage_Handler
|
||||
.word BusFault_Handler
|
||||
.word UsageFault_Handler
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word SVC_Handler
|
||||
.word DebugMon_Handler
|
||||
.word 0
|
||||
.word PendSV_Handler
|
||||
.word SysTick_Handler
|
||||
.word WWDG_IRQHandler /* Window Watchdog interrupt */
|
||||
.word PVD_PVM_IRQHandler /* PVD and PVM interrupt through EXTI */
|
||||
.word TAMP_STAMP_LSECSS_SSRU_IRQHandler /* RTC Tamper, RTC TimeStamp, LSECSS and RTC SSRU int.*/
|
||||
.word RTC_WKUP_IRQHandler /* RTC wakeup interrupt through EXTI[19] */
|
||||
.word FLASH_IRQHandler /* Flash memory global interrupt and Flash memory ECC */
|
||||
.word RCC_IRQHandler /* RCC global interrupt */
|
||||
.word EXTI0_IRQHandler /* EXTI line 0 interrupt */
|
||||
.word EXTI1_IRQHandler /* EXTI line 1 interrupt */
|
||||
.word EXTI2_IRQHandler /* EXTI line 2 interrupt */
|
||||
.word EXTI3_IRQHandler /* EXTI line 3 interrupt */
|
||||
.word EXTI4_IRQHandler /* EXTI line 4 interrupt */
|
||||
.word DMA1_Channel1_IRQHandler /* DMA1 channel 1 interrupt */
|
||||
.word DMA1_Channel2_IRQHandler /* DMA1 channel 2 interrupt */
|
||||
.word DMA1_Channel3_IRQHandler /* DMA1 channel 3 interrupt */
|
||||
.word DMA1_Channel4_IRQHandler /* DMA1 channel 4 interrupt */
|
||||
.word DMA1_Channel5_IRQHandler /* DMA1 channel 5 interrupt */
|
||||
.word DMA1_Channel6_IRQHandler /* DMA1 channel 6 interrupt */
|
||||
.word DMA1_Channel7_IRQHandler /* DMA1 channel 7 interrupt */
|
||||
.word ADC_IRQHandler /* ADC interrupt */
|
||||
.word DAC_IRQHandler /* DAC interrupt */
|
||||
.word 0 /* Reserved */
|
||||
.word COMP_IRQHandler /* COMP1 and COMP2 interrupt through EXTI */
|
||||
.word EXTI9_5_IRQHandler /* EXTI line 9_5 interrupt */
|
||||
.word TIM1_BRK_IRQHandler /* Timer 1 break interrupt */
|
||||
.word TIM1_UP_IRQHandler /* Timer 1 Update */
|
||||
.word TIM1_TRG_COM_IRQHandler /* Timer 1 trigger and communication */
|
||||
.word TIM1_CC_IRQHandler /* Timer 1 capture compare interrupt */
|
||||
.word TIM2_IRQHandler /* TIM2 global interrupt */
|
||||
.word TIM16_IRQHandler /* Timer 16 global interrupt */
|
||||
.word TIM17_IRQHandler /* Timer 17 global interrupt */
|
||||
.word I2C1_EV_IRQHandler /* I2C1 event interrupt */
|
||||
.word I2C1_ER_IRQHandler /* I2C1 event interrupt */
|
||||
.word I2C2_EV_IRQHandler /* I2C2 error interrupt */
|
||||
.word I2C2_ER_IRQHandler /* I2C2 error interrupt */
|
||||
.word SPI1_IRQHandler /* SPI1 global interrupt */
|
||||
.word SPI2_IRQHandler /* SPI2 global interrupt */
|
||||
.word USART1_IRQHandler /* USART1 global interrupt */
|
||||
.word USART2_IRQHandler /* USART2 global interrupt */
|
||||
.word LPUART1_IRQHandler /* LPUART1 global interrupt */
|
||||
.word LPTIM1_IRQHandler /* LPtimer 1 global interrupt */
|
||||
.word LPTIM2_IRQHandler /* LPtimer 2 global interrupt */
|
||||
.word EXTI15_10_IRQHandler /* EXTI line 15_10] interrupt through EXTI */
|
||||
.word RTC_Alarm_IRQHandler /* RTC Alarms A & B interrupt */
|
||||
.word LPTIM3_IRQHandler /* LPtimer 3 global interrupt */
|
||||
.word SUBGHZSPI_IRQHandler /* SUBGHZSPI global interrupt */
|
||||
.word 0 /* Reserved */
|
||||
.word 0 /* Reserved */
|
||||
.word HSEM_IRQHandler /* Semaphore interrupt 0 to CPU1 */
|
||||
.word I2C3_EV_IRQHandler /* I2C3 event interrupt */
|
||||
.word I2C3_ER_IRQHandler /* I2C3 error interrupt */
|
||||
.word SUBGHZ_Radio_IRQHandler /* Radio IRQs RFBUSY interrupt through EXTI */
|
||||
.word AES_IRQHandler /* AES global interrupt */
|
||||
.word RNG_IRQHandler /* RNG interrupt */
|
||||
.word PKA_IRQHandler /* PKA interrupt */
|
||||
.word DMA2_Channel1_IRQHandler /* DMA2 channel 1 interrupt */
|
||||
.word DMA2_Channel2_IRQHandler /* DMA2 channel 2 interrupt */
|
||||
.word DMA2_Channel3_IRQHandler /* DMA2 channel 3 interrupt */
|
||||
.word DMA2_Channel4_IRQHandler /* DMA2 channel 4 interrupt */
|
||||
.word DMA2_Channel5_IRQHandler /* DMA2 channel 5 interrupt */
|
||||
.word DMA2_Channel6_IRQHandler /* DMA2 channel 6 interrupt */
|
||||
.word DMA2_Channel7_IRQHandler /* DMA2 channel 7 interrupt */
|
||||
.word DMAMUX1_OVR_IRQHandler /* DMAMUX overrun interrupt */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Provide weak aliases for each Exception handler to the Default_Handler.
|
||||
* As they are weak aliases, any function with the same name will override
|
||||
* this definition.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
.weak NMI_Handler
|
||||
.thumb_set NMI_Handler,Default_Handler
|
||||
|
||||
.weak HardFault_Handler
|
||||
.thumb_set HardFault_Handler,Default_Handler
|
||||
|
||||
.weak MemManage_Handler
|
||||
.thumb_set MemManage_Handler,Default_Handler
|
||||
|
||||
.weak BusFault_Handler
|
||||
.thumb_set BusFault_Handler,Default_Handler
|
||||
|
||||
.weak UsageFault_Handler
|
||||
.thumb_set UsageFault_Handler,Default_Handler
|
||||
|
||||
.weak SVC_Handler
|
||||
.thumb_set SVC_Handler,Default_Handler
|
||||
|
||||
.weak DebugMon_Handler
|
||||
.thumb_set DebugMon_Handler,Default_Handler
|
||||
|
||||
.weak PendSV_Handler
|
||||
.thumb_set PendSV_Handler,Default_Handler
|
||||
|
||||
.weak SysTick_Handler
|
||||
.thumb_set SysTick_Handler,Default_Handler
|
||||
|
||||
.weak WWDG_IRQHandler
|
||||
.thumb_set WWDG_IRQHandler,Default_Handler
|
||||
|
||||
.weak PVD_PVM_IRQHandler
|
||||
.thumb_set PVD_PVM_IRQHandler,Default_Handler
|
||||
|
||||
.weak TAMP_STAMP_LSECSS_SSRU_IRQHandler
|
||||
.thumb_set TAMP_STAMP_LSECSS_SSRU_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_WKUP_IRQHandler
|
||||
.thumb_set RTC_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak FLASH_IRQHandler
|
||||
.thumb_set FLASH_IRQHandler,Default_Handler
|
||||
|
||||
.weak RCC_IRQHandler
|
||||
.thumb_set RCC_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI0_IRQHandler
|
||||
.thumb_set EXTI0_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI1_IRQHandler
|
||||
.thumb_set EXTI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI2_IRQHandler
|
||||
.thumb_set EXTI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI3_IRQHandler
|
||||
.thumb_set EXTI3_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI4_IRQHandler
|
||||
.thumb_set EXTI4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel1_IRQHandler
|
||||
.thumb_set DMA1_Channel1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel2_IRQHandler
|
||||
.thumb_set DMA1_Channel2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel3_IRQHandler
|
||||
.thumb_set DMA1_Channel3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel4_IRQHandler
|
||||
.thumb_set DMA1_Channel4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel5_IRQHandler
|
||||
.thumb_set DMA1_Channel5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel6_IRQHandler
|
||||
.thumb_set DMA1_Channel6_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel7_IRQHandler
|
||||
.thumb_set DMA1_Channel7_IRQHandler,Default_Handler
|
||||
|
||||
.weak ADC_IRQHandler
|
||||
.thumb_set ADC_IRQHandler,Default_Handler
|
||||
|
||||
.weak DAC_IRQHandler
|
||||
.thumb_set DAC_IRQHandler,Default_Handler
|
||||
|
||||
.weak COMP_IRQHandler
|
||||
.thumb_set COMP_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI9_5_IRQHandler
|
||||
.thumb_set EXTI9_5_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_BRK_IRQHandler
|
||||
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_UP_IRQHandler
|
||||
.thumb_set TIM1_UP_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_TRG_COM_IRQHandler
|
||||
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_CC_IRQHandler
|
||||
.thumb_set TIM1_CC_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM2_IRQHandler
|
||||
.thumb_set TIM2_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM16_IRQHandler
|
||||
.thumb_set TIM16_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM17_IRQHandler
|
||||
.thumb_set TIM17_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_EV_IRQHandler
|
||||
.thumb_set I2C1_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_ER_IRQHandler
|
||||
.thumb_set I2C1_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C2_EV_IRQHandler
|
||||
.thumb_set I2C2_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C2_ER_IRQHandler
|
||||
.thumb_set I2C2_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI1_IRQHandler
|
||||
.thumb_set SPI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI2_IRQHandler
|
||||
.thumb_set SPI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART1_IRQHandler
|
||||
.thumb_set USART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART2_IRQHandler
|
||||
.thumb_set USART2_IRQHandler,Default_Handler
|
||||
|
||||
.weak LPUART1_IRQHandler
|
||||
.thumb_set LPUART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak LPTIM1_IRQHandler
|
||||
.thumb_set LPTIM1_IRQHandler,Default_Handler
|
||||
|
||||
.weak LPTIM2_IRQHandler
|
||||
.thumb_set LPTIM2_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI15_10_IRQHandler
|
||||
.thumb_set EXTI15_10_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_Alarm_IRQHandler
|
||||
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
|
||||
|
||||
.weak LPTIM3_IRQHandler
|
||||
.thumb_set LPTIM3_IRQHandler,Default_Handler
|
||||
|
||||
.weak SUBGHZSPI_IRQHandler
|
||||
.thumb_set SUBGHZSPI_IRQHandler,Default_Handler
|
||||
|
||||
.weak HSEM_IRQHandler
|
||||
.thumb_set HSEM_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C3_EV_IRQHandler
|
||||
.thumb_set I2C3_EV_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C3_ER_IRQHandler
|
||||
.thumb_set I2C3_ER_IRQHandler,Default_Handler
|
||||
|
||||
.weak SUBGHZ_Radio_IRQHandler
|
||||
.thumb_set SUBGHZ_Radio_IRQHandler,Default_Handler
|
||||
|
||||
.weak AES_IRQHandler
|
||||
.thumb_set AES_IRQHandler,Default_Handler
|
||||
|
||||
.weak RNG_IRQHandler
|
||||
.thumb_set RNG_IRQHandler,Default_Handler
|
||||
|
||||
.weak PKA_IRQHandler
|
||||
.thumb_set PKA_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel1_IRQHandler
|
||||
.thumb_set DMA2_Channel1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel2_IRQHandler
|
||||
.thumb_set DMA2_Channel2_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel3_IRQHandler
|
||||
.thumb_set DMA2_Channel3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel4_IRQHandler
|
||||
.thumb_set DMA2_Channel4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel5_IRQHandler
|
||||
.thumb_set DMA2_Channel5_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel6_IRQHandler
|
||||
.thumb_set DMA2_Channel6_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel7_IRQHandler
|
||||
.thumb_set DMA2_Channel7_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMAMUX1_OVR_IRQHandler
|
||||
.thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler
|
||||
|
||||
.weak SystemInit
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 5b47f70ce5f9016b92a8bedb037d00d86b7c8080
|
|
@ -0,0 +1,17 @@
|
|||
# Poor old Windows...
|
||||
if(WIN32)
|
||||
set(CMAKE_SYSTEM_NAME "Generic")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
|
||||
|
||||
# Optionally set size binary name, for elf section size reporting.
|
||||
set(TARGET_TOOLCHAIN_SIZE arm-none-eabi-size)
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "-mcpu=cortex-m4 -mthumb -mfloat-abi=soft")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-mcpu=cortex-m4 -mthumb -mfloat-abi=soft")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-specs=nano.specs -specs=nosys.specs -Wl,--print-memory-usage -Wl,--no-warn-rwx-segments")
|
||||
|
||||
# Make CMake happy about those compilers
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32wlxx_nucleo_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief STM32WLxx_Nucleo board configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2020-2021 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32WLXX_NUCLEO_CONF_H
|
||||
#define STM32WLXX_NUCLEO_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_CONFIG CONFIG
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_CONFIG_Exported_Constants Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* COM usage define */
|
||||
#define USE_BSP_COM_FEATURE 0U
|
||||
|
||||
/* COM log define */
|
||||
#define USE_COM_LOG 0U
|
||||
|
||||
/* IRQ priorities */
|
||||
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_CONF_H */
|
|
@ -0,0 +1,7 @@
|
|||
#include "stm32wlxx_hal.h"
|
||||
|
||||
int _write(int file, char *ptr, int len) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
}
|
||||
return len;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* MX Generated headers */
|
||||
#include "gpio.h"
|
||||
#include "i2c.h"
|
||||
#include "main.h"
|
||||
#include "rtc.h"
|
||||
|
||||
/* BSP */
|
||||
#include "stm32wlxx_nucleo.h"
|
||||
#include "stm32wlxx_nucleo_radio.h"
|
||||
|
||||
extern void SystemClock_Config(void);
|
||||
|
||||
|
||||
int main(void) {
|
||||
/* HAL */
|
||||
HAL_Init();
|
||||
|
||||
/* Hardware initialization */
|
||||
SystemClock_Config();
|
||||
MX_GPIO_Init();
|
||||
MX_RTC_Init();
|
||||
MX_I2C1_Init();
|
||||
|
||||
printf("Hello world\r\n");
|
||||
|
||||
for (;;) {
|
||||
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
|
||||
HAL_Delay(500);
|
||||
|
||||
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||
/* -- */
|
||||
}
|
Loading…
Reference in New Issue