Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何关闭SW3518S的BUCK输出 #10

Open
sTego-A opened this issue Sep 13, 2023 · 2 comments
Open

如何关闭SW3518S的BUCK输出 #10

sTego-A opened this issue Sep 13, 2023 · 2 comments

Comments

@sTego-A
Copy link

sTego-A commented Sep 13, 2023

你好,非常感谢大佬开源的库!
有个问题向你请教,我使用你的库通过ESP32读写SW3518S制作了一个模型电池转手机快充的模块,当电池放电到设定电压时需要关闭模块的输出,以保护电池不至于过放,但是我通过修改你的库,在0x16寄存器写入0x01后,输出只有短暂的关闭后又会重新开启,时间可能还不到1秒,如果不断的执行上述关闭BUCK的操作,输出就会循环关闭、开启。我想实现的是关闭所有输出,包括5V,想问大佬有办法吗?
#define SW35XX_PWR_ENABLE 0x15 //BUCK 使能控制
#define SW35XX_PWR_CTRL 0x16 //BUCK 开关

void SW35xx::turnOff_BUCK(){
unlock_PWR_write();
i2cWriteReg8(SW35XX_PWR_CTRL, 0x01);
lock_PWR_write();
}

void SW35xx::turnOn_BUCK(){
unlock_PWR_write();
i2cWriteReg8(SW35XX_PWR_CTRL, 0x02);
lock_PWR_write();
}

void SW35xx::unlock_PWR_write() {
i2cWriteReg8(SW35XX_PWR_ENABLE, 0x20);
i2cWriteReg8(SW35XX_PWR_ENABLE, 0x40);
i2cWriteReg8(SW35XX_PWR_ENABLE, 0x80);
}

void SW35xx::lock_PWR_write() {
i2cWriteReg8(SW35XX_PWR_ENABLE, 0x00);
}

@happyme531
Copy link
Owner

就我所知SW3518似乎并没有公开的直接控制接口开关的寄存器. 也许你需要向厂家咨询.

@sTego-A
Copy link
Author

sTego-A commented Sep 14, 2023

好的,谢谢啦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants