MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / i2c_address

Method i2c_address

framework_lib/src/ccgx/device.rs:53–106  ·  view source on GitHub ↗

SMBUS/I2C Address

(&self)

Source from the content-addressed store, hash-verified

51impl PdPort {
52 /// SMBUS/I2C Address
53 fn i2c_address(&self) -> EcResult<u16> {
54 let config = Config::get();
55 let platform = &(*config).as_ref().unwrap().platform;
56 let unsupported = Err(EcError::DeviceError(
57 "Controller does not exist on this platform".to_string(),
58 ));
59
60 Ok(match (platform, self) {
61 (Platform::GenericFramework((left, _, _), _), PdPort::Right01) => *left,
62 (Platform::GenericFramework((_, right, _), _), PdPort::Left23) => *right,
63 (Platform::GenericFramework((_, _, back), _), PdPort::Back) => *back,
64 // Framework AMD Platforms (CCG8)
65 (
66 Platform::Framework13Amd7080
67 | Platform::Framework13AmdAi300
68 | Platform::Framework16Amd7080
69 | Platform::IntelCoreUltra3
70 | Platform::Framework16AmdAi300,
71 PdPort::Right01,
72 ) => 0x42,
73 (
74 Platform::Framework13Amd7080
75 | Platform::Framework13AmdAi300
76 | Platform::Framework16Amd7080
77 | Platform::Framework16AmdAi300,
78 PdPort::Left23,
79 ) => 0x40,
80 (Platform::Framework16Amd7080 | Platform::Framework16AmdAi300, PdPort::Back) => 0x42,
81 (Platform::FrameworkDesktopAmdAiMax300, PdPort::Back) => 0x08,
82 (Platform::FrameworkDesktopAmdAiMax300, _) => unsupported?,
83 // Framework Intel Platforms (CCG5 and CCG6)
84 (
85 Platform::Framework12IntelGen13
86 | Platform::IntelGen11
87 | Platform::IntelGen12
88 | Platform::IntelGen13
89 | Platform::IntelCoreUltra1,
90 PdPort::Right01,
91 ) => 0x08,
92 (
93 Platform::Framework12IntelGen13
94 | Platform::IntelGen11
95 | Platform::IntelGen12
96 | Platform::IntelGen13
97 | Platform::IntelCoreUltra3
98 | Platform::IntelCoreUltra1,
99 PdPort::Left23,
100 ) => 0x40,
101 (Platform::UnknownSystem, _) => {
102 Err(EcError::DeviceError("Unsupported platform".to_string()))?
103 }
104 (_, PdPort::Back) => unsupported?,
105 })
106 }
107
108 /// I2C port on the EC
109 fn i2c_port(&self) -> EcResult<u8> {

Callers 2

i2c_readMethod · 0.80
i2c_writeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected