Changeset - cc569dddb24e
[Not reviewed]
default
0 1 0
Ethan Zonca - 7 years ago 2019-09-01 21:01:53
ez@ethanzonca.com
Thinks kinda work if we clear the wakeup flags and enable debugging in STOP mode... power usage went up a lot with debug in stop though.
1 file changed with 7 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/main.c
Show inline comments
 
@@ -69,12 +69,16 @@ int main(void)
 
    // Transmit pilot tone to test TX on bootup
 
    HAL_Delay(1000);
 
    wspr_pilot_tone();
 
    adc_stop();
 
    HAL_Delay(1000);
 
 
    __DBGMCU_CLK_ENABLE() ; // (RCC->APB2ENR |= (RCC_APB2ENR_DBGMCUEN))
 
    HAL_EnableDBGStopMode();  //  SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
 
 
 
    while (1)
 
    {
 
    	// TODO: Disable GPIO port clocking when not needed!
 
 
    	// Every 10 minutes, wake up and try to wspr
 
    	if(state == SYSTEM_IDLE && (HAL_GetTick() - last_wspr_tx_time > 60000 * 10))
 
@@ -120,15 +124,17 @@ int main(void)
 
 
                // Actually sleep for real: disable systick and sleep until RTC interrupt
 
//                HAL_SuspendTick();
 
 
                // Enter sleep mode: wait for interrupt
 
                //HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
 
        		HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
 
 
                // We have woken up!
 
                // We have woken up! Clear wakeup flag
 
        		__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
 
 
                // This is hopefully the only timer that needs to stay alive in idle mode
 
 //               last_wspr_tx_time += 0; // move this timer forward based on sleep length
 
 
 //               HAL_ResumeTick();
 
0 comments (0 inline, 0 general)