L8 #29
|
@ -0,0 +1,290 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32wlxx_nucleo.h
|
||||
* @brief : header file for the BSP Common driver
|
||||
******************************************************************************
|
||||
* @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 __STM32WLXX_NUCLEO_H
|
||||
#define __STM32WLXX_NUCLEO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo_conf.h"
|
||||
#include "stm32wlxx_nucleo_errno.h"
|
||||
#include "main.h"
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
#if (USE_COM_LOG > 0)
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) /* For IAR and ARM Compiler 5 and 6*/
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32L4XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief STM32WLXX NUCLEO BSP Driver version number V1.0.0
|
||||
*/
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_MAIN (uint32_t)(0x01) /*!< [31:24] main version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_SUB1 (uint32_t)(0x00) /*!< [23:16] sub1 version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_SUB2 (uint32_t)(0x00) /*!< [15:8] sub2 version */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION_RC (uint32_t)(0x00) /*!< [7:0] release candidate */
|
||||
#define __STM32WLXX_NUCLEO_BSP_VERSION ((__STM32WLXX_NUCLEO_BSP_VERSION_MAIN << 24)\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_SUB1 << 16)\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_SUB2 << 8 )\
|
||||
|(__STM32WLXX_NUCLEO_BSP_VERSION_RC))
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Types STM32WLXX_NUCLEO LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define for STM32WLXX_NUCLEO board
|
||||
*/
|
||||
#if !defined (USE_STM32WLXX_NUCLEO)
|
||||
#define USE_STM32WLXX_NUCLEO
|
||||
#endif
|
||||
#ifndef USE_BSP_COM_FEATURE
|
||||
#define USE_BSP_COM_FEATURE 0U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_BUTTON STM32WLXX_NUCLEO LOW LEVEL BUTTON
|
||||
* @{
|
||||
*/
|
||||
/* Button state */
|
||||
#define BUTTON_RELEASED 0U
|
||||
#define BUTTON_PRESSED 1U
|
||||
/** Define number of BUTTON **/
|
||||
#define BUTTONn 1U
|
||||
|
||||
/**
|
||||
* @brief User push-button
|
||||
*/
|
||||
/** Definition for BSP USER BUTTON **/
|
||||
|
||||
#define USER_BUTTON_PIN GPIO_PIN_0
|
||||
#define USER_BUTTON_GPIO_PORT GPIOA
|
||||
#define USER_BUTTON_EXTI_IRQn EXTI0_IRQn
|
||||
#define USER_BUTTON_EXTI_LINE EXTI_LINE_0
|
||||
#define H_EXTI_0 hpb_exti[BUTTON_USER]
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_COM STM32WLXX_NUCLEO LOW LEVEL COM
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Definition for COM portx, connected to USART1
|
||||
*/
|
||||
|
||||
#define BUS_USART1_INSTANCE USART1
|
||||
#define BUS_USART1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define BUS_USART1_RX_GPIO_PORT GPIOB
|
||||
#define BUS_USART1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define BUS_USART1_RX_GPIO_PIN GPIO_PIN_7
|
||||
#define BUS_USART1_RX_GPIO_AF GPIO_AF7_USART1
|
||||
#define BUS_USART1_TX_GPIO_PIN GPIO_PIN_6
|
||||
#define BUS_USART1_TX_GPIO_PORT GPIOB
|
||||
#define BUS_USART1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define BUS_USART1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||
#define BUS_USART1_TX_GPIO_AF GPIO_AF7_USART1
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
#ifndef USE_BSP_COM
|
||||
#define USE_BSP_COM 0U
|
||||
#endif
|
||||
|
||||
#ifndef USE_COM_LOG
|
||||
#define USE_COM_LOG 1U
|
||||
#endif
|
||||
|
||||
#ifndef BSP_BUTTON_USER_IT_PRIORITY
|
||||
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_USER = 0U,
|
||||
}Button_TypeDef;
|
||||
|
||||
/* Keep compatibility with CMSIS Pack already delivered */
|
||||
#define BUTTON_KEY BUTTON_USER
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
} ButtonMode_TypeDef;
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0U,
|
||||
COMn
|
||||
}COM_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
||||
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
||||
}COM_WordLengthTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_STOPBITS_1 = UART_STOPBITS_1,
|
||||
COM_STOPBITS_2 = UART_STOPBITS_2,
|
||||
}COM_StopBitsTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_PARITY_NONE = UART_PARITY_NONE,
|
||||
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
||||
COM_PARITY_ODD = UART_PARITY_ODD,
|
||||
}COM_ParityTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
||||
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
||||
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
||||
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
||||
}COM_HwFlowCtlTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t BaudRate;
|
||||
COM_WordLengthTypeDef WordLength;
|
||||
COM_StopBitsTypeDef StopBits;
|
||||
COM_ParityTypeDef Parity;
|
||||
COM_HwFlowCtlTypeDef HwFlowCtl;
|
||||
}COM_InitTypeDef;
|
||||
#endif
|
||||
|
||||
#define MX_UART_InitTypeDef COM_InitTypeDef
|
||||
#define MX_UART_StopBitsTypeDef COM_StopBitsTypeDef
|
||||
#define MX_UART_ParityTypeDef COM_ParityTypeDef
|
||||
#define MX_UART_HwFlowCtlTypeDef COM_HwFlowCtlTypeDef
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1U)
|
||||
typedef struct
|
||||
{
|
||||
void (* pMspInitCb)(UART_HandleTypeDef *);
|
||||
void (* pMspDeInitCb)(UART_HandleTypeDef *);
|
||||
} BSP_COM_Cb_t;
|
||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1U) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define COMn 1U
|
||||
#define COM1_UART USART1
|
||||
|
||||
#define COM_POLL_TIMEOUT 1000
|
||||
extern UART_HandleTypeDef hcom_uart[COMn];
|
||||
#define huart1 hcom_uart[COM1]
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
extern EXTI_HandleTypeDef hpb_exti[BUTTONn];
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Functions STM32WLXX_NUCLEO LOW LEVEL Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
int32_t BSP_GetVersion(void);
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
void BSP_PB_Callback(Button_TypeDef Button);
|
||||
void BSP_PB_IRQHandler (Button_TypeDef Button);
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM);
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
||||
#endif
|
||||
|
||||
#if (USE_COM_LOG > 0)
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM);
|
||||
#endif
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1U)
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
|
||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback);
|
||||
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32WLXX_NUCLEO__H */
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32wlxx_nucleo_bus.h
|
||||
* @brief : header file for the BSP BUS IO driver
|
||||
******************************************************************************
|
||||
* @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 STM32WLXX_NUCLEO_BUS_H
|
||||
#define STM32WLXX_NUCLEO_BUS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32wlxx_nucleo_conf.h"
|
||||
#include "stm32wlxx_nucleo_errno.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS STM32WLXX_NUCLEO BUS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Exported_Constants STM32WLXX_NUCLEO BUS Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define BUS_I2C2_INSTANCE I2C2
|
||||
#define BUS_I2C2_SCL_GPIO_AF GPIO_AF4_I2C2
|
||||
#define BUS_I2C2_SCL_GPIO_PORT GPIOA
|
||||
#define BUS_I2C2_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define BUS_I2C2_SCL_GPIO_PIN GPIO_PIN_12
|
||||
#define BUS_I2C2_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define BUS_I2C2_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define BUS_I2C2_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define BUS_I2C2_SDA_GPIO_PORT GPIOA
|
||||
#define BUS_I2C2_SDA_GPIO_PIN GPIO_PIN_11
|
||||
#define BUS_I2C2_SDA_GPIO_AF GPIO_AF4_I2C2
|
||||
|
||||
#ifndef BUS_I2C2_POLL_TIMEOUT
|
||||
#define BUS_I2C2_POLL_TIMEOUT 0x1000U
|
||||
#endif
|
||||
/* I2C2 Frequeny in Hz */
|
||||
#ifndef BUS_I2C2_FREQUENCY
|
||||
#define BUS_I2C2_FREQUENCY 1000000U /* Frequency of I2Cn = 100 KHz*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Private_Types STM32WLXX_NUCLEO BUS Private types
|
||||
* @{
|
||||
*/
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 1U)
|
||||
typedef struct
|
||||
{
|
||||
pI2C_CallbackTypeDef pMspInitCb;
|
||||
pI2C_CallbackTypeDef pMspDeInitCb;
|
||||
}BSP_I2C_Cb_t;
|
||||
#endif /* (USE_HAL_I2C_REGISTER_CALLBACKS == 1U) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern I2C_HandleTypeDef hi2c2;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO_BUS_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* BUS IO driver over I2C Peripheral */
|
||||
HAL_StatusTypeDef MX_I2C2_Init(I2C_HandleTypeDef* hi2c);
|
||||
int32_t BSP_I2C2_Init(void);
|
||||
int32_t BSP_I2C2_DeInit(void);
|
||||
int32_t BSP_I2C2_IsReady(uint16_t DevAddr, uint32_t Trials);
|
||||
int32_t BSP_I2C2_WriteReg(uint16_t Addr, uint16_t Reg, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_ReadReg(uint16_t Addr, uint16_t Reg, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_WriteReg16(uint16_t Addr, uint16_t Reg, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_ReadReg16(uint16_t Addr, uint16_t Reg, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_Send(uint16_t DevAddr, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_Recv(uint16_t DevAddr, uint8_t *pData, uint16_t Length);
|
||||
int32_t BSP_I2C2_SendRecv(uint16_t DevAddr, uint8_t *pTxdata, uint8_t *pRxdata, uint16_t Length);
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 1U)
|
||||
int32_t BSP_I2C2_RegisterDefaultMspCallbacks (void);
|
||||
int32_t BSP_I2C2_RegisterMspCallbacks (BSP_I2C_Cb_t *Callbacks);
|
||||
#endif /* (USE_HAL_I2C_REGISTER_CALLBACKS == 1U) */
|
||||
|
||||
int32_t BSP_GetTick(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32WLXX_NUCLEO_BUS_H */
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32wlxx_nucleo_errno.h
|
||||
* @brief : Error Code
|
||||
******************************************************************************
|
||||
* @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 STM32WLXX_NUCLEO_ERRNO_H
|
||||
#define STM32WLXX_NUCLEO_ERRNO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* BSP Common Error codes */
|
||||
#define BSP_ERROR_NONE 0
|
||||
#define BSP_ERROR_NO_INIT -1
|
||||
#define BSP_ERROR_WRONG_PARAM -2
|
||||
#define BSP_ERROR_BUSY -3
|
||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||
#define BSP_ERROR_BUS_FAILURE -8
|
||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||
#define BSP_ERROR_MSP_FAILURE -10
|
||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||
|
||||
/* BSP BUS error codes */
|
||||
|
||||
#define BSP_ERROR_BUS_TRANSACTION_FAILURE -100
|
||||
#define BSP_ERROR_BUS_ARBITRATION_LOSS -101
|
||||
#define BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE -102
|
||||
#define BSP_ERROR_BUS_PROTOCOL_FAILURE -103
|
||||
|
||||
#define BSP_ERROR_BUS_MODE_FAULT -104
|
||||
#define BSP_ERROR_BUS_FRAME_ERROR -105
|
||||
#define BSP_ERROR_BUS_CRC_ERROR -106
|
||||
#define BSP_ERROR_BUS_DMA_FAILURE -107
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*STM32WLXX_NUCLEO_ERRNO_H */
|
||||
|
|
@ -0,0 +1,549 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32wlxx_nucleo.c
|
||||
* @brief : Source file for the BSP Common driver
|
||||
******************************************************************************
|
||||
* @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 "stm32wlxx_nucleo.h"
|
||||
#include "stm32wlxx_hal_exti.h"
|
||||
|
||||
/** @defgroup BSP BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL STM32WLXX_NUCLEO LOW LEVEL
|
||||
* @brief This file provides set of firmware functions to manage Leds and push-button
|
||||
* available on STM32WLxx-Nucleo Kit from STMicroelectronics.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Defines STM32WLXX_NUCLEO LOW LEVEL Private Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_FunctionPrototypes STM32WLXX_NUCLEO LOW LEVEL Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
typedef void (* BSP_EXTI_LineCallback) (void);
|
||||
typedef void (* BSP_BUTTON_GPIO_Init) (void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Variables STM32WLXX_NUCLEO LOW LEVEL Private Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
static GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT};
|
||||
static const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN};
|
||||
static const IRQn_Type BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn};
|
||||
EXTI_HandleTypeDef hpb_exti[BUTTONn] = {{.Line = EXTI_LINE_0}};
|
||||
USART_TypeDef* COM_USART[COMn] = {COM1_UART};
|
||||
UART_HandleTypeDef hcom_uart[COMn];
|
||||
#if (USE_COM_LOG > 0)
|
||||
static COM_TypeDef COM_ActiveLogPort;
|
||||
#endif
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1U)
|
||||
static uint32_t IsUsart1MspCbValid = 0;
|
||||
#endif
|
||||
__weak HAL_StatusTypeDef MX_USART1_UART_Init(UART_HandleTypeDef* huart);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Functions STM32WLXX_NUCLEO LOW LEVEL Private Functions
|
||||
* @{
|
||||
*/
|
||||
static void BUTTON_USER_EXTI_Callback(void);
|
||||
static void BUTTON_USER_GPIO_Init(void);
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
static void USART1_MspInit(UART_HandleTypeDef *huart);
|
||||
static void USART1_MspDeInit(UART_HandleTypeDef *huart);
|
||||
#endif
|
||||
/**
|
||||
* @brief This method returns the STM32WLxx NUCLEO BSP Driver revision
|
||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||
*/
|
||||
int32_t BSP_GetVersion(void)
|
||||
{
|
||||
return (int32_t)__STM32WLXX_NUCLEO_BSP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures button GPIO and EXTI Line.
|
||||
* @param Button: Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: User Push Button
|
||||
* @param ButtonMode Button mode
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
||||
* with interrupt generation capability
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
static const BSP_EXTI_LineCallback ButtonCallback[BUTTONn] ={BUTTON_USER_EXTI_Callback};
|
||||
static const uint32_t BSP_BUTTON_PRIO [BUTTONn] ={BSP_BUTTON_USER_IT_PRIORITY};
|
||||
static const uint32_t BUTTON_EXTI_LINE[BUTTONn] ={USER_BUTTON_EXTI_LINE};
|
||||
static const BSP_BUTTON_GPIO_Init ButtonGpioInit[BUTTONn] = {BUTTON_USER_GPIO_Init};
|
||||
|
||||
ButtonGpioInit[Button]();
|
||||
|
||||
if (ButtonMode == BUTTON_MODE_EXTI)
|
||||
{
|
||||
if(HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else if (HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID, ButtonCallback[Button]) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable and set Button EXTI Interrupt to the lowest priority */
|
||||
HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), BSP_BUTTON_PRIO[Button], 0x00);
|
||||
HAL_NVIC_EnableIRQ((BUTTON_IRQn[Button]));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Push Button DeInit.
|
||||
* @param Button Button to be configured
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER: Wakeup Push Button
|
||||
* @note PB DeInit does not disable the GPIO clock
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_PB_DeInit(Button_TypeDef Button)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init_structure;
|
||||
|
||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||
HAL_NVIC_DisableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
|
||||
HAL_GPIO_DeInit(BUTTON_PORT[Button], gpio_init_structure.Pin);
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the selected button state.
|
||||
* @param Button Button to be addressed
|
||||
* This parameter can be one of the following values:
|
||||
* @arg BUTTON_USER
|
||||
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
||||
*/
|
||||
int32_t BSP_PB_GetState(Button_TypeDef Button)
|
||||
{
|
||||
return (int32_t)(HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]) == GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User EXTI line detection callbacks.
|
||||
* @retval None
|
||||
*/
|
||||
void BSP_PB_IRQHandler (Button_TypeDef Button)
|
||||
{
|
||||
HAL_EXTI_IRQHandler( &hpb_exti[Button] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BSP Push Button callback
|
||||
* @param Button Specifies the pin connected EXTI line
|
||||
* @retval None.
|
||||
*/
|
||||
__weak void BSP_PB_Callback(Button_TypeDef Button)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(Button);
|
||||
|
||||
/* This function should be implemented by the user application.
|
||||
It is called into this driver when an event on Button is triggered. */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief User EXTI line detection callbacks.
|
||||
* @retval None
|
||||
*/
|
||||
static void BUTTON_USER_EXTI_Callback(void)
|
||||
{
|
||||
BSP_PB_Callback(BUTTON_USER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @retval None
|
||||
*/
|
||||
static void BUTTON_USER_GPIO_Init(void) {
|
||||
}
|
||||
|
||||
#if (USE_BSP_COM_FEATURE > 0)
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param COM: COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @param UART_Init: Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval BSP error code
|
||||
*/
|
||||
int32_t BSP_COM_Init(COM_TypeDef COM)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM > COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
hcom_uart[COM].Instance = COM_USART[COM];
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0U)
|
||||
/* Init the UART Msp */
|
||||
USART1_MspInit(&hcom_uart[COM]);
|
||||
#else
|
||||
if(IsUsart1MspCbValid == 0U)
|
||||
{
|
||||
if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE)
|
||||
{
|
||||
return BSP_ERROR_MSP_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (MX_USART1_UART_Init(&hcom_uart[COM]))
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInit COM port.
|
||||
* @param COM COM port to be configured.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM > COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* USART configuration */
|
||||
hcom_uart[COM].Instance = COM_USART[COM];
|
||||
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0U)
|
||||
USART1_MspDeInit(&hcom_uart[COM]);
|
||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0U) */
|
||||
|
||||
if(HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures COM port.
|
||||
* @param huart USART handle
|
||||
* This parameter can be COM1
|
||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||
* configuration information for the specified USART peripheral.
|
||||
* @retval HAL error code
|
||||
*/
|
||||
|
||||
/* USART1 init function */
|
||||
|
||||
__weak HAL_StatusTypeDef MX_USART1_UART_Init(UART_HandleTypeDef* huart)
|
||||
{
|
||||
HAL_StatusTypeDef ret = HAL_OK;
|
||||
|
||||
huart->Instance = USART1;
|
||||
huart->Init.BaudRate = 115200;
|
||||
huart->Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart->Init.StopBits = UART_STOPBITS_1;
|
||||
huart->Init.Parity = UART_PARITY_NONE;
|
||||
huart->Init.Mode = UART_MODE_TX_RX;
|
||||
huart->Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart->Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart->Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart->Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart->AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_UART_Init(huart) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(huart, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(huart, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
if (HAL_UARTEx_DisableFifoMode(huart) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1U)
|
||||
/**
|
||||
* @brief Register Default USART1 Bus Msp Callbacks
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* Register default MspInit/MspDeInit Callback */
|
||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, USART1_MspInit) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, USART1_MspDeInit) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsUsart1MspCbValid = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
/* BSP status */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register USART1 Bus Msp Callback registering
|
||||
* @param Callbacks pointer to USART1 MspInit/MspDeInit callback functions
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_RegisterMspCallbacks (COM_TypeDef COM , BSP_COM_Cb_t *Callback)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if(COM >= COMn)
|
||||
{
|
||||
ret = BSP_ERROR_WRONG_PARAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||
|
||||
/* Register MspInit/MspDeInit Callbacks */
|
||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsUsart1MspCbValid = 1U;
|
||||
}
|
||||
}
|
||||
|
||||
/* BSP status */
|
||||
return ret;
|
||||
}
|
||||
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
||||
|
||||
#if (USE_COM_LOG > 0)
|
||||
/**
|
||||
* @brief Select the active COM port.
|
||||
* @param COM COM port to be activated.
|
||||
* This parameter can be COM1
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
|
||||
{
|
||||
if(COM_ActiveLogPort != COM)
|
||||
{
|
||||
COM_ActiveLogPort = COM;
|
||||
}
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if defined(__CC_ARM) /* For arm compiler 5 */
|
||||
#if !defined(__MICROLIB) /* If not Microlib */
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int dummyVar; //Just for the sake of redefining __FILE, we won't we using it anyways ;)
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
|
||||
#endif /* If not Microlib */
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* For arm compiler 6 */
|
||||
#if !defined(__MICROLIB) /* If not Microlib */
|
||||
|
||||
FILE __stdout;
|
||||
|
||||
#endif /* If not Microlib */
|
||||
#endif /* For arm compiler 5 */
|
||||
#if defined(__ICCARM__) /* For IAR */
|
||||
size_t __write(int Handle, const unsigned char *Buf, size_t Bufsize)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<Bufsize; i++)
|
||||
{
|
||||
(void)HAL_UART_Transmit(&hcom_uart[COM_ActiveLogPort], (uint8_t *)&Buf[i], 1, COM_POLL_TIMEOUT);
|
||||
}
|
||||
|
||||
return Bufsize;
|
||||
}
|
||||
#elif defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) /* For ARM Compiler 5 and 6 */
|
||||
int fputc (int ch, FILE *f)
|
||||
{
|
||||
(void)HAL_UART_Transmit(&hcom_uart[COM_ActiveLogPort], (uint8_t *)&ch, 1, COM_POLL_TIMEOUT);
|
||||
return ch;
|
||||
}
|
||||
#else /* For GCC Toolchains */
|
||||
int __io_putchar (int ch)
|
||||
{
|
||||
(void)HAL_UART_Transmit(&hcom_uart[COM_ActiveLogPort], (uint8_t *)&ch, 1, COM_POLL_TIMEOUT);
|
||||
return ch;
|
||||
}
|
||||
#endif /* For IAR */
|
||||
#endif /* USE_COM_LOG */
|
||||
/**
|
||||
* @brief Initializes USART1 MSP.
|
||||
* @param huart USART1 handle
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
static void USART1_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
/* USER CODE BEGIN USART1_MspInit 0 */
|
||||
|
||||
/* USER CODE END USART1_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1;
|
||||
PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
|
||||
|
||||
/* Enable Peripheral clock */
|
||||
__HAL_RCC_USART1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**USART1 GPIO Configuration
|
||||
PB7 ------> USART1_RX
|
||||
PB6 ------> USART1_TX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = BUS_USART1_RX_GPIO_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = BUS_USART1_RX_GPIO_AF;
|
||||
HAL_GPIO_Init(BUS_USART1_RX_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = BUS_USART1_TX_GPIO_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = BUS_USART1_TX_GPIO_AF;
|
||||
HAL_GPIO_Init(BUS_USART1_TX_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
||||
|
||||
/* USER CODE END USART1_MspInit 1 */
|
||||
}
|
||||
|
||||
static void USART1_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
{
|
||||
/* USER CODE BEGIN USART1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END USART1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_USART1_CLK_DISABLE();
|
||||
|
||||
/**USART1 GPIO Configuration
|
||||
PB7 ------> USART1_RX
|
||||
PB6 ------> USART1_TX
|
||||
*/
|
||||
HAL_GPIO_DeInit(BUS_USART1_RX_GPIO_PORT, BUS_USART1_RX_GPIO_PIN);
|
||||
|
||||
HAL_GPIO_DeInit(BUS_USART1_TX_GPIO_PORT, BUS_USART1_TX_GPIO_PIN);
|
||||
|
||||
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END USART1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
@ -0,0 +1,505 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32wlxx_nucleo_bus.c
|
||||
* @brief : source file for the BSP BUS IO driver
|
||||
******************************************************************************
|
||||
* @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 "stm32wlxx_nucleo_bus.h"
|
||||
|
||||
__weak HAL_StatusTypeDef MX_I2C2_Init(I2C_HandleTypeDef* hi2c);
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32WLXX_NUCLEO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS STM32WLXX_NUCLEO BUS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Exported_Variables BUS Exported Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern I2C_HandleTypeDef hi2c2;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Private_Variables BUS Private Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 1U)
|
||||
static uint32_t IsI2C2MspCbValid = 0;
|
||||
#endif /* USE_HAL_I2C_REGISTER_CALLBACKS */
|
||||
static uint32_t I2C2InitCounter = 0;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Private_FunctionPrototypes BUS Private Function
|
||||
* @{
|
||||
*/
|
||||
|
||||
static void I2C2_MspInit(I2C_HandleTypeDef* hI2c);
|
||||
static void I2C2_MspDeInit(I2C_HandleTypeDef* hI2c);
|
||||
#if (USE_CUBEMX_BSP_V2 == 1)
|
||||
static uint32_t I2C_GetTiming(uint32_t clock_src_hz, uint32_t i2cfreq_hz);
|
||||
static void Compute_PRESC_SCLDEL_SDADEL(uint32_t clock_src_freq, uint32_t I2C_Speed);
|
||||
static uint32_t Compute_SCLL_SCLH (uint32_t clock_src_freq, uint32_t I2C_speed);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_LOW_LEVEL_Private_Functions STM32WLXX_NUCLEO LOW LEVEL Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32WLXX_NUCLEO_BUS_Exported_Functions STM32WLXX_NUCLEO_BUS Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* BUS IO driver over I2C Peripheral */
|
||||
/*******************************************************************************
|
||||
BUS OPERATIONS OVER I2C
|
||||
*******************************************************************************/
|
||||
/**
|
||||
* @brief Initialize I2C HAL
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_Init(void)
|
||||
{
|
||||
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
hi2c2.Instance = I2C2;
|
||||
|
||||
if(I2C2InitCounter++ == 0)
|
||||
{
|
||||
if (HAL_I2C_GetState(&hi2c2) == HAL_I2C_STATE_RESET)
|
||||
{
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 0U)
|
||||
/* Init the I2C Msp */
|
||||
I2C2_MspInit(&hi2c2);
|
||||
#else
|
||||
if(IsI2C2MspCbValid == 0U)
|
||||
{
|
||||
if(BSP_I2C2_RegisterDefaultMspCallbacks() != BSP_ERROR_NONE)
|
||||
{
|
||||
return BSP_ERROR_MSP_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(ret == BSP_ERROR_NONE)
|
||||
{
|
||||
/* Init the I2C */
|
||||
if(MX_I2C2_Init(&hi2c2) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_FAILURE;
|
||||
}
|
||||
else if(HAL_I2CEx_ConfigAnalogFilter(&hi2c2, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitialize I2C HAL.
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_DeInit(void)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (I2C2InitCounter > 0)
|
||||
{
|
||||
if (--I2C2InitCounter == 0)
|
||||
{
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 0U)
|
||||
/* DeInit the I2C */
|
||||
I2C2_MspDeInit(&hi2c2);
|
||||
#endif
|
||||
/* DeInit the I2C */
|
||||
if (HAL_I2C_DeInit(&hi2c2) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the I2C bus is ready.
|
||||
* @param DevAddr : I2C device address
|
||||
* @param Trials : Check trials number
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_IsReady(uint16_t DevAddr, uint32_t Trials)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_IsDeviceReady(&hi2c2, DevAddr, Trials, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
ret = BSP_ERROR_BUSY;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write a value in a register of the device through BUS.
|
||||
* @param DevAddr Device address on Bus.
|
||||
* @param Reg The target register address to write
|
||||
* @param pData Pointer to data buffer to write
|
||||
* @param Length Data Length
|
||||
* @retval BSP status
|
||||
*/
|
||||
|
||||
int32_t BSP_I2C2_WriteReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Mem_Write(&hi2c2, DevAddr,Reg, I2C_MEMADD_SIZE_8BIT,pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) == HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read a register of the device through BUS
|
||||
* @param DevAddr Device address on Bus.
|
||||
* @param Reg The target register address to read
|
||||
* @param pData Pointer to data buffer to read
|
||||
* @param Length Data Length
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_ReadReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Mem_Read(&hi2c2, DevAddr, Reg, I2C_MEMADD_SIZE_8BIT, pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) == HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* @brief Write a value in a register of the device through BUS.
|
||||
* @param DevAddr Device address on Bus.
|
||||
* @param Reg The target register address to write
|
||||
|
||||
* @param pData Pointer to data buffer to write
|
||||
* @param Length Data Length
|
||||
* @retval BSP statu
|
||||
*/
|
||||
int32_t BSP_I2C2_WriteReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Mem_Write(&hi2c2, DevAddr, Reg, I2C_MEMADD_SIZE_16BIT, pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) == HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read registers through a bus (16 bits)
|
||||
* @param DevAddr: Device address on BUS
|
||||
* @param Reg: The target register address to read
|
||||
* @param Length Data Length
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_ReadReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
|
||||
{
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Mem_Read(&hi2c2, DevAddr, Reg, I2C_MEMADD_SIZE_16BIT, pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) != HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send an amount width data through bus (Simplex)
|
||||
* @param DevAddr: Device address on Bus.
|
||||
* @param pData: Data pointer
|
||||
* @param Length: Data length
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_Send(uint16_t DevAddr, uint8_t *pData, uint16_t Length) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Master_Transmit(&hi2c2, DevAddr, pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) != HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive an amount of data through a bus (Simplex)
|
||||
* @param DevAddr: Device address on Bus.
|
||||
* @param pData: Data pointer
|
||||
* @param Length: Data length
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_Recv(uint16_t DevAddr, uint8_t *pData, uint16_t Length) {
|
||||
int32_t ret = BSP_ERROR_NONE;
|
||||
|
||||
if (HAL_I2C_Master_Receive(&hi2c2, DevAddr, pData, Length, BUS_I2C2_POLL_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
if (HAL_I2C_GetError(&hi2c2) != HAL_I2C_ERROR_AF)
|
||||
{
|
||||
ret = BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (USE_HAL_I2C_REGISTER_CALLBACKS == 1U)
|
||||
/**
|
||||
* @brief Register Default BSP I2C2 Bus Msp Callbacks
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_RegisterDefaultMspCallbacks (void)
|
||||
{
|
||||
|
||||
__HAL_I2C_RESET_HANDLE_STATE(&hi2c2);
|
||||
|
||||
/* Register MspInit Callback */
|
||||
if (HAL_I2C_RegisterCallback(&hi2c2, HAL_I2C_MSPINIT_CB_ID, I2C2_MspInit) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
|
||||
/* Register MspDeInit Callback */
|
||||
if (HAL_I2C_RegisterCallback(&hi2c2, HAL_I2C_MSPDEINIT_CB_ID, I2C2_MspDeInit) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
IsI2C2MspCbValid = 1;
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BSP I2C2 Bus Msp Callback registering
|
||||
* @param Callbacks pointer to I2C2 MspInit/MspDeInit callback functions
|
||||
* @retval BSP status
|
||||
*/
|
||||
int32_t BSP_I2C2_RegisterMspCallbacks (BSP_I2C_Cb_t *Callbacks)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
__HAL_I2C_RESET_HANDLE_STATE(&hi2c2);
|
||||
|
||||
/* Register MspInit Callback */
|
||||
if (HAL_I2C_RegisterCallback(&hi2c2, HAL_I2C_MSPINIT_CB_ID, Callbacks->pMspInitCb) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
|
||||
/* Register MspDeInit Callback */
|
||||
if (HAL_I2C_RegisterCallback(&hi2c2, HAL_I2C_MSPDEINIT_CB_ID, Callbacks->pMspDeInitCb) != HAL_OK)
|
||||
{
|
||||
return BSP_ERROR_PERIPH_FAILURE;
|
||||
}
|
||||
|
||||
IsI2C2MspCbValid = 1;
|
||||
|
||||
return BSP_ERROR_NONE;
|
||||
}
|
||||
#endif /* USE_HAL_I2C_REGISTER_CALLBACKS */
|
||||
|
||||
/**
|
||||
* @brief Return system tick in ms
|
||||
* @retval Current HAL time base time stamp
|
||||
*/
|
||||
int32_t BSP_GetTick(void) {
|
||||
return HAL_GetTick();
|
||||
}
|
||||
|
||||
/* I2C2 init function */
|
||||
|
||||
__weak HAL_StatusTypeDef MX_I2C2_Init(I2C_HandleTypeDef* hi2c)
|
||||
{
|
||||
HAL_StatusTypeDef ret = HAL_OK;
|
||||
|
||||
hi2c->Instance = I2C2;
|
||||
hi2c->Init.Timing = 0x20303E5D;
|
||||
hi2c->Init.OwnAddress1 = 0;
|
||||
hi2c->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
hi2c->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
hi2c->Init.OwnAddress2 = 0;
|
||||
hi2c->Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||
hi2c->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
hi2c->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if (HAL_I2C_Init(hi2c) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
if (HAL_I2CEx_ConfigAnalogFilter(hi2c, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
if (HAL_I2CEx_ConfigDigitalFilter(hi2c, 0) != HAL_OK)
|
||||
{
|
||||
ret = HAL_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void I2C2_MspInit(I2C_HandleTypeDef* i2cHandle)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
/* USER CODE BEGIN I2C2_MspInit 0 */
|
||||
|
||||
/* USER CODE END I2C2_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clocks
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C2;
|
||||
PeriphClkInitStruct.I2c2ClockSelection = RCC_I2C2CLKSOURCE_PCLK1;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**I2C2 GPIO Configuration
|
||||
PA12 ------> I2C2_SCL
|
||||
PA15 ------> I2C2_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = BUS_I2C2_SCL_GPIO_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = BUS_I2C2_SCL_GPIO_AF;
|
||||
HAL_GPIO_Init(BUS_I2C2_SCL_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = BUS_I2C2_SDA_GPIO_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = BUS_I2C2_SDA_GPIO_AF;
|
||||
HAL_GPIO_Init(BUS_I2C2_SDA_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_I2C2_CLK_ENABLE();
|
||||
/* USER CODE BEGIN I2C2_MspInit 1 */
|
||||
|
||||
/* USER CODE END I2C2_MspInit 1 */
|
||||
}
|
||||
|
||||
static void I2C2_MspDeInit(I2C_HandleTypeDef* i2cHandle)
|
||||
{
|
||||
/* USER CODE BEGIN I2C2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END I2C2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_I2C2_CLK_DISABLE();
|
||||
|
||||
/**I2C2 GPIO Configuration
|
||||
PA12 ------> I2C2_SCL
|
||||
PA11 ------> I2C2_SDA
|
||||
*/
|
||||
HAL_GPIO_DeInit(BUS_I2C2_SCL_GPIO_PORT, BUS_I2C2_SCL_GPIO_PIN);
|
||||
|
||||
HAL_GPIO_DeInit(BUS_I2C2_SDA_GPIO_PORT, BUS_I2C2_SDA_GPIO_PIN);
|
||||
|
||||
/* USER CODE BEGIN I2C2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END I2C2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file 53l8a1_conf.h
|
||||
* @author IMG SW Application Team
|
||||
* @brief This file contains definitions for the ToF components bus interfaces
|
||||
* when using the X-NUCLEO-53L8A1 expansion board
|
||||
******************************************************************************
|
||||
* @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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "stm32wlxx_hal.h"
|
||||
#include "stm32wlxx_nucleo_bus.h"
|
||||
#include "stm32wlxx_nucleo.h"
|
||||
#include "stm32wlxx_nucleo_errno.h"
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef VL53L8A1_CONF_H
|
||||
#define VL53L8A1_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/*
|
||||
* the 53L8A1 BSP driver uses this symbol to allocate a structure for each device
|
||||
* if you are only using the on-board sensor without break-out boards
|
||||
* change its to (1U) in order to save space in RAM memory
|
||||
*/
|
||||
#define RANGING_SENSOR_INSTANCES_NBR (3) //(3U)
|
||||
|
||||
#define VL53L8A1_I2C_INIT BSP_I2C2_Init
|
||||
#define VL53L8A1_I2C_DEINIT BSP_I2C2_DeInit
|
||||
#define VL53L8A1_I2C_WRITEREG BSP_I2C2_WriteReg16
|
||||
#define VL53L8A1_I2C_READREG BSP_I2C2_ReadReg16
|
||||
#define VL53L8A1_GETTICK BSP_GetTick
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VL53L8A1_CONF_H*/
|
Loading…
Reference in New Issue