-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stm32][nano] stm32l475-pandora support nano version
- Loading branch information
1 parent
2cee9ff
commit a43ffcd
Showing
11 changed files
with
142 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,4 +243,4 @@ void SystemClock_ReConfig(uint8_t mode) | |
// SystemClock_MSI_OFF(); | ||
} | ||
|
||
#endif | ||
#endif /* RT_USING_PM */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2006-2021, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2023-11-30 Meco Man First version | ||
*/ | ||
|
||
#include <board.h> | ||
|
||
UART_HandleTypeDef huart1; | ||
|
||
void rt_hw_console_init(void) | ||
{ | ||
huart1.Instance = USART1; | ||
huart1.Init.BaudRate = 115200; | ||
huart1.Init.WordLength = UART_WORDLENGTH_8B; | ||
huart1.Init.StopBits = UART_STOPBITS_1; | ||
huart1.Init.Parity = UART_PARITY_NONE; | ||
huart1.Init.Mode = UART_MODE_TX_RX; | ||
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; | ||
huart1.Init.OverSampling = UART_OVERSAMPLING_16; | ||
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; | ||
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; | ||
if (HAL_UART_Init(&huart1) != HAL_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
} | ||
|
||
void rt_hw_console_output(const char *str) | ||
{ | ||
rt_size_t i = 0, size = 0; | ||
char a = '\r'; | ||
|
||
__HAL_UNLOCK(&huart1); | ||
|
||
size = rt_strlen(str); | ||
for (i = 0; i < size; i++) | ||
{ | ||
if (*(str + i) == '\n') | ||
{ | ||
HAL_UART_Transmit(&huart1, (uint8_t *)&a, 1, 1); | ||
} | ||
HAL_UART_Transmit(&huart1, (uint8_t *)(str + i), 1, 1); | ||
} | ||
} | ||
|
||
char rt_hw_console_getchar(void) | ||
{ | ||
int ch = -1; | ||
|
||
if (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_RXNE) != RESET) | ||
{ | ||
ch = huart1.Instance->RDR & 0xff; | ||
} | ||
else | ||
{ | ||
rt_thread_mdelay(10); | ||
} | ||
return ch; | ||
} |