PD Buddy Sink Firmware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

device_policy_manager.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * PD Buddy - USB Power Delivery for everyone
  3. * Copyright (C) 2017 Clayton G. Hobbs <clay@lakeserv.net>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef PDB_DEVICE_POLICY_MANAGER_H
  19. #define PDB_DEVICE_POLICY_MANAGER_H
  20. #include <stdbool.h>
  21. #include "messages.h"
  22. /*
  23. * Create a Request message based on the given Source_Capabilities message.
  24. *
  25. * Returns false if sufficient power is not available, true if it is.
  26. */
  27. bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg *request);
  28. /*
  29. * Create a Sink_Capabilities message for our current capabilities.
  30. */
  31. void pdb_dpm_get_sink_capability(union pd_msg *cap);
  32. /*
  33. * Indicate that power negotiations are starting.
  34. */
  35. void pdb_dpm_pd_start(void);
  36. /*
  37. * Turn on the power output, with LED indication.
  38. */
  39. void pdb_dpm_output_on(void);
  40. /*
  41. * Turn off the power output, with LED indication.
  42. */
  43. void pdb_dpm_output_off(void);
  44. #endif /* PDB_DEVICE_POLICY_MANAGER_H */