• 大小: 5.21MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-09-17
  • 语言: 其他
  • 标签: STM32  low  power    

资源简介

STM32L0XX 低功耗程序源码,低功耗时,芯片功耗达到uA级别。

资源截图

代码片段和文件信息

/* Includes ------------------------------------------------------------------*/
#include “BSP_debug.h“
#include “string.h“
#include “stdio.h“
#include “main.h“

__IO uint8_t SYSTEM_DEBUG = 0;

#ifdef DEBUG_USE_RTT //=================================== use RTT

#pragma message(“//=========================== DEBUG use RTT“)
static char _acUpBuffer1  [BUFFER_SIZE_UP];
static char _acDownBuffer1[BUFFER_SIZE_DOWN];

void RTT_Init()
{
SEGGER_RTT_ConfigUpBuffer(1“Log“ &_acUpBuffer1[0]  BUFFER_SIZE_UP  SEGGER_RTT_MODE_NO_BLOCK_SKIP);
SEGGER_RTT_ConfigUpBuffer(1“Log“ &_acDownBuffer1[0]BUFFER_SIZE_DOWNSEGGER_RTT_MODE_NO_BLOCK_SKIP);
}




#else
#ifdef DEBUG_USE_SWO //=================================== use SWO
// SWO Initializing variables
#if defined(__STM32L0xx_HAL_H) || defined(__STM32F0xx_HAL_H)
#error “STM32L0 & STM32F0 SWO not supported“
#endif

#define ITM_Port8(n)    (*((volatile unsigned char *)(0xE0000000+4*n)))
#define ITM_Port16(n)   (*((volatile unsigned short*)(0xE0000000+4*n)))
#define ITM_Port32(n)   (*((volatile unsigned long *)(0xE0000000+4*n)))

#define DEMCR           (*((volatile unsigned long *)(0xE000EDFC)))
#define TRCENA          0x01000000

#if   defined ( __ICCARM__ ) /*!< IAR Compiler */

#elif defined(__ARMCC_VERSION)  /*!< MDK Compiler */
struct __FILE {
    int handle; /* Add whatever needed */
};
#endif
FILE __stdout;
FILE __stdin;
volatile int32_t ITM_RxBuffer=ITM_RXBUFFER_EMPTY;


#else //=================================== use UART
#include “usart.h“
#endif




//=========================== PutChar
#ifdef __GNUC__
/* With GCC/RAISONANCE small printf (option LD linker->Libraries->Small printf
set to ‘Yes‘) calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch FILE *f)
#endif
PUTCHAR_PROTOTYPE
{
#ifdef DEBUG_USE_SWO
#pragma message(“//=========================== DEBUG use SWO“)
    if (DEMCR & TRCENA) {
        while (ITM_Port32(0) == 0);
        ITM_Port8(0) = ch;
    }
#else
#if defined (__BSP_UART_H)
#pragma message(“//=========================== DEBUG use UART interrupt“)
    huart1.pTxBuffPtr[huart1.TxXferSize]=ch;
    huart1.TxXferSize++;
    if( huart1.TxXferSize >= USART_MAX_LEN ) huart1.TxXferSize=0;
    __HAL_UART_ENABLE_IT(&huart1 UART_IT_TXE);

#else
#pragma message(“//======================== DEBUG use UART poll“)
    while(__HAL_UART_GET_FLAG(&huart1 UART_FLAG_TC) == RESET);


//  Cortex-M3
#if defined (__STM32F1xx_HAL_H) || defined (__STM32L1xx_HAL_H)
    huart1.Instance->DR = (uint8_t)ch;
#endif

//  Cortex-M0
#if defined (__STM32F0xx_HAL_H) || defined (__STM32L0xx_HAL_H)
    huart1.Instance->TDR = (uint8_t)ch;
#endif


#endif
#endif
    return ch;
}



//=========================== PopChar
#ifdef __GNUC__
#define POPCHAR_PROTOTYPE int __io_getchar(int ch)
#else
#define POPCHAR_PROTOTYPE int fgetc(FILE *f)
#endif

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6143  2018-03-19 13:21  LP_STANDBY-EXT_1\.mxproject

     文件       3296  2018-05-08 12:00  LP_STANDBY-EXT_1\BSP\BSP_debug.c

     文件       2372  2018-05-08 11:49  LP_STANDBY-EXT_1\BSP\BSP_debug.h

     文件       6146  2018-08-22 13:02  LP_STANDBY-EXT_1\BSP\BSP_pwr.c

     文件       2432  2018-03-19 12:20  LP_STANDBY-EXT_1\BSP\BSP_pwr.h

     文件     629237  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Device\ST\STM32L0xx\Include\stm32l053xx.h

     文件       8341  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Device\ST\STM32L0xx\Include\stm32l0xx.h

     文件       3870  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Device\ST\STM32L0xx\Include\system_stm32l0xx.h

     文件       7265  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\arm_common_tables.h

     文件       3942  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\arm_const_structs.h

     文件     252339  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\arm_math.h

     文件      24423  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\cmsis_armcc.h

     文件      55083  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\cmsis_armcc_V6.h

     文件      41435  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\cmsis_gcc.h

     文件      37218  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cm0.h

     文件      44796  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cm0plus.h

     文件     103909  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cm3.h

     文件     114498  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cm4.h

     文件     139660  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cm7.h

     文件       3620  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cmFunc.h

     文件       3636  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cmInstr.h

     文件       3662  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_cmSimd.h

     文件      45262  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_sc000.h

     文件     102809  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\CMSIS\Include\core_sc300.h

     文件     181869  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h

     文件      13605  2018-05-08 10:45  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\stm32l0xx_hal.h

     文件      17163  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\stm32l0xx_hal_cortex.h

     文件       8448  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\stm32l0xx_hal_def.h

     文件      31734  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\stm32l0xx_hal_dma.h

     文件      14158  2018-01-22 16:18  LP_STANDBY-EXT_1\Drivers\STM32L0xx_HAL_Driver\Inc\stm32l0xx_hal_flash.h

............此处省略182个文件信息

评论

共有 条评论