generated from Embedded_Projects/Pudding_LWNode_Template
SWO: Flush when _write completes, use even lower frequency.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
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);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
void SystemClock_Config_MSI2MHz(void);
|
||||
void SystemClock_Config_FreqDown(void);
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
void SystemClock_Config_MSI2MHz(void) {
|
||||
void SystemClock_Config_FreqDown(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
|
||||
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
|
||||
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
|
||||
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_1;
|
||||
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
Error_Handler();
|
||||
|
|
|
@ -4,5 +4,13 @@ int _write(int file, char *ptr, int len) {
|
|||
for (int i = 0; i < len; 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;
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
#include "app_ranging_impl.h"
|
||||
#include "app_sensors_impl.h"
|
||||
|
||||
extern void SystemClock_Config_MSI2MHz(void);
|
||||
extern void SystemClock_Config_FreqDown(void);
|
||||
extern void SystemClock_Config(void);
|
||||
|
||||
static app_sensors_impl_t s_dht_impl = {
|
||||
|
@ -163,7 +163,7 @@ int main(void) {
|
|||
for (;;) {
|
||||
HAL_SuspendTick();
|
||||
|
||||
SystemClock_Config_MSI2MHz();
|
||||
SystemClock_Config_FreqDown();
|
||||
|
||||
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
|
||||
|
||||
|
|
Loading…
Reference in New Issue