GithubHelp home page GithubHelp logo

Comments (12)

kaythe avatar kaythe commented on June 25, 2024 2

PD micro code is designed to be small to fit into low cost embedded platform.

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.

from pd_micro.

kaythe avatar kaythe commented on June 25, 2024 1

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.

from pd_micro.

kaythe avatar kaythe commented on June 25, 2024 1

@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

from pd_micro.

danricho avatar danricho commented on June 25, 2024

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.

from pd_micro.

danricho avatar danricho commented on June 25, 2024

Awesome! Looking forward to seeing it!

from pd_micro.

danricho avatar danricho commented on June 25, 2024

@kaythe, do you think you could share a draft of your improvement? I haven't been able to do the same :(

from pd_micro.

kaythe avatar kaythe commented on June 25, 2024

@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.

from pd_micro.

danricho avatar danricho commented on June 25, 2024

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!

from pd_micro.

gyboy avatar gyboy commented on June 25, 2024

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.

from pd_micro.

ryan-ma avatar ryan-ma commented on June 25, 2024

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.

  • PD_Protocol events handler
  • FUSB302 events handler
  • timer handler
  • interrupt handler

I will work on porting it to Atmel SAMD51 with a new dev board with LCD this year

from pd_micro.

danricho avatar danricho commented on June 25, 2024

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.

from pd_micro.

Ueberspannung avatar Ueberspannung commented on June 25, 2024

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
{ // get_PDO_info current in mA, power in 0,01W
memset(power_info,0,sizeof(PD_power_info_t));
if (PD_protocol_get_power_info(&protocol,PDO,power_info))
{ // recalculate units
power_info->min_v*=50; // 50 mV units => [min_v]= 1 mV
power_info->max_v*=50; // 50 mV units => [max_v]= 1 mV
power_info->max_i*=10; // 10 mA units => [max_i]= 1 mA
power_info->max_p*=25; // 250 mW units => [max_p]=10 mW
return true;
} // recalculate units
else
return false;
} // get_PDO_info

from pd_micro.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.