Adiciona USART e scrolla
This commit is contained in:
parent
e804839f7d
commit
af1ad437ac
|
@ -5,10 +5,10 @@ SourcePath=C:/aids/gen/blinky/Src
|
||||||
SourceFiles=stm32f4xx_it.h;stm32f4xx_hal_conf.h;main.h;stm32f4xx_it.c;stm32f4xx_hal_msp.c;main.c;
|
SourceFiles=stm32f4xx_it.h;stm32f4xx_hal_conf.h;main.h;stm32f4xx_it.c;stm32f4xx_hal_msp.c;main.c;
|
||||||
|
|
||||||
[PreviousLibFiles]
|
[PreviousLibFiles]
|
||||||
LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;
|
LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;
|
||||||
|
|
||||||
[PreviousUsedSW4STM32Files]
|
[PreviousUsedSW4STM32Files]
|
||||||
SourceFiles=../Src/main.c;../Src/stm32f4xx_it.c;../Src/stm32f4xx_hal_msp.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s;
|
SourceFiles=../Src/main.c;../Src/stm32f4xx_it.c;../Src/stm32f4xx_hal_msp.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s;
|
||||||
HeaderPath=..\Drivers\STM32F4xx_HAL_Driver\Inc;..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F4xx\Include;..\Drivers\CMSIS\Include;
|
HeaderPath=..\Drivers\STM32F4xx_HAL_Driver\Inc;..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F4xx\Include;..\Drivers\CMSIS\Include;
|
||||||
CDefines=__weak=__attribute__((weak));__packed=__attribute__((__packed__));
|
CDefines=__weak=__attribute__((weak));__packed=__attribute__((__packed__));
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,6 @@ char ssd1306_WriteChar(char ch, FontDef Font, SSD1306_COLOR color);
|
||||||
char ssd1306_WriteString(char* str, FontDef Font, SSD1306_COLOR color);
|
char ssd1306_WriteString(char* str, FontDef Font, SSD1306_COLOR color);
|
||||||
void ssd1306_SetCursor(uint8_t x, uint8_t y);
|
void ssd1306_SetCursor(uint8_t x, uint8_t y);
|
||||||
|
|
||||||
//static void ssd1306_WriteCommand(uint8_t command);
|
void ssd1306_WriteCommand(uint8_t command);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,6 +54,7 @@ void SVC_Handler(void);
|
||||||
void DebugMon_Handler(void);
|
void DebugMon_Handler(void);
|
||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
|
void USART1_IRQHandler(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
61
Src/main.c
61
Src/main.c
|
@ -50,6 +50,10 @@ UART_HandleTypeDef huart1;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
char UART1_Data;
|
||||||
|
char UART_Buffer[32];
|
||||||
|
char text[32];
|
||||||
|
unsigned char i = 0;
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
@ -76,7 +80,6 @@ int main(void)
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
/* MCU Configuration----------------------------------------------------------*/
|
/* MCU Configuration----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
HAL_Init();
|
HAL_Init();
|
||||||
|
|
||||||
|
@ -90,47 +93,35 @@ int main(void)
|
||||||
|
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
ssd1306_Init();
|
ssd1306_Init();
|
||||||
HAL_Delay(1000);
|
|
||||||
//DHT22_Init();
|
//DHT22_Init();
|
||||||
|
HAL_UART_Receive_IT(&huart1, (uint8_t*) &UART1_Data, 1);
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
char *msg = "Hello Nucleo Fun!\n\r";
|
|
||||||
char output[50];
|
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
|
|
||||||
HAL_UART_Transmit(&huart1, (uint8_t*)msg, strlen(msg), 0xFFFF);
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6); //Toggle the state of pin PC9
|
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6); //Toggle the state of pin PC9
|
||||||
//HAL_Delay(100); //delay 100ms
|
|
||||||
//HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_7); //Toggle the state of pin PC9
|
//HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_7); //Toggle the state of pin PC9
|
||||||
//HAL_Delay(100); //delay 100ms
|
|
||||||
//DHT22_Read(htim6);
|
//DHT22_Read(htim6);
|
||||||
|
|
||||||
ssd1306_Fill(White);
|
ssd1306_SetCursor(0, 53);
|
||||||
|
ssd1306_WriteString(text, Font_7x10, White);
|
||||||
ssd1306_UpdateScreen();
|
ssd1306_UpdateScreen();
|
||||||
|
|
||||||
ssd1306_SetCursor(1,1);
|
for(int i = 0; i < 64; i++) {
|
||||||
//snprintf(output, 50, "Temp: %f", DHT22getTemperature());
|
ssd1306_WriteCommand(0x40 | i);
|
||||||
snprintf(output, 50, "Temp: 33");
|
ssd1306_UpdateScreen();
|
||||||
ssd1306_WriteString(output, Font_7x10, Black);
|
HAL_Delay(30);
|
||||||
|
}
|
||||||
|
|
||||||
ssd1306_SetCursor(1,40);
|
|
||||||
//snprintf(output, 50, "Humidity: %f", DHT22getHumidity());
|
|
||||||
snprintf(output, 50, "Humidity: 22");
|
|
||||||
ssd1306_WriteString(output, Font_7x10, Black);
|
|
||||||
|
|
||||||
ssd1306_UpdateScreen();
|
|
||||||
//HAL_Delay(250);
|
//HAL_Delay(250);
|
||||||
|
|
||||||
//ssd1306_Fill(Black);
|
ssd1306_Fill(Black);
|
||||||
//ssd1306_UpdateScreen();
|
ssd1306_UpdateScreen();
|
||||||
HAL_Delay(3000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
|
|
||||||
|
@ -255,7 +246,31 @@ static void MX_GPIO_Init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 4 */
|
/* USER CODE BEGIN 4 */
|
||||||
|
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
|
||||||
|
{
|
||||||
|
char n = 0;
|
||||||
|
char UART_Aux[32];
|
||||||
|
|
||||||
|
if (huart->Instance == USART1) {
|
||||||
|
if (UART1_Data != '\n') {
|
||||||
|
UART_Buffer[i] = UART1_Data;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
n = sprintf(UART_Aux, "%s\r\n", UART_Buffer);
|
||||||
|
|
||||||
|
HAL_UART_Transmit(&huart1, (uint8_t*) &UART_Aux, n, 1000);
|
||||||
|
|
||||||
|
|
||||||
|
// limpa o '\r'
|
||||||
|
UART_Buffer[i-1] = 0;
|
||||||
|
snprintf(text, 32, "%s", UART_Buffer);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
HAL_UART_Receive_IT(&huart1, (uint8_t*) &UART1_Data, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* USER CODE END 4 */
|
/* USER CODE END 4 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
#include"ssd1306.h"
|
#include"ssd1306.h"
|
||||||
|
|
||||||
|
|
||||||
// Databuffer voor het scherm
|
// Databuffer voor het scherm
|
||||||
static uint8_t SSD1306_Buffer[SSD1306_WIDTH * SSD1306_HEIGHT / 8];
|
static uint8_t SSD1306_Buffer[SSD1306_WIDTH * SSD1306_HEIGHT / 8];
|
||||||
|
|
||||||
|
@ -13,9 +11,9 @@ static SSD1306_t SSD1306;
|
||||||
// Een byte sturen naar het commando register
|
// Een byte sturen naar het commando register
|
||||||
// Kan niet gebruikt worden buiten deze file
|
// Kan niet gebruikt worden buiten deze file
|
||||||
//
|
//
|
||||||
static void ssd1306_WriteCommand(uint8_t command)
|
void ssd1306_WriteCommand(uint8_t command)
|
||||||
{
|
{
|
||||||
HAL_I2C_Mem_Write(&hi2c1,SSD1306_I2C_ADDR,0x00,1,&command,1,10);
|
HAL_I2C_Mem_Write(&hi2c1, SSD1306_I2C_ADDR, 0x00,1, &command, 1, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
|
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* Peripheral interrupt init */
|
||||||
|
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
/* USER CODE BEGIN USART1_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspInit 1 */
|
/* USER CODE END USART1_MspInit 1 */
|
||||||
|
@ -171,6 +174,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||||
*/
|
*/
|
||||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
|
||||||
|
|
||||||
|
/* Peripheral interrupt DeInit*/
|
||||||
|
HAL_NVIC_DisableIRQ(USART1_IRQn);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
|
extern UART_HandleTypeDef huart1;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Cortex-M4 Processor Interruption and Exception Handlers */
|
/* Cortex-M4 Processor Interruption and Exception Handlers */
|
||||||
|
@ -183,6 +184,20 @@ void SysTick_Handler(void)
|
||||||
/* please refer to the startup file (startup_stm32f4xx.s). */
|
/* please refer to the startup file (startup_stm32f4xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles USART1 global interrupt.
|
||||||
|
*/
|
||||||
|
void USART1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART1_IRQn 0 */
|
||||||
|
HAL_UART_IRQHandler(&huart1);
|
||||||
|
/* USER CODE BEGIN USART1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
|
35
blinky.ioc
35
blinky.ioc
|
@ -9,16 +9,18 @@ Mcu.IP0=I2C1
|
||||||
Mcu.IP1=NVIC
|
Mcu.IP1=NVIC
|
||||||
Mcu.IP2=RCC
|
Mcu.IP2=RCC
|
||||||
Mcu.IP3=SYS
|
Mcu.IP3=SYS
|
||||||
Mcu.IPNb=4
|
Mcu.IP4=USART1
|
||||||
|
Mcu.IPNb=5
|
||||||
Mcu.Name=STM32F407V(E-G)Tx
|
Mcu.Name=STM32F407V(E-G)Tx
|
||||||
Mcu.Package=LQFP100
|
Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PE3
|
Mcu.Pin0=PA6
|
||||||
Mcu.Pin1=PA6
|
Mcu.Pin1=PA7
|
||||||
Mcu.Pin2=PA7
|
Mcu.Pin2=PA9
|
||||||
Mcu.Pin3=PB6
|
Mcu.Pin3=PA10
|
||||||
Mcu.Pin4=PB7
|
Mcu.Pin4=PB6
|
||||||
Mcu.Pin5=VP_SYS_VS_Systick
|
Mcu.Pin5=PB7
|
||||||
Mcu.PinsNb=6
|
Mcu.Pin6=VP_SYS_VS_Systick
|
||||||
|
Mcu.PinsNb=7
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F407VETx
|
Mcu.UserName=STM32F407VETx
|
||||||
MxCube.Version=4.20.0
|
MxCube.Version=4.20.0
|
||||||
|
@ -32,13 +34,20 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true
|
||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true
|
||||||
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true
|
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true
|
||||||
|
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true
|
||||||
|
PA10.Mode=Asynchronous
|
||||||
|
PA10.Signal=USART1_RX
|
||||||
PA6.Locked=true
|
PA6.Locked=true
|
||||||
PA6.Signal=GPIO_Output
|
PA6.Signal=GPIO_Output
|
||||||
PA7.Locked=true
|
PA7.Locked=true
|
||||||
PA7.Signal=GPIO_Output
|
PA7.Signal=GPIO_Output
|
||||||
|
PA9.Mode=Asynchronous
|
||||||
|
PA9.Signal=USART1_TX
|
||||||
|
PB6.Locked=true
|
||||||
PB6.Mode=I2C
|
PB6.Mode=I2C
|
||||||
PB6.Signal=I2C1_SCL
|
PB6.Signal=I2C1_SCL
|
||||||
|
PB7.Locked=true
|
||||||
PB7.Mode=I2C
|
PB7.Mode=I2C
|
||||||
PB7.Signal=I2C1_SDA
|
PB7.Signal=I2C1_SDA
|
||||||
PCC.Checker=false
|
PCC.Checker=false
|
||||||
|
@ -50,10 +59,6 @@ PCC.Seq0=0
|
||||||
PCC.Series=STM32F4
|
PCC.Series=STM32F4
|
||||||
PCC.Temperature=25
|
PCC.Temperature=25
|
||||||
PCC.Vdd=3.3
|
PCC.Vdd=3.3
|
||||||
PE3.GPIOParameters=GPIO_PuPd
|
|
||||||
PE3.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PE3.Locked=true
|
|
||||||
PE3.Signal=GPIO_Input
|
|
||||||
ProjectManager.AskForMigrate=true
|
ProjectManager.AskForMigrate=true
|
||||||
ProjectManager.BackupPrevious=false
|
ProjectManager.BackupPrevious=false
|
||||||
ProjectManager.CompilerOptimize=2
|
ProjectManager.CompilerOptimize=2
|
||||||
|
@ -78,7 +83,7 @@ ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=SW4STM32
|
ProjectManager.TargetToolchain=SW4STM32
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=true
|
ProjectManager.UnderRoot=true
|
||||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-SystemClock_Config-RCC-false-HAL,3-MX_I2C1_Init-I2C1-false-HAL
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-SystemClock_Config-RCC-false-HAL,3-MX_I2C1_Init-I2C1-false-HAL,4-MX_USART1_UART_Init-USART1-false-HAL
|
||||||
RCC.AHBFreq_Value=16000000
|
RCC.AHBFreq_Value=16000000
|
||||||
RCC.APB1Freq_Value=16000000
|
RCC.APB1Freq_Value=16000000
|
||||||
RCC.APB2Freq_Value=16000000
|
RCC.APB2Freq_Value=16000000
|
||||||
|
@ -127,6 +132,10 @@ RCC.VCOI2SOutputFreq_Value=192000000
|
||||||
RCC.VCOInputFreq_Value=1000000
|
RCC.VCOInputFreq_Value=1000000
|
||||||
RCC.VCOOutputFreq_Value=192000000
|
RCC.VCOOutputFreq_Value=192000000
|
||||||
RCC.VcooutputI2S=96000000
|
RCC.VcooutputI2S=96000000
|
||||||
|
USART1.BaudRate=9600
|
||||||
|
USART1.HwFlowCtl-Asynchronous=UART_HWCONTROL_NONE
|
||||||
|
USART1.IPParameters=VirtualMode,HwFlowCtl-Asynchronous,BaudRate
|
||||||
|
USART1.VirtualMode=VM_ASYNC
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
board=blinky
|
board=blinky
|
||||||
|
|
Loading…
Reference in New Issue