76 lines
1.4 KiB
C
76 lines
1.4 KiB
C
/********************************** (C) COPYRIGHT *******************************
|
|
* File Name : usb_pwr.h
|
|
* Author : WCH
|
|
* Version : V1.0.0
|
|
* Date : 2021/08/08
|
|
* Description : Connection/disconnection & power management header
|
|
*********************************************************************************
|
|
* 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 __USB_PWR_H
|
|
#define __USB_PWR_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
|
|
#include "ch32v20x.h"
|
|
|
|
#include "usb_lib.h"
|
|
|
|
|
|
|
|
typedef enum _RESUME_STATE
|
|
{
|
|
RESUME_EXTERNAL,
|
|
RESUME_INTERNAL,
|
|
RESUME_LATER,
|
|
RESUME_WAIT,
|
|
RESUME_START,
|
|
RESUME_ON,
|
|
RESUME_OFF,
|
|
RESUME_ESOF
|
|
} RESUME_STATE;
|
|
|
|
typedef enum _DEVICE_STATE
|
|
{
|
|
UNCONNECTED,
|
|
ATTACHED,
|
|
POWERED,
|
|
SUSPENDED,
|
|
ADDRESSED,
|
|
CONFIGURED
|
|
} DEVICE_STATE;
|
|
|
|
|
|
|
|
extern __IO uint32_t bDeviceState; /* USB device status */
|
|
extern __IO uint8_t fSuspendEnabled; /* true when suspend is possible */
|
|
|
|
|
|
|
|
void Suspend(void);
|
|
void Resume_Init(void);
|
|
void Resume(RESUME_STATE eResumeSetVal);
|
|
RESULT PowerOn(void);
|
|
RESULT PowerOff(void);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /*__USB_PWR_H*/
|
|
|
|
|
|
|
|
|
|
|
|
|