2021-07-12 23:33:05 +02:00
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
******************************************************************************
|
|
|
|
* @file stm32h7xx_nucleo.h
|
|
|
|
* @author MCD Application Team
|
|
|
|
* @brief This file contains definitions for:
|
|
|
|
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
|
|
|
* from STMicroelectronics
|
|
|
|
******************************************************************************
|
|
|
|
* @attention
|
|
|
|
*
|
|
|
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
|
|
|
* All rights reserved.</center></h2>
|
|
|
|
*
|
|
|
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
|
|
* the "License"; You may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at:
|
|
|
|
* opensource.org/licenses/BSD-3-Clause
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
|
|
#ifndef STM32H7XX_NUCLEO_H
|
|
|
|
#define STM32H7XX_NUCLEO_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-05-22 15:30:38 +02:00
|
|
|
extern "C" {
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "stm32h7xx_nucleo_conf.h"
|
|
|
|
#include "stm32h7xx_nucleo_errno.h"
|
|
|
|
|
|
|
|
#if (USE_BSP_COM_FEATURE > 0)
|
2022-05-22 15:30:38 +02:00
|
|
|
#if (USE_COM_LOG > 0)
|
|
|
|
#ifndef __GNUC__
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @addtogroup BSP
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @brief Define for STM32H7XX_NUCLEO board
|
|
|
|
*/
|
|
|
|
#if !defined(USE_STM32H7XX_NUCLEO)
|
|
|
|
#define USE_STM32H7XX_NUCLEO
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
#if !defined(USE_NUCLEO_144)
|
|
|
|
#error \
|
|
|
|
"Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
#if !defined(USE_NUCLEO_H745ZI_Q) && !defined(USE_NUCLEO_H743ZI) && \
|
|
|
|
!defined(USE_NUCLEO_H743ZI2) && !defined(USE_NUCLEO_H7A3ZI_Q) && \
|
|
|
|
!defined(USE_NUCLEO_H723ZG)
|
|
|
|
#error \
|
|
|
|
"Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\
|
2021-07-12 23:33:05 +02:00
|
|
|
USE_NUCLEO_H745ZI_Q, USE_NUCLEO_H743ZI, USE_NUCLEO_H743ZI2, USE_NUCLEO_H7A3ZI_Q, USE_NUCLEO_H723ZG"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
|
|
|
|
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
|
|
|
|
typedef enum {
|
2021-07-12 23:33:05 +02:00
|
|
|
LED1 = 0,
|
|
|
|
LED_GREEN = LED1,
|
|
|
|
LED2 = 1,
|
|
|
|
LED_YELLOW = LED2,
|
|
|
|
LED3 = 2,
|
|
|
|
LED_RED = LED3,
|
|
|
|
LEDn
|
2022-05-22 15:30:38 +02:00
|
|
|
} Led_TypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
#else /* USE_NUCLEO_H743ZI */
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef enum {
|
2021-07-12 23:33:05 +02:00
|
|
|
LED1 = 0,
|
|
|
|
LED_GREEN = LED1,
|
|
|
|
LED2 = 1,
|
|
|
|
LED_BLUE = LED2,
|
|
|
|
LED3 = 2,
|
|
|
|
LED_RED = LED3,
|
|
|
|
LEDn
|
2022-05-22 15:30:38 +02:00
|
|
|
} Led_TypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef enum { BUTTON_USER = 0U, BUTTONn } Button_TypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef enum { BUTTON_MODE_GPIO = 0, BUTTON_MODE_EXTI = 1 } ButtonMode_TypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
#if (USE_BSP_COM_FEATURE > 0)
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef enum { COM1 = 0U, COMn } COM_TypeDef;
|
|
|
|
|
|
|
|
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 enum {
|
2021-07-12 23:33:05 +02:00
|
|
|
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
|
|
|
|
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
|
|
|
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
2022-05-22 15:30:38 +02:00
|
|
|
} COM_WordLengthTypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef struct {
|
|
|
|
uint32_t BaudRate;
|
|
|
|
COM_WordLengthTypeDef WordLength;
|
|
|
|
COM_StopBitsTypeDef StopBits;
|
|
|
|
COM_ParityTypeDef Parity;
|
|
|
|
COM_HwFlowCtlTypeDef HwFlowCtl;
|
|
|
|
} COM_InitTypeDef;
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
2022-05-22 15:30:38 +02:00
|
|
|
typedef struct {
|
|
|
|
void (*pMspInitCb)(UART_HandleTypeDef *);
|
|
|
|
void (*pMspDeInitCb)(UART_HandleTypeDef *);
|
|
|
|
} BSP_COM_Cb_t;
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
|
|
|
|
|
|
|
|
#define MX_UART_InitTypeDef COM_InitTypeDef
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported
|
|
|
|
* Constants
|
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @brief STM32H7XX NUCLEO BSP Driver version number V1.3.0
|
|
|
|
*/
|
|
|
|
#define STM32H7XX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */
|
|
|
|
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
|
|
|
|
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
|
|
|
|
#define STM32H7XX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate \
|
|
|
|
*/
|
|
|
|
#define STM32H7XX_NUCLEO_BSP_VERSION \
|
|
|
|
((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24) | \
|
|
|
|
(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16) | \
|
|
|
|
(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8) | \
|
|
|
|
(STM32H7XX_NUCLEO_BSP_VERSION_RC))
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#define LEDn 3U
|
|
|
|
|
|
|
|
#define LED1_PIN GPIO_PIN_0
|
|
|
|
#define LED1_GPIO_PORT GPIOB
|
|
|
|
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
|
|
|
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
|
|
|
|
|
|
|
#if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
|
|
|
|
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
|
|
|
|
#define LED2_PIN GPIO_PIN_1
|
|
|
|
#define LED2_GPIO_PORT GPIOE
|
|
|
|
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
|
|
|
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
2021-07-12 23:33:05 +02:00
|
|
|
#else /* USE_NUCLEO_H743ZI */
|
2022-05-22 15:30:38 +02:00
|
|
|
#define LED2_PIN GPIO_PIN_7
|
|
|
|
#define LED2_GPIO_PORT GPIOB
|
|
|
|
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
|
|
|
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
#define LED3_PIN GPIO_PIN_14
|
|
|
|
#define LED3_GPIO_PORT GPIOB
|
|
|
|
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
|
|
|
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
/* Button state */
|
2022-05-22 15:30:38 +02:00
|
|
|
#define BUTTON_RELEASED 0U
|
|
|
|
#define BUTTON_PRESSED 1U
|
|
|
|
#define BUTTONn 1U
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Key push-button
|
|
|
|
*/
|
2022-05-22 15:30:38 +02:00
|
|
|
#define BUTTON_USER_PIN GPIO_PIN_13
|
|
|
|
#define BUTTON_USER_GPIO_PORT GPIOC
|
|
|
|
#define BUTTON_USER_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
|
|
|
#define BUTTON_USER_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
|
|
|
#define BUTTON_USER_EXTI_IRQn EXTI15_10_IRQn
|
|
|
|
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
/**
|
|
|
|
* @brief Definition for COM port1, connected to USART3
|
|
|
|
*/
|
|
|
|
#if (USE_BSP_COM_FEATURE > 0)
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
#define COMn 1U
|
|
|
|
#define COM1_UART USART3
|
|
|
|
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
|
|
|
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
|
|
|
|
|
|
|
|
#define COM1_TX_PIN GPIO_PIN_8
|
|
|
|
#define COM1_TX_GPIO_PORT GPIOD
|
|
|
|
#define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
|
|
|
#define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
|
|
|
#define COM1_TX_AF GPIO_AF7_USART3
|
|
|
|
|
|
|
|
#define COM1_RX_PIN GPIO_PIN_9
|
|
|
|
#define COM1_RX_GPIO_PORT GPIOD
|
|
|
|
#define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
|
|
|
#define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
|
|
|
#define COM1_RX_AF GPIO_AF7_USART3
|
|
|
|
#define COM_POLL_TIMEOUT 1000
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables
|
2022-05-22 15:30:38 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
extern EXTI_HandleTypeDef hpb_exti[];
|
|
|
|
#if (USE_BSP_COM_FEATURE > 0)
|
|
|
|
extern UART_HandleTypeDef hcom_uart[];
|
2022-05-22 15:30:38 +02:00
|
|
|
extern USART_TypeDef *COM_USART[];
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_FunctionsPrototypes LOW LEVEL
|
|
|
|
* Exported Functions Prototypes
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
int32_t BSP_GetVersion(void);
|
|
|
|
int32_t BSP_LED_Init(Led_TypeDef Led);
|
|
|
|
int32_t BSP_LED_DeInit(Led_TypeDef Led);
|
|
|
|
int32_t BSP_LED_On(Led_TypeDef Led);
|
|
|
|
int32_t BSP_LED_Off(Led_TypeDef Led);
|
|
|
|
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
|
|
|
int32_t BSP_LED_GetState(Led_TypeDef Led);
|
|
|
|
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_IRQHandler(Button_TypeDef Button);
|
|
|
|
void BSP_PB_Callback(Button_TypeDef Button);
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
#if (USE_BSP_COM_FEATURE > 0)
|
2022-05-22 15:30:38 +02:00
|
|
|
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
|
|
|
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
2021-07-12 23:33:05 +02:00
|
|
|
#if (USE_COM_LOG > 0)
|
2022-05-22 15:30:38 +02:00
|
|
|
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM);
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
|
|
|
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
|
2022-05-22 15:30:38 +02:00
|
|
|
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback);
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
2022-05-22 15:30:38 +02:00
|
|
|
HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
|
|
|
|
MX_UART_InitTypeDef *COM_Init);
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif /* USE_BSP_COM_FEATURE */
|
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-22 15:30:38 +02:00
|
|
|
* @}
|
|
|
|
*/
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* STM32H7XX_NUCLEO_H */
|
|
|
|
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|