Phyduino Board Support
v0.1.1-rc.1
Physics
›
Electronic Support Services
›
Introduction to Electronics
›
Phyduino Board Support
›
API reference
Toggle main menu visibility
Loading...
Searching...
No Matches
stusb4500.h
Go to the documentation of this file.
1
26
#pragma once
27
28
#include <stdint.h>
29
30
namespace
stusb4500 {
31
34
38
struct
Profile
{
39
uint16_t
millivolts
;
40
uint16_t
milliamps
;
41
};
42
44
constexpr
uint8_t
kMaxProfiles
= 3;
45
50
bool
begin
();
51
58
bool
setProfiles
(
const
Profile
* profiles, uint8_t count);
59
65
uint8_t
getProfiles
(
Profile
* out);
66
77
uint8_t
boardProfiles
(uint16_t max_millivolts,
Profile
* out);
78
83
bool
renegotiate
();
84
90
uint8_t
contractPosition
();
91
96
uint16_t
contractMilliamps
();
97
102
uint32_t
vbusMillivolts
();
103
105
106
}
// namespace stusb4500
stusb4500::begin
bool begin()
Sets up I2C1 and the control pins.
stusb4500::renegotiate
bool renegotiate()
Asks the charger to negotiate again with the current profiles.
stusb4500::getProfiles
uint8_t getProfiles(Profile *out)
Reads the active profiles.
stusb4500::contractPosition
uint8_t contractPosition()
Which charger offer is in use.
stusb4500::contractMilliamps
uint16_t contractMilliamps()
Operating current agreed in the current contract.
stusb4500::kMaxProfiles
constexpr uint8_t kMaxProfiles
Number of profiles the chip holds.
Definition
stusb4500.h:44
stusb4500::boardProfiles
uint8_t boardProfiles(uint16_t max_millivolts, Profile *out)
The board's profiles for Tools > USB-PD Power.
stusb4500::setProfiles
bool setProfiles(const Profile *profiles, uint8_t count)
Loads 1-3 profiles and renegotiates if they differ from the current ones.
stusb4500::vbusMillivolts
uint32_t vbusMillivolts()
VBUS measured by the on-board ADC (MAX11635 channel 3).
stusb4500::Profile
One sink profile (PDO): a voltage the board accepts and the current it draws.
Definition
stusb4500.h:38
stusb4500::Profile::milliamps
uint16_t milliamps
0-5000, 10 mA steps
Definition
stusb4500.h:40
stusb4500::Profile::millivolts
uint16_t millivolts
5000-20000, 50 mV steps
Definition
stusb4500.h:39
platform
variants
phyduino_pico
stusb4500.h
Generated by
1.17.0