2024-10-16 23:51:49 -07:00
|
|
|
/*
|
|
|
|
* port_pwr.h
|
|
|
|
*
|
|
|
|
* Created on: Oct 16, 2024
|
|
|
|
* Author: true
|
|
|
|
*/
|
|
|
|
|
2024-11-06 19:15:40 -08:00
|
|
|
#ifndef USER_PERIPH_PORT_PWR_H_
|
|
|
|
#define USER_PERIPH_PORT_PWR_H_
|
2024-10-16 23:51:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <ch32v20x.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GAT port enable pin
|
|
|
|
#define GAT_EN_PORT GPIOA
|
|
|
|
#define GAT_EN_PIN GPIO_Pin_3
|
|
|
|
|
|
|
|
// overcurrent detect pin, active low
|
|
|
|
#define GAT_OC_PORT GPIOA
|
|
|
|
#define GAT_OC_PIN GPIO_Pin_4
|
|
|
|
|
|
|
|
#define USB2_EN_PORT GPIOB
|
|
|
|
#define USB2_EN_PIN GPIO_Pin_4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void port_pwr_init();
|
|
|
|
|
|
|
|
uint8_t gat_oc_state();
|
|
|
|
|
|
|
|
void gat_on();
|
|
|
|
void gat_off();
|
|
|
|
void gat_toggle();
|
|
|
|
uint8_t gat_pwr_state();
|
|
|
|
|
|
|
|
void usb2_on();
|
|
|
|
void usb2_off();
|
|
|
|
void usb2_toggle();
|
|
|
|
uint8_t usb2_pwr_state();
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-06 19:15:40 -08:00
|
|
|
#endif /* USER_PERIPH_PORT_PWR_H_ */
|