The code compiles again, and it seems to work as it did before. There's
still a lot to do (we still have a mess of globals), but the PE
correctly calls the new DPM functions via the list of callbacks in the
configuration object.
For now, the new <pdb.h> file only has a function to start the library,
based on the old start_pd function from main.c. It'll eventually be all
a user needs to include, but there's a lot more refactoring to do.
/!\ BROKEN BUILD /!\
This commit moves the library code to the library directory. This
causes the firmware to not compile. A few changes were made to reduce
the nubmer of errors, but some errors just aren't going to go away until
I go ahead with the planned changes.
Just as specified last night. This represents the completion of a big
part of the new interactive Power Delivery features of the shell.
Next up: printing the source's advertised PDOs.
The DPM used to always set the LED to indicate the PD status. This
caused fighting when the PD threads were run simultaneously with the
shell, making the LED show different things depending on what commands
the user ran. Not cool!
This commit adds a bool pdb_dpm_led_pd_status, which prevents the DPM
from setting the LED when set to false. This commit also sets it to
false before starting the PD threads in Setup mode, allowing the shell
to be in full control of the LED. Right on!
A good first step towards the upcoming 1.1 release, this commit runs the
Power Delivery threads in Setup mode. This required a slight change to
the shell to make it non-blocking, as otherwise the PD threads would
never get to run.
There's still a lot to do! The shell and the PD threads fight over
control of the LED in Setup mode. There's no way to make the PD threads
re-negotiate the required power. There's also no way to turn the output
on or off from the shell. None of these changes should be too major,
but together they'll be pretty cool when they're all done.
The README now outlines the features of the PD Buddy Firmware.
A bit of documentation was added to main.c, along with renaming the
pd_buddy() function to sink().
After a failed hard reset, we keep trying to negotiate power. Before,
the LED was on steady indicating negotiation failure during these
continued negotiations. Now it keeps blinking, indicating what's
actually going on.
The configuration interface is done, so we shouldn't have any comments
that say otherwise. Also, since the shell never exits, it's silly to
put the code that runs it in a loop.
The command shell is based on the ChibiOS-provided one, but modified to
not run in a new thread and generally be a bit simpler, while also
having PD Buddy branding. The storage functions work with the STM32
flash registers directly, taking over the last page of flash. A new
linker script is used to ensure that program code can't end up using
that page. The DPM has been updated to use the saved settings rather
than hardcoded ones. Now what's needed is real commands for editing the
configuration.
Added commands to edit configuration
We now have commands to load the current settings into RAM, edit the
settings in RAM, and write them back to flash. The only settings
currently supported are current and fixed voltage, because the rest of
the code doesn't support GiveBack or variable/battery PDOs yet.
Short help messages were added for each command. Nothing too exciting,
but it should be a great help for someone poking around in the PD Buddy
Sink configuration shell for the first time.
Wrote new usage information for the firmware
Now that we have a command shell, the README should indicate how to use
it.
There are still a few things that the standard says we Shall do and we
don't, but it Works For Me™. I haven't implemented anything with
regards to GiveBack support, but that doesn't matter just yet. Our
handling of VDMs isn't quite right either. Anyway, it successfully
negotiates with so-called Split PDO power supplies, which is more than I
can say about some commercial products.
Based on the RT-STM32F072-DISCOVERY demo from ChibiOS/demos/STM32. The
board definition was made with the Eclipse plugin, and is based on the
ST_STM32F072B_DISCOVERY board definition from ChibiOS/os/hal/boards.