SWO: Flush when _write completes, use even lower frequency.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
c470f137b5
commit
7ff480e16a
|
@ -53,20 +53,20 @@
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
void SystemClock_Config_MSI2MHz(void);
|
void SystemClock_Config_FreqDown(void);
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
/* Private user code ---------------------------------------------------------*/
|
/* Private user code ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
void SystemClock_Config_MSI2MHz(void) {
|
void SystemClock_Config_FreqDown(void) {
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
|
||||||
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
|
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
|
||||||
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
|
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_1;
|
||||||
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
|
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
|
||||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
|
|
|
@ -4,5 +4,13 @@ int _write(int file, char *ptr, int len) {
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
ITM_SendChar(ptr[i]);
|
ITM_SendChar(ptr[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ITM and port 0 is enabled*/
|
||||||
|
if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && ((ITM->TER & 1UL) != 0UL)) {
|
||||||
|
while (ITM->TCR & ITM_TCR_BUSY_Msk) {
|
||||||
|
/* Wait for ITM not busy (all data sent) */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@
|
||||||
#include "app_ranging_impl.h"
|
#include "app_ranging_impl.h"
|
||||||
#include "app_sensors_impl.h"
|
#include "app_sensors_impl.h"
|
||||||
|
|
||||||
extern void SystemClock_Config_MSI2MHz(void);
|
extern void SystemClock_Config_FreqDown(void);
|
||||||
extern void SystemClock_Config(void);
|
extern void SystemClock_Config(void);
|
||||||
|
|
||||||
static app_sensors_impl_t s_dht_impl = {
|
static app_sensors_impl_t s_dht_impl = {
|
||||||
|
@ -163,7 +163,7 @@ int main(void) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
HAL_SuspendTick();
|
HAL_SuspendTick();
|
||||||
|
|
||||||
SystemClock_Config_MSI2MHz();
|
SystemClock_Config_FreqDown();
|
||||||
|
|
||||||
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
|
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user