⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_pwr.lst

📁 STM32利用正交编码器实现电机的控制
💻 LST
📖 第 1 页 / 共 2 页
字号:
    144          }
    145          
    146          /*******************************************************************************
    147          * Function Name  : PWR_WakeUpPinCmd
    148          * Description    : Enables or disables the WakeUp Pin functionality.
    149          * Input          : - NewState: new state of the WakeUp Pin functionality.
    150          *                    This parameter can be: ENABLE or DISABLE.
    151          * Output         : None
    152          * Return         : None
    153          *******************************************************************************/
    154          void PWR_WakeUpPinCmd(FunctionalState NewState)
    155          {
    156            /* Check the parameters */
    157            assert(IS_FUNCTIONAL_STATE(NewState));
    158          
    159            *(vu32 *) CSR_EWUP_BB = (u32)NewState;
    160          }
    161          
    162          /*******************************************************************************
    163          * Function Name  : PWR_EnterSTOPMode
    164          * Description    : Enters STOP mode.
    165          * Input          : - PWR_Regulator: specifies the regulator state in STOP mode.
    166          *                    This parameter can be one of the following values:
    167          *                       - PWR_Regulator_ON: STOP mode with regulator ON
    168          *                       - PWR_Regulator_LowPower: STOP mode with
    169          *                         regulator in low power mode
    170          *                  - PWR_STOPEntry: specifies if STOP mode in entered with WFI or 
    171          *                    WFE instruction.
    172          *                    This parameter can be one of the following values:
    173          *                       - PWR_STOPEntry_WFI: enter STOP mode with WFI instruction
    174          *                       - PWR_STOPEntry_WFE: enter STOP mode with WFE instruction
    175          * Output         : None
    176          * Return         : None
    177          *******************************************************************************/
    178          void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry)
    179          {
    180            u32 tmpreg = 0;
    181          
    182            /* Check the parameters */
    183            assert(IS_PWR_REGULATOR(PWR_Regulator));
    184            assert(IS_PWR_STOP_ENTRY(PWR_STOPEntry));
    185            
    186            /* Select the regulator state in STOP mode ---------------------------------*/
    187            tmpreg = PWR->CR;
    188          
    189            /* Clear PDDS and LPDS bits */
    190            tmpreg &= CR_DS_Mask;
    191          
    192            /* Set LPDS bit according to PWR_Regulator value */
    193            tmpreg |= PWR_Regulator;
    194          
    195            /* Store the new value */
    196            PWR->CR = tmpreg;
    197          
    198            /* Set SLEEPDEEP bit of Cortex System Control Register */
    199            *(vu32 *) SCB_SysCtrl |= SysCtrl_SLEEPDEEP_Set;
    200            
    201            /* Select STOP mode entry --------------------------------------------------*/
    202            if(PWR_STOPEntry == PWR_STOPEntry_WFI)
    203            {   
    204              /* Request Wait For Interrupt */
    205              __WFI();
    206            }
    207            else
    208            {
    209              /* Request Wait For Event */
    210              __WFE();
    211            }
    212          }
    213          
    214          /*******************************************************************************
    215          * Function Name  : PWR_EnterSTANDBYMode
    216          * Description    : Enters STANDBY mode.
    217          * Input          : None
    218          * Output         : None
    219          * Return         : None
    220          *******************************************************************************/
    221          void PWR_EnterSTANDBYMode(void)
    222          {
    223            /* Clear Wake-up flag */
    224            PWR->CR |= CR_CWUF_Set;
    225          
    226            /* Select STANDBY mode */
    227            PWR->CR |= CR_PDDS_Set;
    228          
    229            /* Set SLEEPDEEP bit of Cortex System Control Register */
    230            *(vu32 *) SCB_SysCtrl |= SysCtrl_SLEEPDEEP_Set;
    231          
    232            /* Request Wait For Interrupt */
    233            __WFI();
    234          }
    235          
    236          /*******************************************************************************
    237          * Function Name  : PWR_GetFlagStatus
    238          * Description    : Checks whether the specified PWR flag is set or not.
    239          * Input          : - PWR_FLAG: specifies the flag to check.
    240          *                    This parameter can be one of the following values:
    241          *                       - PWR_FLAG_WU: Wake Up flag
    242          *                       - PWR_FLAG_SB: StandBy flag
    243          *                       - PWR_FLAG_PVDO: PVD Output
    244          * Output         : None
    245          * Return         : The new state of PWR_FLAG (SET or RESET).
    246          *******************************************************************************/
    247          FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG)
    248          {
    249            FlagStatus bitstatus = RESET;
    250          
    251            /* Check the parameters */
    252            assert(IS_PWR_GET_FLAG(PWR_FLAG));
    253            
    254            if ((PWR->CSR & PWR_FLAG) != (u32)RESET)
    255            {
    256              bitstatus = SET;
    257            }
    258            else
    259            {
    260              bitstatus = RESET;
    261            }
    262          
    263            /* Return the flag status */
    264            return bitstatus;
    265          }
    266          
    267          /*******************************************************************************
    268          * Function Name  : PWR_ClearFlag
    269          * Description    : Clears the PWR's pending flags.
    270          * Input          : - PWR_FLAG: specifies the flag to clear.
    271          *                    This parameter can be one of the following values:
    272          *                       - PWR_FLAG_WU: Wake Up flag
    273          *                       - PWR_FLAG_SB: StandBy flag
    274          * Output         : None
    275          * Return         : None
    276          *******************************************************************************/
    277          void PWR_ClearFlag(u32 PWR_FLAG)
    278          {
    279            /* Check the parameters */
    280            assert(IS_PWR_CLEAR_FLAG(PWR_FLAG));
    281                   
    282            PWR->CR |=  PWR_FLAG << 2;
    283          }
    284          
    285          /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

   Maximum stack usage in bytes:

     Function             CSTACK
     --------             ------
     PWR_BackupAccessCmd      8
     PWR_ClearFlag            8
     PWR_DeInit               4
     PWR_EnterSTANDBYMode     4
     PWR_EnterSTOPMode       12
     PWR_GetFlagStatus        8
     PWR_PVDCmd               8
     PWR_PVDLevelConfig       8
     PWR_WakeUpPinCmd         8


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     PWR_DeInit                       24
     PWR_BackupAccessCmd              32
     PWR_PVDCmd                       32
     PWR_PVDLevelConfig               68
     PWR_WakeUpPinCmd                 32
     PWR_EnterSTOPMode                88
     PWR_EnterSTANDBYMode             52
     PWR_GetFlagStatus                46
     PWR_ClearFlag                    40
     ??DataTable17                     4
     ??DataTable20                     4
     ??DataTable22                     4
     ?<Constant "C:\\David JIANG\\ST MCU...">
                                      88
      Others                          32

 
 458 bytes in segment CODE
  88 bytes in segment DATA_C
 
 426 bytes of CODE  memory (+ 32 bytes shared)
  88 bytes of CONST memory

Errors: none
Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -