Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
7919642a
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7919642a
编写于
4月 13, 2022
作者:
M
Miaowulue
提交者:
guo
4月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp/stm32] add rtc for openmv
上级
54642ec6
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
131 addition
and
3 deletion
+131
-3
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Inc/stm32h7xx_hal_conf.h
...-h7plus/board/CubeMX_Config/Core/Inc/stm32h7xx_hal_conf.h
+2
-2
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Src/main.c
...m32h743-openmv-h7plus/board/CubeMX_Config/Core/Src/main.c
+70
-1
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Src/stm32h7xx_hal_msp.c
...v-h7plus/board/CubeMX_Config/Core/Src/stm32h7xx_hal_msp.c
+54
-0
bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig
bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig
+5
-0
未找到文件。
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Inc/stm32h7xx_hal_conf.h
浏览文件 @
7919642a
...
...
@@ -67,7 +67,7 @@
#define HAL_QSPI_MODULE_ENABLED
/* #define HAL_RAMECC_MODULE_ENABLED */
/* #define HAL_RNG_MODULE_ENABLED */
/* #define HAL_RTC_MODULE_ENABLED */
#define HAL_RTC_MODULE_ENABLED
/* #define HAL_SAI_MODULE_ENABLED */
#define HAL_SD_MODULE_ENABLED
/* #define HAL_MMC_MODULE_ENABLED */
...
...
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Src/main.c
浏览文件 @
7919642a
...
...
@@ -42,6 +42,8 @@
QSPI_HandleTypeDef
hqspi
;
RTC_HandleTypeDef
hrtc
;
SD_HandleTypeDef
hsd1
;
UART_HandleTypeDef
huart1
;
...
...
@@ -62,6 +64,7 @@ static void MX_FMC_Init(void);
static
void
MX_QUADSPI_Init
(
void
);
static
void
MX_SDMMC1_SD_Init
(
void
);
static
void
MX_USB_OTG_FS_PCD_Init
(
void
);
static
void
MX_RTC_Init
(
void
);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
...
...
@@ -110,6 +113,7 @@ int main(void)
MX_QUADSPI_Init
();
MX_SDMMC1_SD_Init
();
MX_USB_OTG_FS_PCD_Init
();
MX_RTC_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -145,8 +149,10 @@ void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct
.
OscillatorType
=
RCC_OSCILLATORTYPE_HSI48
|
RCC_OSCILLATORTYPE_HSE
;
RCC_OscInitStruct
.
OscillatorType
=
RCC_OSCILLATORTYPE_HSI48
|
RCC_OSCILLATORTYPE_LSI
|
RCC_OSCILLATORTYPE_HSE
;
RCC_OscInitStruct
.
HSEState
=
RCC_HSE_ON
;
RCC_OscInitStruct
.
LSIState
=
RCC_LSI_ON
;
RCC_OscInitStruct
.
HSI48State
=
RCC_HSI48_ON
;
RCC_OscInitStruct
.
PLL
.
PLLState
=
RCC_PLL_ON
;
RCC_OscInitStruct
.
PLL
.
PLLSource
=
RCC_PLLSOURCE_HSE
;
...
...
@@ -216,6 +222,69 @@ static void MX_QUADSPI_Init(void)
}
/**
* @brief RTC Initialization Function
* @param None
* @retval None
*/
static
void
MX_RTC_Init
(
void
)
{
/* USER CODE BEGIN RTC_Init 0 */
/* USER CODE END RTC_Init 0 */
RTC_TimeTypeDef
sTime
=
{
0
};
RTC_DateTypeDef
sDate
=
{
0
};
/* USER CODE BEGIN RTC_Init 1 */
/* USER CODE END RTC_Init 1 */
/** Initialize RTC Only
*/
hrtc
.
Instance
=
RTC
;
hrtc
.
Init
.
HourFormat
=
RTC_HOURFORMAT_24
;
hrtc
.
Init
.
AsynchPrediv
=
127
;
hrtc
.
Init
.
SynchPrediv
=
255
;
hrtc
.
Init
.
OutPut
=
RTC_OUTPUT_DISABLE
;
hrtc
.
Init
.
OutPutPolarity
=
RTC_OUTPUT_POLARITY_HIGH
;
hrtc
.
Init
.
OutPutType
=
RTC_OUTPUT_TYPE_OPENDRAIN
;
hrtc
.
Init
.
OutPutRemap
=
RTC_OUTPUT_REMAP_NONE
;
if
(
HAL_RTC_Init
(
&
hrtc
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN Check_RTC_BKUP */
/* USER CODE END Check_RTC_BKUP */
/** Initialize RTC and set the Time and Date
*/
sTime
.
Hours
=
0x0
;
sTime
.
Minutes
=
0x0
;
sTime
.
Seconds
=
0x0
;
sTime
.
DayLightSaving
=
RTC_DAYLIGHTSAVING_NONE
;
sTime
.
StoreOperation
=
RTC_STOREOPERATION_RESET
;
if
(
HAL_RTC_SetTime
(
&
hrtc
,
&
sTime
,
RTC_FORMAT_BCD
)
!=
HAL_OK
)
{
Error_Handler
();
}
sDate
.
WeekDay
=
RTC_WEEKDAY_MONDAY
;
sDate
.
Month
=
RTC_MONTH_JANUARY
;
sDate
.
Date
=
0x1
;
sDate
.
Year
=
0x0
;
if
(
HAL_RTC_SetDate
(
&
hrtc
,
&
sDate
,
RTC_FORMAT_BCD
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN RTC_Init 2 */
/* USER CODE END RTC_Init 2 */
}
/**
* @brief SDMMC1 Initialization Function
* @param None
...
...
bsp/stm32/stm32h743-openmv-h7plus/board/CubeMX_Config/Core/Src/stm32h7xx_hal_msp.c
浏览文件 @
7919642a
...
...
@@ -178,6 +178,60 @@ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* hqspi)
}
/**
* @brief RTC MSP Initialization
* This function configures the hardware resources used in this example
* @param hrtc: RTC handle pointer
* @retval None
*/
void
HAL_RTC_MspInit
(
RTC_HandleTypeDef
*
hrtc
)
{
RCC_PeriphCLKInitTypeDef
PeriphClkInitStruct
=
{
0
};
if
(
hrtc
->
Instance
==
RTC
)
{
/* USER CODE BEGIN RTC_MspInit 0 */
/* USER CODE END RTC_MspInit 0 */
/** Initializes the peripherals clock
*/
PeriphClkInitStruct
.
PeriphClockSelection
=
RCC_PERIPHCLK_RTC
;
PeriphClkInitStruct
.
RTCClockSelection
=
RCC_RTCCLKSOURCE_LSI
;
if
(
HAL_RCCEx_PeriphCLKConfig
(
&
PeriphClkInitStruct
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* Peripheral clock enable */
__HAL_RCC_RTC_ENABLE
();
/* USER CODE BEGIN RTC_MspInit 1 */
/* USER CODE END RTC_MspInit 1 */
}
}
/**
* @brief RTC MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param hrtc: RTC handle pointer
* @retval None
*/
void
HAL_RTC_MspDeInit
(
RTC_HandleTypeDef
*
hrtc
)
{
if
(
hrtc
->
Instance
==
RTC
)
{
/* USER CODE BEGIN RTC_MspDeInit 0 */
/* USER CODE END RTC_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_RTC_DISABLE
();
/* USER CODE BEGIN RTC_MspDeInit 1 */
/* USER CODE END RTC_MspDeInit 1 */
}
}
/**
* @brief SD MSP Initialization
* This function configures the hardware resources used in this example
...
...
bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig
浏览文件 @
7919642a
...
...
@@ -54,6 +54,11 @@ menu "Hardware Drivers Config"
select RT_USING_SPI
default n
config BSP_USING_ONCHIP_RTC
bool "Enable RTC"
select RT_USING_RTC
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录