Use LL RCC periph clock enable
This commit is contained in:
committed by
Raphael Coeffic
parent
03cdc879b9
commit
8f2b0ca03d
@@ -25,6 +25,7 @@ extern "C" {
|
|||||||
#define USE_FULL_LL_DRIVER
|
#define USE_FULL_LL_DRIVER
|
||||||
#if defined(STM32F4)
|
#if defined(STM32F4)
|
||||||
#include "CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h"
|
#include "CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h"
|
||||||
|
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h"
|
||||||
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h"
|
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h"
|
||||||
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h"
|
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h"
|
||||||
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h"
|
#include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h"
|
||||||
@@ -39,6 +40,7 @@ extern "C" {
|
|||||||
#define __CORE_CM3_H_GENERIC
|
#define __CORE_CM3_H_GENERIC
|
||||||
|
|
||||||
#include "CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h"
|
#include "CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h"
|
||||||
|
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_bus.h"
|
||||||
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_gpio.h"
|
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_gpio.h"
|
||||||
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_tim.h"
|
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_tim.h"
|
||||||
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_dma.h"
|
#include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_dma.h"
|
||||||
|
|||||||
@@ -201,13 +201,13 @@ int stm32_i2c_is_dev_ready(uint8_t bus, uint16_t addr, uint32_t timeout)
|
|||||||
static int i2c_enable_gpio_clock(GPIO_TypeDef *GPIOx)
|
static int i2c_enable_gpio_clock(GPIO_TypeDef *GPIOx)
|
||||||
{
|
{
|
||||||
if (GPIOx == GPIOA)
|
if (GPIOx == GPIOA)
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
||||||
else if (GPIOx == GPIOB)
|
else if (GPIOx == GPIOB)
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
||||||
else if (GPIOx == GPIOC)
|
else if (GPIOx == GPIOC)
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
||||||
else if (GPIOx == GPIOH)
|
else if (GPIOx == GPIOH)
|
||||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOH);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -218,11 +218,11 @@ static int i2c_enable_clock(I2C_TypeDef* instance)
|
|||||||
{
|
{
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
if (instance == I2C1)
|
if (instance == I2C1)
|
||||||
__HAL_RCC_I2C1_CLK_ENABLE();
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1);
|
||||||
else if (instance == I2C2)
|
else if (instance == I2C2)
|
||||||
__HAL_RCC_I2C2_CLK_ENABLE();
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C2);
|
||||||
else if (instance == I2C3)
|
else if (instance == I2C3)
|
||||||
__HAL_RCC_I2C3_CLK_ENABLE();
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C3);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -233,11 +233,11 @@ static int i2c_disable_clock(I2C_TypeDef* instance)
|
|||||||
{
|
{
|
||||||
/* Peripheral clock disable */
|
/* Peripheral clock disable */
|
||||||
if (instance == I2C1)
|
if (instance == I2C1)
|
||||||
__HAL_RCC_I2C1_CLK_DISABLE();
|
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_I2C1);
|
||||||
else if (instance == I2C2)
|
else if (instance == I2C2)
|
||||||
__HAL_RCC_I2C2_CLK_DISABLE();
|
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_I2C2);
|
||||||
else if (instance == I2C3)
|
else if (instance == I2C3)
|
||||||
__HAL_RCC_I2C3_CLK_DISABLE();
|
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_I2C3);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user