generated from Embedded_Projects/YZL_WLE5CB_Template
Use ST provided PHY stack.
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:
parent
75e2d4fb30
commit
d7b57e1a56
|
@ -1,6 +1,3 @@
|
|||
[submodule "SDK"]
|
||||
path = SDK
|
||||
url = https://github.com/STMicroelectronics/STM32CubeWL.git
|
||||
[submodule "lib/sx126x/SWSD003"]
|
||||
path = lib/sx126x/SWSD003
|
||||
url = https://github.com/Lora-net/SWSD003.git
|
||||
|
|
|
@ -10,6 +10,7 @@ set(TARGET_LDSCRIPT_FLASH "${CMAKE_SOURCE_DIR}/MX_Generated/STM32WLE5XX_FLASH.
|
|||
|
||||
set(TARGET_SOURCES
|
||||
"MX_Generated/startup_stm32wle5xx.s"
|
||||
"MX_Generated/Core/Src/adc.c"
|
||||
"MX_Generated/Core/Src/gpio.c"
|
||||
"MX_Generated/Core/Src/main.c"
|
||||
"MX_Generated/Core/Src/rtc.c"
|
||||
|
@ -30,7 +31,6 @@ set(TARGET_SOURCES
|
|||
"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"
|
||||
)
|
||||
|
@ -51,7 +51,6 @@ set(TARGET_C_INCLUDES
|
|||
|
||||
# Shared libraries linked with application
|
||||
set(TARGET_LIBS
|
||||
"sx126x"
|
||||
"c"
|
||||
"m"
|
||||
"nosys"
|
||||
|
@ -80,8 +79,6 @@ 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_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
|
||||
add_subdirectory(lib/sx126x)
|
||||
|
||||
# Shared sources, includes and definitions
|
||||
add_compile_definitions(${TARGET_C_DEFINES})
|
||||
include_directories(${TARGET_C_INCLUDES})
|
||||
|
|
|
@ -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__ */
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
* @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_ADC_MODULE_ENABLED
|
||||
/*#define HAL_COMP_MODULE_ENABLED */
|
||||
/*#define HAL_CRC_MODULE_ENABLED */
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
/* 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)
|
||||
{
|
||||
|
||||
if(adcHandle->Instance==ADC)
|
||||
{
|
||||
/* USER CODE BEGIN ADC_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC_MspInit 0 */
|
||||
/* ADC clock enable */
|
||||
__HAL_RCC_ADC_CLK_ENABLE();
|
||||
/* 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();
|
||||
/* USER CODE BEGIN ADC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
|
@ -18,9 +18,9 @@
|
|||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "adc.h"
|
||||
#include "usart.h"
|
||||
#include "rtc.h"
|
||||
#include "subghz.h"
|
||||
#include "gpio.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#MicroXplorer Configuration settings - do not modify
|
||||
ADC.IPParameters=NbrOfConversion,SelectedChannel
|
||||
ADC.NbrOfConversion=1
|
||||
ADC.SelectedChannel=ADC_CHANNEL_VREFINT|ADC_CHANNEL_VBAT
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
|
@ -13,29 +16,32 @@ LPUART1.RXFIFOThreshold=UART_RXFIFO_THRESHOLD_1_2
|
|||
LPUART1.TXFIFOThreshold=UART_TXFIFO_THRESHOLD_1_2
|
||||
Mcu.CPN=STM32WLE5CBU6
|
||||
Mcu.Family=STM32WL
|
||||
Mcu.IP0=DEBUG
|
||||
Mcu.IP1=LPUART1
|
||||
Mcu.IP2=NVIC
|
||||
Mcu.IP3=RCC
|
||||
Mcu.IP4=RTC
|
||||
Mcu.IP5=SUBGHZ
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IPNb=7
|
||||
Mcu.IP0=ADC
|
||||
Mcu.IP1=DEBUG
|
||||
Mcu.IP2=LPUART1
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=RTC
|
||||
Mcu.IP6=SUBGHZ
|
||||
Mcu.IP7=SYS
|
||||
Mcu.IPNb=8
|
||||
Mcu.Name=STM32WLE5CBUx
|
||||
Mcu.Package=UFQFPN48
|
||||
Mcu.Pin0=PA2
|
||||
Mcu.Pin1=PA3
|
||||
Mcu.Pin10=VP_SUBGHZ_VS_SUBGHZ
|
||||
Mcu.Pin11=VP_SYS_VS_Systick
|
||||
Mcu.Pin10=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin11=VP_RTC_VS_RTC_Calendar
|
||||
Mcu.Pin12=VP_SUBGHZ_VS_SUBGHZ
|
||||
Mcu.Pin13=VP_SYS_VS_Systick
|
||||
Mcu.Pin2=OSC_IN
|
||||
Mcu.Pin3=OSC_OUT
|
||||
Mcu.Pin4=PA13
|
||||
Mcu.Pin5=PC14-OSC32_IN
|
||||
Mcu.Pin6=PC15-OSC32_OUT
|
||||
Mcu.Pin7=PA14
|
||||
Mcu.Pin8=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin9=VP_RTC_VS_RTC_Calendar
|
||||
Mcu.PinsNb=12
|
||||
Mcu.Pin8=VP_ADC_Vref_Input
|
||||
Mcu.Pin9=VP_ADC_Vbat_Input
|
||||
Mcu.PinsNb=14
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32WLE5CBUx
|
||||
|
@ -106,7 +112,7 @@ 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_SUBGHZ_Init-SUBGHZ-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-true-HAL-false,5-MX_LPUART1_UART_Init-LPUART1-false-HAL-true,6-MX_ADC_Init-ADC-false-HAL-true,7-MX_SubGHz_Phy_Init-SUBGHZ_PHY-false-HAL-false
|
||||
RCC.AHBFreq_Value=48000000
|
||||
RCC.APB1Freq_Value=48000000
|
||||
RCC.APB1TimFreq_Value=48000000
|
||||
|
@ -155,6 +161,10 @@ RCC.VCOInputFreq_Value=8000000
|
|||
RCC.VCOOutputFreq_Value=144000000
|
||||
RTC.BinMode=RTC_BINARY_NONE
|
||||
RTC.IPParameters=BinMode
|
||||
VP_ADC_Vbat_Input.Mode=IN-Vbat
|
||||
VP_ADC_Vbat_Input.Signal=ADC_Vbat_Input
|
||||
VP_ADC_Vref_Input.Mode=IN-Vrefint
|
||||
VP_ADC_Vref_Input.Signal=ADC_Vref_Input
|
||||
VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
|
||||
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
||||
VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
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 +0,0 @@
|
|||
Subproject commit 760bf8751d86faa8b80cb71417f9a263b8470e15
|
|
@ -1,23 +0,0 @@
|
|||
/* 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;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* MX Generated headers */
|
||||
#include "adc.h"
|
||||
#include "gpio.h"
|
||||
#include "main.h"
|
||||
#include "rtc.h"
|
||||
|
|
Loading…
Reference in New Issue