bugfixx
This commit is contained in:
parent
5db75e3ae3
commit
1a89b523b3
8
sw7203.c
8
sw7203.c
|
@ -180,8 +180,8 @@ esp_err_t sw7203_driver_install(sw7203_config_t *sw7203_config, i2c_master_bus_h
|
|||
gpio_config_t sw7203_int_gpio_config = {
|
||||
.pin_bit_mask = 1ull << sw7203_INT_gpio_num,
|
||||
.mode = GPIO_MODE_INPUT,
|
||||
.pull_down_en = gpio_pulldown_dis,
|
||||
.pull_up_en = gpio_pullup_en,
|
||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||
.pull_up_en = GPIO_PULLUP_ENABLE,
|
||||
};
|
||||
gpio_config(&sw7203_int_gpio_config);
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ esp_err_t sw7203_driver_uninstall(i2c_master_bus_handle_t I2C_bus_handle)
|
|||
void SW7203IntCallBack()
|
||||
{
|
||||
uint8_t buffer;
|
||||
sw7203_reg_read(0x04, buffer);
|
||||
sw7203_reg_read(0x04, &buffer);
|
||||
if (buffer & 0x40)
|
||||
{
|
||||
ESP_LOGW(SW7203_TAG, "VSYS Over Voltage!");
|
||||
|
@ -471,7 +471,7 @@ void SW7203IntCallBack()
|
|||
}
|
||||
buffer = 0x7f;
|
||||
sw7203_reg_write(0x04, &buffer);
|
||||
sw7203_reg_read(0x05, buffer);
|
||||
sw7203_reg_read(0x05, &buffer);
|
||||
if (buffer & 0x80)
|
||||
{
|
||||
ESP_LOGW(SW7203_TAG, "Chip Over Temperature!");
|
||||
|
|
20
sw7203.h
20
sw7203.h
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "driver/i2c_master.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -10,6 +12,15 @@ typedef enum
|
|||
sw7203_port_A2
|
||||
} sw7203_I2C_port;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t VBUSVoltage_mV; // 放电 VBUS 输出电压设置 [3000,22000] 单位:毫伏(mV)
|
||||
uint16_t VBATVoltageLimit_mV; // 放电 VBAT 欠压设置 [2700,13200] 单位:毫伏(mV)
|
||||
uint16_t VBATVoltageLimitHysteresis_mV; // 放电 VBAT 欠压迟滞设置 [400,2000] 单位:毫伏(mV)
|
||||
uint16_t VBUSCurrentLimit_mA; // 放电 VBUS 输出限流设置 [500,6850] 单位:毫安(mA)
|
||||
uint16_t VBATCurrentLimit_mA; // 放电 VBAT 输出限流设置 [100,12000] 单位:毫安(mA)
|
||||
} sw7203_Vout_config_t;
|
||||
|
||||
typedef sw7203_Vout_config_t *(*SW7203OutputConfigCallBack_t)(sw7203_I2C_port);
|
||||
void SW7203IntCallBack();
|
||||
|
||||
|
@ -55,15 +66,6 @@ typedef enum
|
|||
sw7203_I2c_0x18 = 3
|
||||
} sw7203_I2C_address_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t VBUSVoltage_mV; // 放电 VBUS 输出电压设置 [3000,22000] 单位:毫伏(mV)
|
||||
uint16_t VBATVoltageLimit_mV; // 放电 VBAT 欠压设置 [2700,13200] 单位:毫伏(mV)
|
||||
uint16_t VBATVoltageLimitHysteresis_mV; // 放电 VBAT 欠压迟滞设置 [400,2000] 单位:毫伏(mV)
|
||||
uint16_t VBUSCurrentLimit_mA; // 放电 VBUS 输出限流设置 [500,6850] 单位:毫安(mA)
|
||||
uint16_t VBATCurrentLimit_mA; // 放电 VBAT 输出限流设置 [100,12000] 单位:毫安(mA)
|
||||
} sw7203_Vout_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user