-
Notifications
You must be signed in to change notification settings - Fork 69
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
Get list of possible voltages/current limits #2
Comments
This would be great as I don't know how we can toggle between available options without an external controller. I admit my C isn't great, but maybe a method to return an array of PD_power_info_t from the power source would be good. Would be good if it was accessible with or without logging on. |
I played around with it and added a method to get the information based on the way it already uses for the debug log. I'll make a pull request once I polished it up a bit. |
Awesome! Looking forward to seeing it! |
@kaythe, do you think you could share a draft of your improvement? I haven't been able to do the same :( |
I haven't had the time to work on it unfortunately, but I'll see if I can get you a rough version today |
@danricho it took a bit longer than expected but you should now be able to see it here: kaythe@a686b23 I want to add some error handling before I create a pull request though. |
Looks great so far. And even a display output added! I'm planning to do similar to create a "bench power supply" using either the voltage levels available or PPS if the source can do it. I will have a tinker when I have some time at my bench. Cheers! |
hey,guys,it looks like we all think same things,I have made one OLED current measure kit using INA219 and STM32 reffernced "USB Tester OLED Backpack" on github,recently I want to add the PD function so that this kit can generate any voltage and limit current while draw the scope of voltage, the PCB is done and I am debugging the software,but I have met problem with transmit the code to C while the oringinal code is C ,the software build passed while the target voltage don't change,I an still trying to find the problems. |
Hi, guys, sorry for this late reply. I did write some code on getting the list of possible voltage and current. But I haven't had time to try and verify so far. PD micro code is designed to be small to fit into low cost embedded platform. It should be easy to just edit the PD_UFP.cpp to fit your own needs. If you need to port to other platforms, just follow how PD_UFP.cpp does, and ensure these handlers are in your PD task.
I will work on porting it to Atmel SAMD51 with a new dev board with LCD this year |
Yeah that's why I made the method as short as possible. It's a bit annoying to use this way but it should take up a minimum amount of time and memory. I already had to split the display initialization up into several small parts so I could use it without blocking the PD loop ^^" If you could integrate a nicer method to access the possible voltages and currents that'd be great, otherwise my solution does everything Ineeded. |
I've had success with your method also @kaythe. My last step is to add listing PPS mode as a selectable mode aside from the set voltages available. I'm still yet to look how I will do that, how to test for it and to get the ranges available. |
There is a simple way of getting the available PDOs. Just initialize to 5V Fix provile. When done all PDOs ar stored in the protocol structure I'm ausing a wrappe class derived from PD_UFP_c bool PD_PPS_c::get_PDO_info(uint8_t PDO, PD_power_info_t * power_info) // gets advertised voltage in mV |
It could be very useful to get all the possible voltages and current limits the power supply supports. The debug output contains such a list, but a method to get this list would be far more useful.
The text was updated successfully, but these errors were encountered: