[bsp][stm32] update drivers
This commit is contained in:
parent
11dfedecdc
commit
4d6d16fc98
@ -37,6 +37,7 @@
|
||||
#elif defined(SOC_SERIES_STM32F7)
|
||||
#include "f7/uart_config.h"
|
||||
#include "f7/spi_config.h"
|
||||
#include "f7/qspi_config.h"
|
||||
#include "f7/adc_config.h"
|
||||
#include "f7/tim_config.h"
|
||||
#include "f7/sdio_config.h"
|
||||
|
@ -164,7 +164,7 @@ static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state)
|
||||
tim_device = (struct stm32_hwtimer *)timer;
|
||||
|
||||
/* time init */
|
||||
#if defined(SOC_SERIES_STM32F4)
|
||||
#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
||||
if (tim->Instance == TIM9 || tim->Instance == TIM10 || tim->Instance == TIM11)
|
||||
#elif defined(SOC_SERIES_STM32L4)
|
||||
if (tim->Instance == TIM15 || tim->Instance == TIM16 || tim->Instance == TIM17)
|
||||
@ -278,7 +278,7 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg)
|
||||
/* set timer frequence */
|
||||
freq = *((rt_uint32_t *)arg);
|
||||
|
||||
#if defined(SOC_SERIES_STM32F4)
|
||||
#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
||||
if (tim->Instance == TIM9 || tim->Instance == TIM10 || tim->Instance == TIM11)
|
||||
#elif defined(SOC_SERIES_STM32L4)
|
||||
if (tim->Instance == TIM15 || tim->Instance == TIM16 || tim->Instance == TIM17)
|
||||
|
@ -185,7 +185,7 @@ static rt_err_t drv_pwm_get(TIM_HandleTypeDef *htim, struct rt_pwm_configuration
|
||||
rt_uint32_t channel = 0x04 * (configuration->channel - 1);
|
||||
rt_uint64_t tim_clock;
|
||||
|
||||
#if defined(SOC_SERIES_STM32F4)
|
||||
#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
||||
if (htim->Instance == TIM9 || htim->Instance == TIM10 || htim->Instance == TIM11)
|
||||
#elif defined(SOC_SERIES_STM32L4)
|
||||
if (htim->Instance == TIM15 || htim->Instance == TIM16 || htim->Instance == TIM17)
|
||||
@ -230,7 +230,7 @@ static rt_err_t drv_pwm_set(TIM_HandleTypeDef *htim, struct rt_pwm_configuration
|
||||
/* Converts the channel number to the channel number of Hal library */
|
||||
rt_uint32_t channel = 0x04 * (configuration->channel - 1);
|
||||
|
||||
#if defined(SOC_SERIES_STM32F4)
|
||||
#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
||||
if (htim->Instance == TIM9 || htim->Instance == TIM10 || htim->Instance == TIM11)
|
||||
#elif defined(SOC_SERIES_STM32L4)
|
||||
if (htim->Instance == TIM15 || htim->Instance == TIM16 || htim->Instance == TIM17)
|
||||
|
@ -24,8 +24,8 @@ static RTC_HandleTypeDef RTC_Handler;
|
||||
|
||||
static time_t get_rtc_timestamp(void)
|
||||
{
|
||||
RTC_TimeTypeDef RTC_TimeStruct;
|
||||
RTC_DateTypeDef RTC_DateStruct;
|
||||
RTC_TimeTypeDef RTC_TimeStruct = {0};
|
||||
RTC_DateTypeDef RTC_DateStruct = {0};
|
||||
struct tm tm_new;
|
||||
|
||||
HAL_RTC_GetTime(&RTC_Handler, &RTC_TimeStruct, RTC_FORMAT_BIN);
|
||||
@ -44,9 +44,9 @@ static time_t get_rtc_timestamp(void)
|
||||
|
||||
static rt_err_t set_rtc_time_stamp(time_t time_stamp)
|
||||
{
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
|
||||
RTC_TimeTypeDef RTC_TimeStruct;
|
||||
RTC_DateTypeDef RTC_DateStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
RTC_TimeTypeDef RTC_TimeStruct = {0};
|
||||
RTC_DateTypeDef RTC_DateStruct = {0};
|
||||
struct tm *p_tm;
|
||||
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
@ -86,7 +86,7 @@ static void rt_rtc_init(void)
|
||||
{
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||
@ -95,7 +95,7 @@ static void rt_rtc_init(void)
|
||||
|
||||
static rt_err_t rt_rtc_config(struct rt_device *dev)
|
||||
{
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||
@ -110,7 +110,7 @@ static rt_err_t rt_rtc_config(struct rt_device *dev)
|
||||
#if defined(SOC_SERIES_STM32F1)
|
||||
RTC_Handler.Init.OutPut = RTC_OUTPUTSOURCE_NONE;
|
||||
RTC_Handler.Init.AsynchPrediv = RTC_AUTO_1_SECOND;
|
||||
#elif defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L4)
|
||||
#elif defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4)
|
||||
RTC_Handler.Init.AsynchPrediv = 0X7F;
|
||||
#ifndef SOC_SERIES_STM32F0
|
||||
RTC_Handler.Init.SynchPrediv = 0XFF;
|
||||
|
@ -25,8 +25,14 @@
|
||||
#define SDCARD_INSTANCE_TYPE SDMMC_TypeDef
|
||||
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4) */
|
||||
|
||||
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4)
|
||||
#define SDCARD_INSTANCE SDIO
|
||||
#elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7)
|
||||
#define SDCARD_INSTANCE SDMMC1
|
||||
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4) */
|
||||
|
||||
#define SDIO_BUFF_SIZE 4096
|
||||
#define SDIO_MAX_FREQ 2000000
|
||||
#define SDIO_MAX_FREQ 1000000
|
||||
#define SDIO_ALIGN_LEN 32
|
||||
|
||||
#ifndef SDIO_BASE_ADDRESS
|
||||
|
Loading…
x
Reference in New Issue
Block a user