Initial commit with SWSD003.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
7fe71f4faf
commit
75e2d4fb30
|
@ -14,4 +14,4 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- mkdir build && cd build
|
- mkdir build && cd build
|
||||||
- cmake -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi.cmake ..
|
- cmake -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi.cmake ..
|
||||||
- make yzl_wle5_template_FLASH.elf
|
- make yzl_wle5_lora_FLASH.elf
|
||||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
||||||
[submodule "SDK"]
|
[submodule "SDK"]
|
||||||
path = SDK
|
path = SDK
|
||||||
url = https://github.com/STMicroelectronics/STM32CubeWL.git
|
url = https://github.com/STMicroelectronics/STM32CubeWL.git
|
||||||
|
[submodule "lib/sx126x/SWSD003"]
|
||||||
|
path = lib/sx126x/SWSD003
|
||||||
|
url = https://github.com/Lora-net/SWSD003.git
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(yzl_wle5_template)
|
project(yzl_wle5_lora)
|
||||||
|
|
||||||
enable_language(CXX)
|
enable_language(CXX)
|
||||||
enable_language(ASM)
|
enable_language(ASM)
|
||||||
|
@ -13,17 +13,25 @@ set(TARGET_SOURCES
|
||||||
"MX_Generated/Core/Src/gpio.c"
|
"MX_Generated/Core/Src/gpio.c"
|
||||||
"MX_Generated/Core/Src/main.c"
|
"MX_Generated/Core/Src/main.c"
|
||||||
"MX_Generated/Core/Src/rtc.c"
|
"MX_Generated/Core/Src/rtc.c"
|
||||||
|
"MX_Generated/Core/Src/subghz.c"
|
||||||
"MX_Generated/Core/Src/stm32wlxx_hal_msp.c"
|
"MX_Generated/Core/Src/stm32wlxx_hal_msp.c"
|
||||||
"MX_Generated/Core/Src/stm32wlxx_it.c"
|
"MX_Generated/Core/Src/stm32wlxx_it.c"
|
||||||
"MX_Generated/Core/Src/system_stm32wlxx.c"
|
"MX_Generated/Core/Src/system_stm32wlxx.c"
|
||||||
|
"MX_Generated/Core/Src/usart.c"
|
||||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal.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_cortex.c"
|
||||||
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_gpio.c"
|
||||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_pwr.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_pwr_ex.c"
|
||||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rcc.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_rcc_ex.c"
|
||||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc.c"
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc.c"
|
||||||
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc_ex.c"
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_rtc_ex.c"
|
||||||
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_subghz.c"
|
||||||
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_uart.c"
|
||||||
|
"SDK/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_uart_ex.c"
|
||||||
|
"src/app_sx126x_impl.c"
|
||||||
|
"src/app_syscalls.c"
|
||||||
"src/main.c"
|
"src/main.c"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,6 +51,7 @@ set(TARGET_C_INCLUDES
|
||||||
|
|
||||||
# Shared libraries linked with application
|
# Shared libraries linked with application
|
||||||
set(TARGET_LIBS
|
set(TARGET_LIBS
|
||||||
|
"sx126x"
|
||||||
"c"
|
"c"
|
||||||
"m"
|
"m"
|
||||||
"nosys"
|
"nosys"
|
||||||
|
@ -71,6 +80,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-common -fno-builtin -f
|
||||||
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
|
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||||
|
|
||||||
|
add_subdirectory(lib/sx126x)
|
||||||
|
|
||||||
# Shared sources, includes and definitions
|
# Shared sources, includes and definitions
|
||||||
add_compile_definitions(${TARGET_C_DEFINES})
|
add_compile_definitions(${TARGET_C_DEFINES})
|
||||||
include_directories(${TARGET_C_INCLUDES})
|
include_directories(${TARGET_C_INCLUDES})
|
||||||
|
|
|
@ -53,9 +53,9 @@
|
||||||
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
/*#define HAL_SMBUS_MODULE_ENABLED */
|
/*#define HAL_SMBUS_MODULE_ENABLED */
|
||||||
/*#define HAL_SPI_MODULE_ENABLED */
|
/*#define HAL_SPI_MODULE_ENABLED */
|
||||||
/*#define HAL_SUBGHZ_MODULE_ENABLED */
|
#define HAL_SUBGHZ_MODULE_ENABLED
|
||||||
/*#define HAL_TIM_MODULE_ENABLED */
|
/*#define HAL_TIM_MODULE_ENABLED */
|
||||||
/*#define HAL_UART_MODULE_ENABLED */
|
#define HAL_UART_MODULE_ENABLED
|
||||||
/*#define HAL_USART_MODULE_ENABLED */
|
/*#define HAL_USART_MODULE_ENABLED */
|
||||||
/*#define HAL_WWDG_MODULE_ENABLED */
|
/*#define HAL_WWDG_MODULE_ENABLED */
|
||||||
#define HAL_EXTI_MODULE_ENABLED
|
#define HAL_EXTI_MODULE_ENABLED
|
||||||
|
|
52
MX_Generated/Core/Inc/subghz.h
Normal file
52
MX_Generated/Core/Inc/subghz.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file subghz.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the subghz.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 __SUBGHZ_H__
|
||||||
|
#define __SUBGHZ_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern SUBGHZ_HandleTypeDef hsubghz;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_SUBGHZ_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SUBGHZ_H__ */
|
||||||
|
|
52
MX_Generated/Core/Inc/usart.h
Normal file
52
MX_Generated/Core/Inc/usart.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file usart.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the usart.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 __USART_H__
|
||||||
|
#define __USART_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern UART_HandleTypeDef hlpuart1;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_LPUART1_UART_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __USART_H__ */
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
/* USER CODE END Header */
|
/* USER CODE END Header */
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "usart.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
#include "subghz.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
|
79
MX_Generated/Core/Src/subghz.c
Normal file
79
MX_Generated/Core/Src/subghz.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file subghz.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the SUBGHZ 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 "subghz.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
SUBGHZ_HandleTypeDef hsubghz;
|
||||||
|
|
||||||
|
/* SUBGHZ init function */
|
||||||
|
void MX_SUBGHZ_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SUBGHZ_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SUBGHZ_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_Init 1 */
|
||||||
|
hsubghz.Init.BaudratePrescaler = SUBGHZSPI_BAUDRATEPRESCALER_8;
|
||||||
|
if (HAL_SUBGHZ_Init(&hsubghz) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN SUBGHZ_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SUBGHZ_MspInit(SUBGHZ_HandleTypeDef* subghzHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SUBGHZ_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_MspInit 0 */
|
||||||
|
/* SUBGHZ clock enable */
|
||||||
|
__HAL_RCC_SUBGHZSPI_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN SUBGHZ_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SUBGHZ_MspDeInit(SUBGHZ_HandleTypeDef* subghzHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SUBGHZ_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_SUBGHZSPI_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN SUBGHZ_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SUBGHZ_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
140
MX_Generated/Core/Src/usart.c
Normal file
140
MX_Generated/Core/Src/usart.c
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file usart.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the USART 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 "usart.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
UART_HandleTypeDef hlpuart1;
|
||||||
|
|
||||||
|
/* LPUART1 init function */
|
||||||
|
|
||||||
|
void MX_LPUART1_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 1 */
|
||||||
|
hlpuart1.Instance = LPUART1;
|
||||||
|
hlpuart1.Init.BaudRate = 115200;
|
||||||
|
hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
|
hlpuart1.Init.StopBits = UART_STOPBITS_1;
|
||||||
|
hlpuart1.Init.Parity = UART_PARITY_NONE;
|
||||||
|
hlpuart1.Init.Mode = UART_MODE_TX_RX;
|
||||||
|
hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
|
hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||||
|
hlpuart1.Init.ClockPrescaler = UART_PRESCALER_DIV8;
|
||||||
|
hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||||
|
hlpuart1.FifoMode = UART_FIFOMODE_ENABLE;
|
||||||
|
if (HAL_UART_Init(&hlpuart1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetTxFifoThreshold(&hlpuart1, UART_TXFIFO_THRESHOLD_1_2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetRxFifoThreshold(&hlpuart1, UART_RXFIFO_THRESHOLD_1_2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_EnableFifoMode(&hlpuart1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN LPUART1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
if(uartHandle->Instance==LPUART1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LPUART1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clocks
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LPUART1;
|
||||||
|
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LPUART1 clock enable */
|
||||||
|
__HAL_RCC_LPUART1_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**LPUART1 GPIO Configuration
|
||||||
|
PA2 ------> LPUART1_TX
|
||||||
|
PA3 ------> LPUART1_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF8_LPUART1;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(uartHandle->Instance==LPUART1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN LPUART1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_LPUART1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**LPUART1 GPIO Configuration
|
||||||
|
PA2 ------> LPUART1_TX
|
||||||
|
PA3 ------> LPUART1_RX
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN LPUART1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END LPUART1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
|
@ -5,26 +5,37 @@ CAD.provider=
|
||||||
File.Version=6
|
File.Version=6
|
||||||
GPIO.groupedBy=Group By Peripherals
|
GPIO.groupedBy=Group By Peripherals
|
||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
|
LPUART1.BaudRate=115200
|
||||||
|
LPUART1.ClockPrescaler=UART_PRESCALER_DIV8
|
||||||
|
LPUART1.FIFOMode=UART_FIFOMODE_ENABLE
|
||||||
|
LPUART1.IPParameters=BaudRate,ClockPrescaler,FIFOMode,TXFIFOThreshold,RXFIFOThreshold
|
||||||
|
LPUART1.RXFIFOThreshold=UART_RXFIFO_THRESHOLD_1_2
|
||||||
|
LPUART1.TXFIFOThreshold=UART_TXFIFO_THRESHOLD_1_2
|
||||||
Mcu.CPN=STM32WLE5CBU6
|
Mcu.CPN=STM32WLE5CBU6
|
||||||
Mcu.Family=STM32WL
|
Mcu.Family=STM32WL
|
||||||
Mcu.IP0=DEBUG
|
Mcu.IP0=DEBUG
|
||||||
Mcu.IP1=NVIC
|
Mcu.IP1=LPUART1
|
||||||
Mcu.IP2=RCC
|
Mcu.IP2=NVIC
|
||||||
Mcu.IP3=RTC
|
Mcu.IP3=RCC
|
||||||
Mcu.IP4=SYS
|
Mcu.IP4=RTC
|
||||||
Mcu.IPNb=5
|
Mcu.IP5=SUBGHZ
|
||||||
|
Mcu.IP6=SYS
|
||||||
|
Mcu.IPNb=7
|
||||||
Mcu.Name=STM32WLE5CBUx
|
Mcu.Name=STM32WLE5CBUx
|
||||||
Mcu.Package=UFQFPN48
|
Mcu.Package=UFQFPN48
|
||||||
Mcu.Pin0=OSC_IN
|
Mcu.Pin0=PA2
|
||||||
Mcu.Pin1=OSC_OUT
|
Mcu.Pin1=PA3
|
||||||
Mcu.Pin2=PA13
|
Mcu.Pin10=VP_SUBGHZ_VS_SUBGHZ
|
||||||
Mcu.Pin3=PC14-OSC32_IN
|
Mcu.Pin11=VP_SYS_VS_Systick
|
||||||
Mcu.Pin4=PC15-OSC32_OUT
|
Mcu.Pin2=OSC_IN
|
||||||
Mcu.Pin5=PA14
|
Mcu.Pin3=OSC_OUT
|
||||||
Mcu.Pin6=VP_RTC_VS_RTC_Activate
|
Mcu.Pin4=PA13
|
||||||
Mcu.Pin7=VP_RTC_VS_RTC_Calendar
|
Mcu.Pin5=PC14-OSC32_IN
|
||||||
Mcu.Pin8=VP_SYS_VS_Systick
|
Mcu.Pin6=PC15-OSC32_OUT
|
||||||
Mcu.PinsNb=9
|
Mcu.Pin7=PA14
|
||||||
|
Mcu.Pin8=VP_RTC_VS_RTC_Activate
|
||||||
|
Mcu.Pin9=VP_RTC_VS_RTC_Calendar
|
||||||
|
Mcu.PinsNb=12
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32WLE5CBUx
|
Mcu.UserName=STM32WLE5CBUx
|
||||||
|
@ -49,6 +60,12 @@ PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=DEBUG_JTMS-SWDIO
|
PA13.Signal=DEBUG_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
PA14.Signal=DEBUG_JTCK-SWCLK
|
PA14.Signal=DEBUG_JTCK-SWCLK
|
||||||
|
PA2.Locked=true
|
||||||
|
PA2.Mode=Asynchronous
|
||||||
|
PA2.Signal=LPUART1_TX
|
||||||
|
PA3.Locked=true
|
||||||
|
PA3.Mode=Asynchronous
|
||||||
|
PA3.Signal=LPUART1_RX
|
||||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||||
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||||
|
@ -89,7 +106,7 @@ ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=Makefile
|
ProjectManager.TargetToolchain=Makefile
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=false
|
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
|
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_SUBGHZ_Init-SUBGHZ-false-HAL-true
|
||||||
RCC.AHBFreq_Value=48000000
|
RCC.AHBFreq_Value=48000000
|
||||||
RCC.APB1Freq_Value=48000000
|
RCC.APB1Freq_Value=48000000
|
||||||
RCC.APB1TimFreq_Value=48000000
|
RCC.APB1TimFreq_Value=48000000
|
||||||
|
@ -142,6 +159,8 @@ VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
|
||||||
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
||||||
VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar
|
VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar
|
||||||
VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar
|
VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar
|
||||||
|
VP_SUBGHZ_VS_SUBGHZ.Mode=SUBGHZ_Activate
|
||||||
|
VP_SUBGHZ_VS_SUBGHZ.Signal=SUBGHZ_VS_SUBGHZ
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
board=custom
|
board=custom
|
||||||
|
|
1
SDK
Submodule
1
SDK
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5b47f70ce5f9016b92a8bedb037d00d86b7c8080
|
16
lib/sx126x/CMakeLists.txt
Normal file
16
lib/sx126x/CMakeLists.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
project(sx126x)
|
||||||
|
|
||||||
|
set(SX126X_SRCS
|
||||||
|
"SWSD003/sx126x/sx126x_driver/src/lr_fhss_mac.c"
|
||||||
|
"SWSD003/sx126x/sx126x_driver/src/sx126x.c"
|
||||||
|
"SWSD003/sx126x/sx126x_driver/src/sx126x_lr_fhss.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SX126X_INCS
|
||||||
|
"SWSD003/sx126x/sx126x_driver/src"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} ${SX126X_SRCS})
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC ${SX126X_INCS})
|
1
lib/sx126x/SWSD003
Submodule
1
lib/sx126x/SWSD003
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 760bf8751d86faa8b80cb71417f9a263b8470e15
|
23
src/app_sx126x_impl.c
Normal file
23
src/app_sx126x_impl.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* HAL drivers */
|
||||||
|
#include "stm32wlxx_hal.h"
|
||||||
|
|
||||||
|
/* SX126x */
|
||||||
|
#include "sx126x_hal.h"
|
||||||
|
|
||||||
|
sx126x_hal_status_t sx126x_hal_write(const void* context, const uint8_t* command, const uint16_t command_length,
|
||||||
|
const uint8_t* data, const uint16_t data_length) {
|
||||||
|
return SX126X_HAL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
sx126x_hal_status_t sx126x_hal_read(const void* context, const uint8_t* command, const uint16_t command_length,
|
||||||
|
uint8_t* data, const uint16_t data_length) {
|
||||||
|
return SX126X_HAL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
sx126x_hal_status_t sx126x_hal_reset(const void* context) {
|
||||||
|
return SX126X_HAL_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
sx126x_hal_status_t sx126x_hal_wakeup(const void* context) {
|
||||||
|
return SX126X_HAL_STATUS_OK;
|
||||||
|
}
|
18
src/app_syscalls.c
Normal file
18
src/app_syscalls.c
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/* HAL drivers */
|
||||||
|
#include "stm32wlxx_hal.h"
|
||||||
|
|
||||||
|
/* MX Generated */
|
||||||
|
#include "usart.h"
|
||||||
|
|
||||||
|
int _write(int file, char *ptr, int len) {
|
||||||
|
/* Not TTY write */
|
||||||
|
if (file != STDOUT_FILENO && file != STDERR_FILENO) {
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_UART_Transmit(&hlpuart1, (uint8_t *)ptr, len, 100);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
10
src/main.c
10
src/main.c
|
@ -1,9 +1,11 @@
|
||||||
#include <stdint.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* MX Generated headers */
|
/* MX Generated headers */
|
||||||
#include "main.h"
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
#include "main.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
#include "subghz.h"
|
||||||
|
#include "usart.h"
|
||||||
|
|
||||||
extern void SystemClock_Config(void);
|
extern void SystemClock_Config(void);
|
||||||
|
|
||||||
|
@ -15,6 +17,10 @@ int main(void) {
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
MX_RTC_Init();
|
MX_RTC_Init();
|
||||||
|
MX_LPUART1_UART_Init();
|
||||||
|
MX_SUBGHZ_Init();
|
||||||
|
|
||||||
|
printf("Initialization completed.\r\n");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* -- */
|
/* -- */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user