Files
RCU_C1P_Module/Peripheral/inc/ch564_pwr.h
caocong d2d8800788 feat:新建项目文件
BLV主机C1P模块
2025-12-06 13:49:01 +08:00

68 lines
3.8 KiB
C

/********************************** (C) COPYRIGHT *******************************
* File Name : ch564_pwr.h
* Author : WCH
* Version : V1.0.0
* Date : 2024/05/05
* Description : This file contains all the functions prototypes for the
* PWR firmware library.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef __CH564_PWR_H
#define __CH564_PWR_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "ch564.h"
/* STOP_mode_entry */
#define PWR_STOPEntry_WFI ((uint8_t)0x01)
#define PWR_STOPEntry_WFE ((uint8_t)0x02)
#define WDOG_ENABLE() \
{ \
R8_SAFE_ACCESS_SIG = 0x57; \
R8_SAFE_ACCESS_SIG = 0xA8; \
R8_GLOB_RST_CFG |= (0x40 | RB_GLOB_WDOG_EN); \
R8_SAFE_ACCESS_SIG = 0x00; \
}
#define WDOG_DISABLE() \
{ \
R8_SAFE_ACCESS_SIG = 0x57; \
R8_SAFE_ACCESS_SIG = 0xA8; \
R8_GLOB_RST_CFG = 0x40; \
R8_SAFE_ACCESS_SIG = 0x00; \
}
#define FEED_DOG() (R8_WDOG_CLEAR = 0)
#define VIO_PWN_INT_CMD(cmd) \
{ \
cmd == ENABLE ? (R32_EXTEN_CTLR1 |= RB_VIO_PWN_INT_EN) : (R32_EXTEN_CTLR1 &= ~RB_VIO_PWN_INT_EN); \
}
#define VIO_PWN_RST_CMD(cmd) \
{ \
cmd == ENABLE ? (R32_EXTEN_CTLR1 |= RB_VIO_PWN_RST_EN) : (R32_EXTEN_CTLR1 &= ~RB_VIO_PWN_RST_EN); \
}
#define VIO_PWN_IO_CMD(cmd) \
{ \
cmd == ENABLE ? (R32_EXTEN_CTLR1 |= RB_VIO_PWN_IO_EN) : (R32_EXTEN_CTLR1 &= ~RB_VIO_PWN_IO_EN); \
}
#define LDO_DORMENCY_EN(cmd) \
{ \
cmd == ENABLE ? (R32_EXTEN_CTLR1 |= RB_LDO_SLP_EN) : (R32_EXTEN_CTLR1 &= ~RB_LDO_SLP_EN); \
}
void PWR_Sleep(uint8_t PWR_STOPEntry);
void PWR_DeepSleep(uint8_t PWR_STOPEntry);
#ifdef __cplusplus
}
#endif
#endif