Make a test with stop mode: STOP2
This commit is contained in:
@ -178,6 +178,36 @@ int main(void)
|
||||
HAL_Delay(10000);
|
||||
#endif
|
||||
|
||||
HAL_Delay(10000);
|
||||
while (1) {
|
||||
|
||||
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(100);
|
||||
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
|
||||
|
||||
#if 0
|
||||
{
|
||||
/* for STANDBY MODE only:
|
||||
*
|
||||
*/
|
||||
/* clear the WU flag */
|
||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
|
||||
|
||||
/* clear the RTC Wake Up (WU) flag */
|
||||
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
|
||||
}
|
||||
#endif
|
||||
HAL_SuspendTick();
|
||||
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x5000, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
|
||||
|
||||
// /* Enter STOP 2 mode */
|
||||
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
|
||||
//HAL_PWR_EnterSTANDBYMode();
|
||||
|
||||
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
|
||||
SystemClock_Config();
|
||||
HAL_ResumeTick();
|
||||
}
|
||||
|
||||
/* World Youth ARDF Championship Romania 2022 */
|
||||
/* 80 m . RF power 3 W, QRG MOE-MO5: 3550 MHz, MO: 3600 MHz, Antenna 8m
|
||||
@ -200,11 +230,8 @@ int main(void)
|
||||
si5351_enable_output(NULL,2);
|
||||
#endif
|
||||
|
||||
/*
|
||||
for (int i=2; i>=0; i--) {
|
||||
si5351_deinit(instance_si5351[i]);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Init scheduler */
|
||||
@ -257,6 +284,9 @@ int main(void)
|
||||
/* We should never get here as control is now taken by the scheduler */
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
||||
@ -790,19 +820,26 @@ void StartDefaultTask(void *argument)
|
||||
(void) argument; //unused argument
|
||||
|
||||
int sw, sw_last = GPIO_PIN_RESET;
|
||||
|
||||
int counter = 10;
|
||||
|
||||
/* Infinite loop */
|
||||
for(;;) {
|
||||
// HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
|
||||
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_SET);
|
||||
osDelay(5);
|
||||
osDelay(100);
|
||||
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET);
|
||||
sw = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
|
||||
if (sw_last == GPIO_PIN_RESET && sw == GPIO_PIN_SET) {
|
||||
leds_on = !leds_on;
|
||||
counter--;
|
||||
}
|
||||
sw_last = sw;
|
||||
osDelay(2000);
|
||||
if (!counter)
|
||||
break;
|
||||
}
|
||||
|
||||
/* USER CODE END 5 */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user