Serial REPL support
This commit is contained in:
parent
a0e6975b9d
commit
f31a0d9cf5
@ -40,3 +40,13 @@ exit
|
||||
help
|
||||
help all
|
||||
quit
|
||||
quit
|
||||
tar ext /dev/cu.usbmodemC2CECCE21
|
||||
mon tpwr enable
|
||||
tar ext /dev/cu.usbmodemC2CECCE21
|
||||
mon tpwr enable
|
||||
quit
|
||||
tar ext /dev/cu.usbmodemC2CECCE21
|
||||
mon tpwr enable
|
||||
quit
|
||||
quit
|
||||
|
1
ports/stm32f4/.gitignore
vendored
1
ports/stm32f4/.gitignore
vendored
@ -6,3 +6,4 @@ build-*/
|
||||
#####################
|
||||
ref/
|
||||
|
||||
.gdb_history
|
@ -21,6 +21,7 @@
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
DEBUG = 1
|
||||
|
||||
# Select the board to build for.
|
||||
ifeq ($(BOARD),)
|
||||
@ -73,7 +74,7 @@ INC += -I../../lib/mp-readline
|
||||
INC += -I../../lib/tinyusb/src
|
||||
INC += -I../../supervisor/shared/usb
|
||||
|
||||
DEBUG = 1
|
||||
|
||||
#Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb
|
||||
@ -141,6 +142,8 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD
|
||||
######################################
|
||||
|
||||
SRC_STM32 = \
|
||||
boards/$(BOARD)/stm32f4xx_it.c \
|
||||
boards/$(BOARD)/stm32f4xx_hal_msp.c \
|
||||
stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
|
||||
stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
|
||||
stm32cube/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
|
||||
@ -178,7 +181,7 @@ SRC_C += \
|
||||
lib/utils/stdout_helpers.c \
|
||||
lib/utils/sys_stdio_mphal.c \
|
||||
supervisor/shared/memory.c \
|
||||
lib/tinyusb/src/portable/st/stm32f4/dcd_stm32f4.c
|
||||
#lib/tinyusb/src/portable/st/stm32f4/dcd_stm32f4.c
|
||||
|
||||
#
|
||||
|
||||
|
@ -46,7 +46,7 @@ void run_background_tasks(void) {
|
||||
}
|
||||
running_background_tasks = true;
|
||||
filesystem_background();
|
||||
usb_background();
|
||||
//usb_background();
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
displayio_refresh_displays();
|
||||
|
@ -48,17 +48,17 @@
|
||||
/* #define HAL_NAND_MODULE_ENABLED */
|
||||
/* #define HAL_NOR_MODULE_ENABLED */
|
||||
/* #define HAL_PCCARD_MODULE_ENABLED */
|
||||
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||
#define HAL_SRAM_MODULE_ENABLED
|
||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||
/* #define HAL_HASH_MODULE_ENABLED */
|
||||
/* #define HAL_I2C_MODULE_ENABLED */
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
#define HAL_I2C_MODULE_ENABLED
|
||||
#define HAL_I2S_MODULE_ENABLED
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
#define HAL_SD_MODULE_ENABLED
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
@ -67,11 +67,11 @@
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
//#define HAL_PCD_MODULE_ENABLED
|
||||
#define HAL_PCD_MODULE_ENABLED
|
||||
/* #define HAL_HCD_MODULE_ENABLED */
|
||||
/* #define HAL_DSI_MODULE_ENABLED */
|
||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||
#define HAL_QSPI_MODULE_ENABLED
|
||||
/* #define HAL_CEC_MODULE_ENABLED */
|
||||
/* #define HAL_FMPI2C_MODULE_ENABLED */
|
||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||
@ -144,7 +144,7 @@
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
|
||||
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0U
|
||||
#define PREFETCH_ENABLE 1U
|
||||
|
832
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_hal_msp.c
Normal file
832
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_hal_msp.c
Normal file
@ -0,0 +1,832 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* File Name : stm32f4xx_hal_msp.c
|
||||
* Description : This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
#define LED3_Pin GPIO_PIN_2
|
||||
#define LED3_GPIO_Port GPIOE
|
||||
#define LED4_Pin GPIO_PIN_3
|
||||
#define LED4_GPIO_Port GPIOE
|
||||
#define DFSDM_DATIN3_Pin GPIO_PIN_4
|
||||
#define DFSDM_DATIN3_GPIO_Port GPIOE
|
||||
#define A0_Pin GPIO_PIN_0
|
||||
#define A0_GPIO_Port GPIOF
|
||||
#define LCD_BLCTRL_Pin GPIO_PIN_5
|
||||
#define LCD_BLCTRL_GPIO_Port GPIOF
|
||||
#define QSPI_BK1_IO3_Pin GPIO_PIN_6
|
||||
#define QSPI_BK1_IO3_GPIO_Port GPIOF
|
||||
#define QSPI_BK1_IO2_Pin GPIO_PIN_7
|
||||
#define QSPI_BK1_IO2_GPIO_Port GPIOF
|
||||
#define QSPI_BK1_IO0_Pin GPIO_PIN_8
|
||||
#define QSPI_BK1_IO0_GPIO_Port GPIOF
|
||||
#define QSPI_BK1_IO1_Pin GPIO_PIN_9
|
||||
#define QSPI_BK1_IO1_GPIO_Port GPIOF
|
||||
#define STLK_MCO_Pin GPIO_PIN_0
|
||||
#define STLK_MCO_GPIO_Port GPIOH
|
||||
#define DFSDM_CKOUT_Pin GPIO_PIN_2
|
||||
#define DFSDM_CKOUT_GPIO_Port GPIOC
|
||||
#define JOY_SEL_Pin GPIO_PIN_0
|
||||
#define JOY_SEL_GPIO_Port GPIOA
|
||||
#define STLINK_RX_Pin GPIO_PIN_2
|
||||
#define STLINK_RX_GPIO_Port GPIOA
|
||||
#define STLINK_TX_Pin GPIO_PIN_3
|
||||
#define STLINK_TX_GPIO_Port GPIOA
|
||||
#define CODEC_I2S3_WS_Pin GPIO_PIN_4
|
||||
#define CODEC_I2S3_WS_GPIO_Port GPIOA
|
||||
#define DFSDM_DATIN0_Pin GPIO_PIN_1
|
||||
#define DFSDM_DATIN0_GPIO_Port GPIOB
|
||||
#define QSPI_CLK_Pin GPIO_PIN_2
|
||||
#define QSPI_CLK_GPIO_Port GPIOB
|
||||
#define EXT_RESET_Pin GPIO_PIN_11
|
||||
#define EXT_RESET_GPIO_Port GPIOF
|
||||
#define CTP_RST_Pin GPIO_PIN_12
|
||||
#define CTP_RST_GPIO_Port GPIOF
|
||||
#define JOY_RIGHT_Pin GPIO_PIN_14
|
||||
#define JOY_RIGHT_GPIO_Port GPIOF
|
||||
#define JOY_LEFT_Pin GPIO_PIN_15
|
||||
#define JOY_LEFT_GPIO_Port GPIOF
|
||||
#define JOY_UP_Pin GPIO_PIN_0
|
||||
#define JOY_UP_GPIO_Port GPIOG
|
||||
#define JOY_DOWN_Pin GPIO_PIN_1
|
||||
#define JOY_DOWN_GPIO_Port GPIOG
|
||||
#define D4_Pin GPIO_PIN_7
|
||||
#define D4_GPIO_Port GPIOE
|
||||
#define D5_Pin GPIO_PIN_8
|
||||
#define D5_GPIO_Port GPIOE
|
||||
#define D6_Pin GPIO_PIN_9
|
||||
#define D6_GPIO_Port GPIOE
|
||||
#define D7_Pin GPIO_PIN_10
|
||||
#define D7_GPIO_Port GPIOE
|
||||
#define D8_Pin GPIO_PIN_11
|
||||
#define D8_GPIO_Port GPIOE
|
||||
#define D9_Pin GPIO_PIN_12
|
||||
#define D9_GPIO_Port GPIOE
|
||||
#define D10_Pin GPIO_PIN_13
|
||||
#define D10_GPIO_Port GPIOE
|
||||
#define D11_Pin GPIO_PIN_14
|
||||
#define D11_GPIO_Port GPIOE
|
||||
#define D12_Pin GPIO_PIN_15
|
||||
#define D12_GPIO_Port GPIOE
|
||||
#define I2C2_SCL_Pin GPIO_PIN_10
|
||||
#define I2C2_SCL_GPIO_Port GPIOB
|
||||
#define M2_CKIN_Pin GPIO_PIN_11
|
||||
#define M2_CKIN_GPIO_Port GPIOB
|
||||
#define CODEC_I2S3_SCK_Pin GPIO_PIN_12
|
||||
#define CODEC_I2S3_SCK_GPIO_Port GPIOB
|
||||
#define D13_Pin GPIO_PIN_8
|
||||
#define D13_GPIO_Port GPIOD
|
||||
#define D14_Pin GPIO_PIN_9
|
||||
#define D14_GPIO_Port GPIOD
|
||||
#define D15_Pin GPIO_PIN_10
|
||||
#define D15_GPIO_Port GPIOD
|
||||
#define LCD_RESET_Pin GPIO_PIN_11
|
||||
#define LCD_RESET_GPIO_Port GPIOD
|
||||
#define D0_Pin GPIO_PIN_14
|
||||
#define D0_GPIO_Port GPIOD
|
||||
#define D1_Pin GPIO_PIN_15
|
||||
#define D1_GPIO_Port GPIOD
|
||||
#define CODEC_INT_Pin GPIO_PIN_2
|
||||
#define CODEC_INT_GPIO_Port GPIOG
|
||||
#define LCD_TE_Pin GPIO_PIN_4
|
||||
#define LCD_TE_GPIO_Port GPIOG
|
||||
#define CTP_INT_Pin GPIO_PIN_5
|
||||
#define CTP_INT_GPIO_Port GPIOG
|
||||
#define QSPI_BK1_NCS_Pin GPIO_PIN_6
|
||||
#define QSPI_BK1_NCS_GPIO_Port GPIOG
|
||||
#define USB_OTGFS_OVRCR_Pin GPIO_PIN_7
|
||||
#define USB_OTGFS_OVRCR_GPIO_Port GPIOG
|
||||
#define USB_OTGFS_PPWR_EN_Pin GPIO_PIN_8
|
||||
#define USB_OTGFS_PPWR_EN_GPIO_Port GPIOG
|
||||
#define CODEC_I2S3_MCK_Pin GPIO_PIN_7
|
||||
#define CODEC_I2S3_MCK_GPIO_Port GPIOC
|
||||
#define uSD_D0_Pin GPIO_PIN_8
|
||||
#define uSD_D0_GPIO_Port GPIOC
|
||||
#define uSD_D1_Pin GPIO_PIN_9
|
||||
#define uSD_D1_GPIO_Port GPIOC
|
||||
#define M2_CKINA8_Pin GPIO_PIN_8
|
||||
#define M2_CKINA8_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_VBUS_Pin GPIO_PIN_9
|
||||
#define USB_OTGFS_VBUS_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_ID_Pin GPIO_PIN_10
|
||||
#define USB_OTGFS_ID_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_DM_Pin GPIO_PIN_11
|
||||
#define USB_OTGFS_DM_GPIO_Port GPIOA
|
||||
#define USB_OTGFS_DP_Pin GPIO_PIN_12
|
||||
#define USB_OTGFS_DP_GPIO_Port GPIOA
|
||||
#define SWDIO_Pin GPIO_PIN_13
|
||||
#define SWDIO_GPIO_Port GPIOA
|
||||
#define SWCLK_Pin GPIO_PIN_14
|
||||
#define SWCLK_GPIO_Port GPIOA
|
||||
#define uSD_D2_Pin GPIO_PIN_10
|
||||
#define uSD_D2_GPIO_Port GPIOC
|
||||
#define uSD_D3_Pin GPIO_PIN_11
|
||||
#define uSD_D3_GPIO_Port GPIOC
|
||||
#define uSD_CLK_Pin GPIO_PIN_12
|
||||
#define uSD_CLK_GPIO_Port GPIOC
|
||||
#define D2_Pin GPIO_PIN_0
|
||||
#define D2_GPIO_Port GPIOD
|
||||
#define D3_Pin GPIO_PIN_1
|
||||
#define D3_GPIO_Port GPIOD
|
||||
#define uSD_CMD_Pin GPIO_PIN_2
|
||||
#define uSD_CMD_GPIO_Port GPIOD
|
||||
#define uSD_DETECT_Pin GPIO_PIN_3
|
||||
#define uSD_DETECT_GPIO_Port GPIOD
|
||||
#define FMC_NOE_Pin GPIO_PIN_4
|
||||
#define FMC_NOE_GPIO_Port GPIOD
|
||||
#define FMC_NWE_Pin GPIO_PIN_5
|
||||
#define FMC_NWE_GPIO_Port GPIOD
|
||||
#define FMC_NE1_Pin GPIO_PIN_7
|
||||
#define FMC_NE1_GPIO_Port GPIOD
|
||||
#define SWO_Pin GPIO_PIN_3
|
||||
#define SWO_GPIO_Port GPIOB
|
||||
#define CODEC_I2S3ext_SD_Pin GPIO_PIN_4
|
||||
#define CODEC_I2S3ext_SD_GPIO_Port GPIOB
|
||||
#define CODEC_I2S3_SD_Pin GPIO_PIN_5
|
||||
#define CODEC_I2S3_SD_GPIO_Port GPIOB
|
||||
#define I2C1_SCL_Pin GPIO_PIN_6
|
||||
#define I2C1_SCL_GPIO_Port GPIOB
|
||||
#define I2C1_SDA_Pin GPIO_PIN_7
|
||||
#define I2C1_SDA_GPIO_Port GPIOB
|
||||
#define I2C2_SDA_Pin GPIO_PIN_9
|
||||
#define I2C2_SDA_GPIO_Port GPIOB
|
||||
#define LED1_Pin GPIO_PIN_0
|
||||
#define LED1_GPIO_Port GPIOE
|
||||
#define LED2_Pin GPIO_PIN_1
|
||||
#define LED2_GPIO_Port GPIOE
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* External functions --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ExternalFunctions */
|
||||
|
||||
/* USER CODE END ExternalFunctions */
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
{
|
||||
/* USER CODE BEGIN MspInit 0 */
|
||||
|
||||
/* USER CODE END MspInit 0 */
|
||||
|
||||
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
/* System interrupt init*/
|
||||
|
||||
/* USER CODE BEGIN MspInit 1 */
|
||||
|
||||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2C MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hi2c: I2C handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hi2c->Instance==I2C1)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_MspInit 0 */
|
||||
|
||||
/* USER CODE END I2C1_MspInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**I2C1 GPIO Configuration
|
||||
PB6 ------> I2C1_SCL
|
||||
PB7 ------> I2C1_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = I2C1_SCL_Pin|I2C1_SDA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||
/* USER CODE BEGIN I2C1_MspInit 1 */
|
||||
|
||||
/* USER CODE END I2C1_MspInit 1 */
|
||||
}
|
||||
else if(hi2c->Instance==I2C2)
|
||||
{
|
||||
/* USER CODE BEGIN I2C2_MspInit 0 */
|
||||
|
||||
/* USER CODE END I2C2_MspInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**I2C2 GPIO Configuration
|
||||
PB10 ------> I2C2_SCL
|
||||
PB9 ------> I2C2_SDA
|
||||
*/
|
||||
GPIO_InitStruct.Pin = I2C2_SCL_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C2;
|
||||
HAL_GPIO_Init(I2C2_SCL_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = I2C2_SDA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_I2C2;
|
||||
HAL_GPIO_Init(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 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2C MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hi2c: I2C handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
|
||||
{
|
||||
if(hi2c->Instance==I2C1)
|
||||
{
|
||||
/* USER CODE BEGIN I2C1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END I2C1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_I2C1_CLK_DISABLE();
|
||||
|
||||
/**I2C1 GPIO Configuration
|
||||
PB6 ------> I2C1_SCL
|
||||
PB7 ------> I2C1_SDA
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, I2C1_SCL_Pin|I2C1_SDA_Pin);
|
||||
|
||||
/* USER CODE BEGIN I2C1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END I2C1_MspDeInit 1 */
|
||||
}
|
||||
else if(hi2c->Instance==I2C2)
|
||||
{
|
||||
/* USER CODE BEGIN I2C2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END I2C2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_I2C2_CLK_DISABLE();
|
||||
|
||||
/**I2C2 GPIO Configuration
|
||||
PB10 ------> I2C2_SCL
|
||||
PB9 ------> I2C2_SDA
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, I2C2_SCL_Pin|I2C2_SDA_Pin);
|
||||
|
||||
/* USER CODE BEGIN I2C2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END I2C2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2S MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hi2s: I2S handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2S_MspInit(I2S_HandleTypeDef* hi2s)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hi2s->Instance==SPI3)
|
||||
{
|
||||
/* USER CODE BEGIN SPI3_MspInit 0 */
|
||||
|
||||
/* USER CODE END SPI3_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SPI3_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
/**I2S3 GPIO Configuration
|
||||
PA4 ------> I2S3_WS
|
||||
PB12 ------> I2S3_CK
|
||||
PC7 ------> I2S3_MCK
|
||||
PB4 ------> I2S3_ext_SD
|
||||
PB5 ------> I2S3_SD
|
||||
*/
|
||||
GPIO_InitStruct.Pin = CODEC_I2S3_WS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
|
||||
HAL_GPIO_Init(CODEC_I2S3_WS_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = CODEC_I2S3_SCK_Pin|CODEC_I2S3ext_SD_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_SPI3;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = CODEC_I2S3_MCK_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
|
||||
HAL_GPIO_Init(CODEC_I2S3_MCK_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = CODEC_I2S3_SD_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
|
||||
HAL_GPIO_Init(CODEC_I2S3_SD_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SPI3_MspInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2S MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hi2s: I2S handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2S_MspDeInit(I2S_HandleTypeDef* hi2s)
|
||||
{
|
||||
if(hi2s->Instance==SPI3)
|
||||
{
|
||||
/* USER CODE BEGIN SPI3_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SPI3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SPI3_CLK_DISABLE();
|
||||
|
||||
/**I2S3 GPIO Configuration
|
||||
PA4 ------> I2S3_WS
|
||||
PB12 ------> I2S3_CK
|
||||
PC7 ------> I2S3_MCK
|
||||
PB4 ------> I2S3_ext_SD
|
||||
PB5 ------> I2S3_SD
|
||||
*/
|
||||
HAL_GPIO_DeInit(CODEC_I2S3_WS_GPIO_Port, CODEC_I2S3_WS_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, CODEC_I2S3_SCK_Pin|CODEC_I2S3ext_SD_Pin|CODEC_I2S3_SD_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(CODEC_I2S3_MCK_GPIO_Port, CODEC_I2S3_MCK_Pin);
|
||||
|
||||
/* USER CODE BEGIN SPI3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QSPI MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hqspi: QSPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_QSPI_MspInit(QSPI_HandleTypeDef* hqspi)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hqspi->Instance==QUADSPI)
|
||||
{
|
||||
/* USER CODE BEGIN QUADSPI_MspInit 0 */
|
||||
|
||||
/* USER CODE END QUADSPI_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_QSPI_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
/**QUADSPI GPIO Configuration
|
||||
PF6 ------> QUADSPI_BK1_IO3
|
||||
PF7 ------> QUADSPI_BK1_IO2
|
||||
PF8 ------> QUADSPI_BK1_IO0
|
||||
PF9 ------> QUADSPI_BK1_IO1
|
||||
PB2 ------> QUADSPI_CLK
|
||||
PG6 ------> QUADSPI_BK1_NCS
|
||||
*/
|
||||
GPIO_InitStruct.Pin = QSPI_BK1_IO3_Pin|QSPI_BK1_IO2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_QSPI;
|
||||
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = QSPI_BK1_IO0_Pin|QSPI_BK1_IO1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
|
||||
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = QSPI_CLK_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_QSPI;
|
||||
HAL_GPIO_Init(QSPI_CLK_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = QSPI_BK1_NCS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
|
||||
HAL_GPIO_Init(QSPI_BK1_NCS_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN QUADSPI_MspInit 1 */
|
||||
|
||||
/* USER CODE END QUADSPI_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QSPI MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hqspi: QSPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* hqspi)
|
||||
{
|
||||
if(hqspi->Instance==QUADSPI)
|
||||
{
|
||||
/* USER CODE BEGIN QUADSPI_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END QUADSPI_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_QSPI_CLK_DISABLE();
|
||||
|
||||
/**QUADSPI GPIO Configuration
|
||||
PF6 ------> QUADSPI_BK1_IO3
|
||||
PF7 ------> QUADSPI_BK1_IO2
|
||||
PF8 ------> QUADSPI_BK1_IO0
|
||||
PF9 ------> QUADSPI_BK1_IO1
|
||||
PB2 ------> QUADSPI_CLK
|
||||
PG6 ------> QUADSPI_BK1_NCS
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOF, QSPI_BK1_IO3_Pin|QSPI_BK1_IO2_Pin|QSPI_BK1_IO0_Pin|QSPI_BK1_IO1_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(QSPI_CLK_GPIO_Port, QSPI_CLK_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(QSPI_BK1_NCS_GPIO_Port, QSPI_BK1_NCS_Pin);
|
||||
|
||||
/* USER CODE BEGIN QUADSPI_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END QUADSPI_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hsd->Instance==SDIO)
|
||||
{
|
||||
/* USER CODE BEGIN SDIO_MspInit 0 */
|
||||
|
||||
/* USER CODE END SDIO_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
/**SDIO GPIO Configuration
|
||||
PC8 ------> SDIO_D0
|
||||
PC9 ------> SDIO_D1
|
||||
PC10 ------> SDIO_D2
|
||||
PC11 ------> SDIO_D3
|
||||
PC12 ------> SDIO_CK
|
||||
PD2 ------> SDIO_CMD
|
||||
*/
|
||||
GPIO_InitStruct.Pin = uSD_D0_Pin|uSD_D1_Pin|uSD_D2_Pin|uSD_D3_Pin
|
||||
|uSD_CLK_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = uSD_CMD_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
HAL_GPIO_Init(uSD_CMD_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SDIO_MspInit 1 */
|
||||
|
||||
/* USER CODE END SDIO_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SD MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hsd: SD handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd)
|
||||
{
|
||||
if(hsd->Instance==SDIO)
|
||||
{
|
||||
/* USER CODE BEGIN SDIO_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SDIO_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SDIO_CLK_DISABLE();
|
||||
|
||||
/**SDIO GPIO Configuration
|
||||
PC8 ------> SDIO_D0
|
||||
PC9 ------> SDIO_D1
|
||||
PC10 ------> SDIO_D2
|
||||
PC11 ------> SDIO_D3
|
||||
PC12 ------> SDIO_CK
|
||||
PD2 ------> SDIO_CMD
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, uSD_D0_Pin|uSD_D1_Pin|uSD_D2_Pin|uSD_D3_Pin
|
||||
|uSD_CLK_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(uSD_CMD_GPIO_Port, uSD_CMD_Pin);
|
||||
|
||||
/* USER CODE BEGIN SDIO_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SDIO_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param huart: UART handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(huart->Instance==USART2)
|
||||
{
|
||||
/* USER CODE BEGIN USART2_MspInit 0 */
|
||||
|
||||
/* USER CODE END USART2_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USART2_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**USART2 GPIO Configuration
|
||||
PA2 ------> USART2_TX
|
||||
PA3 ------> USART2_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = STLINK_RX_Pin|STLINK_TX_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN USART2_MspInit 1 */
|
||||
|
||||
/* USER CODE END USART2_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param huart: UART handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||
{
|
||||
if(huart->Instance==USART2)
|
||||
{
|
||||
/* USER CODE BEGIN USART2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END USART2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_USART2_CLK_DISABLE();
|
||||
|
||||
/**USART2 GPIO Configuration
|
||||
PA2 ------> USART2_TX
|
||||
PA3 ------> USART2_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, STLINK_RX_Pin|STLINK_TX_Pin);
|
||||
|
||||
/* USER CODE BEGIN USART2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END USART2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static uint32_t FSMC_Initialized = 0;
|
||||
|
||||
static void HAL_FSMC_MspInit(void){
|
||||
/* USER CODE BEGIN FSMC_MspInit 0 */
|
||||
|
||||
/* USER CODE END FSMC_MspInit 0 */
|
||||
GPIO_InitTypeDef GPIO_InitStruct ={0};
|
||||
if (FSMC_Initialized) {
|
||||
return;
|
||||
}
|
||||
FSMC_Initialized = 1;
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_FSMC_CLK_ENABLE();
|
||||
|
||||
/** FSMC GPIO Configuration
|
||||
PF0 ------> FSMC_A0
|
||||
PE7 ------> FSMC_D4
|
||||
PE8 ------> FSMC_D5
|
||||
PE9 ------> FSMC_D6
|
||||
PE10 ------> FSMC_D7
|
||||
PE11 ------> FSMC_D8
|
||||
PE12 ------> FSMC_D9
|
||||
PE13 ------> FSMC_D10
|
||||
PE14 ------> FSMC_D11
|
||||
PE15 ------> FSMC_D12
|
||||
PD8 ------> FSMC_D13
|
||||
PD9 ------> FSMC_D14
|
||||
PD10 ------> FSMC_D15
|
||||
PD14 ------> FSMC_D0
|
||||
PD15 ------> FSMC_D1
|
||||
PD0 ------> FSMC_D2
|
||||
PD1 ------> FSMC_D3
|
||||
PD4 ------> FSMC_NOE
|
||||
PD5 ------> FSMC_NWE
|
||||
PD7 ------> FSMC_NE1
|
||||
*/
|
||||
GPIO_InitStruct.Pin = A0_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
|
||||
HAL_GPIO_Init(A0_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = D4_Pin|D5_Pin|D6_Pin|D7_Pin
|
||||
|D8_Pin|D9_Pin|D10_Pin|D11_Pin
|
||||
|D12_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = D13_Pin|D14_Pin|D15_Pin|D0_Pin
|
||||
|D1_Pin|D2_Pin|D3_Pin|FMC_NOE_Pin
|
||||
|FMC_NWE_Pin|FMC_NE1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN FSMC_MspInit 1 */
|
||||
|
||||
/* USER CODE END FSMC_MspInit 1 */
|
||||
}
|
||||
|
||||
void HAL_SRAM_MspInit(SRAM_HandleTypeDef* hsram){
|
||||
/* USER CODE BEGIN SRAM_MspInit 0 */
|
||||
|
||||
/* USER CODE END SRAM_MspInit 0 */
|
||||
HAL_FSMC_MspInit();
|
||||
/* USER CODE BEGIN SRAM_MspInit 1 */
|
||||
|
||||
/* USER CODE END SRAM_MspInit 1 */
|
||||
}
|
||||
|
||||
static uint32_t FSMC_DeInitialized = 0;
|
||||
|
||||
static void HAL_FSMC_MspDeInit(void){
|
||||
/* USER CODE BEGIN FSMC_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END FSMC_MspDeInit 0 */
|
||||
if (FSMC_DeInitialized) {
|
||||
return;
|
||||
}
|
||||
FSMC_DeInitialized = 1;
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_FSMC_CLK_DISABLE();
|
||||
|
||||
/** FSMC GPIO Configuration
|
||||
PF0 ------> FSMC_A0
|
||||
PE7 ------> FSMC_D4
|
||||
PE8 ------> FSMC_D5
|
||||
PE9 ------> FSMC_D6
|
||||
PE10 ------> FSMC_D7
|
||||
PE11 ------> FSMC_D8
|
||||
PE12 ------> FSMC_D9
|
||||
PE13 ------> FSMC_D10
|
||||
PE14 ------> FSMC_D11
|
||||
PE15 ------> FSMC_D12
|
||||
PD8 ------> FSMC_D13
|
||||
PD9 ------> FSMC_D14
|
||||
PD10 ------> FSMC_D15
|
||||
PD14 ------> FSMC_D0
|
||||
PD15 ------> FSMC_D1
|
||||
PD0 ------> FSMC_D2
|
||||
PD1 ------> FSMC_D3
|
||||
PD4 ------> FSMC_NOE
|
||||
PD5 ------> FSMC_NWE
|
||||
PD7 ------> FSMC_NE1
|
||||
*/
|
||||
HAL_GPIO_DeInit(A0_GPIO_Port, A0_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOE, D4_Pin|D5_Pin|D6_Pin|D7_Pin
|
||||
|D8_Pin|D9_Pin|D10_Pin|D11_Pin
|
||||
|D12_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, D13_Pin|D14_Pin|D15_Pin|D0_Pin
|
||||
|D1_Pin|D2_Pin|D3_Pin|FMC_NOE_Pin
|
||||
|FMC_NWE_Pin|FMC_NE1_Pin);
|
||||
|
||||
/* USER CODE BEGIN FSMC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END FSMC_MspDeInit 1 */
|
||||
}
|
||||
|
||||
void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram){
|
||||
/* USER CODE BEGIN SRAM_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SRAM_MspDeInit 0 */
|
||||
HAL_FSMC_MspDeInit();
|
||||
/* USER CODE BEGIN SRAM_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SRAM_MspDeInit 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
217
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_it.c
Normal file
217
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_it.c
Normal file
@ -0,0 +1,217 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "stm32f4xx_it.h"
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M4 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory management fault.
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pre-fetch fault, memory access fault.
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Undefined instruction or illegal state.
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 0 */
|
||||
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug monitor.
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 0 */
|
||||
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 1 */
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @brief This function handles System tick timer.
|
||||
// */
|
||||
// void SysTick_Handler(void)
|
||||
// {
|
||||
// /* USER CODE BEGIN SysTick_IRQn 0 */
|
||||
|
||||
// /* USER CODE END SysTick_IRQn 0 */
|
||||
// HAL_IncTick();
|
||||
// /* USER CODE BEGIN SysTick_IRQn 1 */
|
||||
|
||||
// /* USER CODE END SysTick_IRQn 1 */
|
||||
// }
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32F4xx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file (startup_stm32f4xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles USB On The Go FS global interrupt.
|
||||
*/
|
||||
// void OTG_FS_IRQHandler(void)
|
||||
// {
|
||||
// /* USER CODE BEGIN OTG_FS_IRQn 0 */
|
||||
|
||||
// /* USER CODE END OTG_FS_IRQn 0 */
|
||||
// HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
|
||||
// /* USER CODE BEGIN OTG_FS_IRQn 1 */
|
||||
|
||||
// /* USER CODE END OTG_FS_IRQn 1 */
|
||||
// }
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
70
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_it.h
Normal file
70
ports/stm32f4/boards/stm32f412g_disco/stm32f4xx_it.h
Normal file
@ -0,0 +1,70 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_IT_H
|
||||
#define __STM32F4xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
//void SysTick_Handler(void);
|
||||
//void OTG_FS_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F4xx_IT_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
@ -184,7 +184,7 @@
|
||||
#define LED2_Pin GPIO_PIN_1
|
||||
#define LED2_GPIO_Port GPIOE
|
||||
|
||||
//UART_HandleTypeDef huart2;
|
||||
UART_HandleTypeDef huart2;
|
||||
|
||||
/*
|
||||
#include "shared-module/gamepad/__init__.h"
|
||||
@ -230,6 +230,7 @@ safe_mode_t port_init(void) {
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 3;
|
||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
@ -238,6 +239,8 @@ safe_mode_t port_init(void) {
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
||||
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S_APB1|RCC_PERIPHCLK_SDIO
|
||||
|RCC_PERIPHCLK_CLK48;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SN = 50;
|
||||
@ -248,6 +251,8 @@ safe_mode_t port_init(void) {
|
||||
PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;
|
||||
PeriphClkInitStruct.PLLI2SSelection = RCC_PLLI2SCLKSOURCE_PLLSRC;
|
||||
PeriphClkInitStruct.I2sApb1ClockSelection = RCC_I2SAPB1CLKSOURCE_PLLI2S;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
|
||||
|
||||
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1);
|
||||
|
||||
//GPIO Init
|
||||
@ -282,14 +287,38 @@ safe_mode_t port_init(void) {
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(USB_OTGFS_PPWR_EN_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
//turn on LED
|
||||
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET);
|
||||
//Status LED chain
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_0, GPIO_PIN_RESET); //LED 1
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_SET); //LED 2
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET); //LED 3
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); //LED 4
|
||||
|
||||
//Status LED chain
|
||||
// HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
|
||||
// HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);
|
||||
// HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET);
|
||||
|
||||
tick_init();
|
||||
|
||||
//UART testing
|
||||
// huart2.Instance = USART2;
|
||||
// huart2.Init.BaudRate = 115200;
|
||||
// huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
// huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
// huart2.Init.Parity = UART_PARITY_NONE;
|
||||
// huart2.Init.Mode = UART_MODE_TX_RX;
|
||||
// huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
// huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
// if (HAL_UART_Init(&huart2) == HAL_OK)
|
||||
// {
|
||||
// HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
|
||||
// }
|
||||
|
||||
// HAL_UART_Transmit(&huart2, (uint8_t*)"helloworld", 10, 5000);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
|
||||
|
||||
board_init();
|
||||
|
||||
return NO_SAFE_MODE;
|
||||
@ -317,6 +346,6 @@ uint32_t port_get_saved_word(void) {
|
||||
return _ebss;
|
||||
}
|
||||
|
||||
void HardFault_Handler(void) {
|
||||
// void HardFault_Handler(void) {
|
||||
|
||||
}
|
||||
// }
|
||||
|
@ -25,68 +25,27 @@
|
||||
*/
|
||||
|
||||
#include "py/mphal.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "supervisor/serial.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
// #if (MICROPY_PY_BLE_NUS == 1)
|
||||
// #include "ble_uart.h"
|
||||
// #else
|
||||
// #include <string.h>
|
||||
// #include "nrf_gpio.h"
|
||||
// #include "nrfx_uarte.h"
|
||||
// #endif
|
||||
|
||||
#if (MICROPY_PY_BLE_NUS == 1)
|
||||
UART_HandleTypeDef huart2;
|
||||
|
||||
void serial_init(void) {
|
||||
//ble_uart_init();
|
||||
}
|
||||
|
||||
bool serial_connected(void) {
|
||||
// return ble_uart_connected();
|
||||
return false;
|
||||
}
|
||||
|
||||
char serial_read(void) {
|
||||
// return (char) ble_uart_rx_chr();
|
||||
}
|
||||
|
||||
bool serial_bytes_available(void) {
|
||||
// return ble_uart_stdin_any();
|
||||
return false;
|
||||
}
|
||||
|
||||
void serial_write(const char *text) {
|
||||
// ble_uart_stdout_tx_str(text);
|
||||
}
|
||||
|
||||
#elif !defined(NRF52840_XXAA)
|
||||
|
||||
// uint8_t serial_received_char;
|
||||
// nrfx_uarte_t serial_instance = NRFX_UARTE_INSTANCE(0);
|
||||
|
||||
void serial_init(void) {
|
||||
// nrfx_uarte_config_t config = {
|
||||
// .pseltxd = MICROPY_HW_UART_TX,
|
||||
// .pselrxd = MICROPY_HW_UART_RX,
|
||||
// .pselcts = NRF_UARTE_PSEL_DISCONNECTED,
|
||||
// .pselrts = NRF_UARTE_PSEL_DISCONNECTED,
|
||||
// .p_context = NULL,
|
||||
// .hwfc = NRF_UARTE_HWFC_DISABLED,
|
||||
// .parity = NRF_UARTE_PARITY_EXCLUDED,
|
||||
// .baudrate = NRF_UARTE_BAUDRATE_115200,
|
||||
// .interrupt_priority = 7
|
||||
// };
|
||||
|
||||
// nrfx_uarte_uninit(&serial_instance);
|
||||
// const nrfx_err_t err = nrfx_uarte_init(&serial_instance, &config, NULL); // no callback for blocking mode
|
||||
|
||||
// if (err != NRFX_SUCCESS) {
|
||||
// NRFX_ASSERT(err);
|
||||
// }
|
||||
|
||||
// // enabled receiving
|
||||
// nrf_uarte_task_trigger(serial_instance.p_reg, NRF_UARTE_TASK_STARTRX);
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = 115200;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
huart2.Init.Mode = UART_MODE_TX_RX;
|
||||
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
if (HAL_UART_Init(&huart2) == HAL_OK)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_RESET);
|
||||
}
|
||||
HAL_UART_Transmit(&huart2, (uint8_t*)"helloworld", 10, 5000);
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
bool serial_connected(void) {
|
||||
@ -94,38 +53,24 @@ bool serial_connected(void) {
|
||||
}
|
||||
|
||||
char serial_read(void) {
|
||||
// uint8_t data;
|
||||
// nrfx_uarte_rx(&serial_instance, &data, 1);
|
||||
// return data;
|
||||
return 0xFF;
|
||||
uint8_t data;
|
||||
HAL_UART_Receive(&huart2, &data, 1,5000);
|
||||
return data;
|
||||
}
|
||||
|
||||
bool serial_bytes_available(void) {
|
||||
// return nrf_uarte_event_check(serial_instance.p_reg, NRF_UARTE_EVENT_RXDRDY);
|
||||
return false;
|
||||
return __HAL_UART_GET_FLAG(&huart2, UART_FLAG_RXNE);
|
||||
|
||||
}
|
||||
|
||||
void serial_write(const char* text) {
|
||||
// serial_write_substring(text, strlen(text));
|
||||
serial_write_substring(text, strlen(text));
|
||||
}
|
||||
|
||||
void serial_write_substring(const char *text, uint32_t len) {
|
||||
// if (len == 0) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // EasyDMA can only access SRAM
|
||||
// uint8_t * tx_buf = (uint8_t*) text;
|
||||
// if ( !nrfx_is_in_ram(text) ) {
|
||||
// tx_buf = (uint8_t *) m_malloc(len, false);
|
||||
// memcpy(tx_buf, text, len);
|
||||
// }
|
||||
|
||||
// nrfx_uarte_tx(&serial_instance, tx_buf, len);
|
||||
|
||||
// if ( !nrfx_is_in_ram(text) ) {
|
||||
// m_free(tx_buf);
|
||||
// }
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
HAL_UART_Transmit(&huart2, (uint8_t*)text, len, 5000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user