File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ pub enum EcCommands {
109109 ProgramGpuEeprom = 0x3E1F ,
110110 /// Read board ID of specific ADC channel
111111 ReadBoardId = 0x3E26 ,
112+ LedPwmControl = 0x3E2B ,
112113}
113114
114115pub trait EcRequest < R > {
Original file line number Diff line number Diff line change @@ -1537,3 +1537,26 @@ impl EcRequest<EcResponseReadBoardId> for EcRequestReadBoardId {
15371537 EcCommands :: ReadBoardId
15381538 }
15391539}
1540+
1541+ #[ repr( C , packed) ]
1542+ pub struct EcRequestLedPwmControl {
1543+ /// 0: Charging LED, 1: Fingerprint LED
1544+ pub led_id : u8 ,
1545+ /// 0: LED_OFF
1546+ /// 1: LED_RED
1547+ /// 2: LED_GREEN
1548+ /// 3: LED_BLUE,
1549+ /// 4: LED_YELLOW
1550+ /// 5: LED_WHITE
1551+ /// 6: LED_AMBER
1552+ pub led_color : u8 ,
1553+ pub pwm_r : u8 ,
1554+ pub pwm_g : u8 ,
1555+ pub pwm_b : u8 ,
1556+ }
1557+
1558+ impl EcRequest < ( ) > for EcRequestLedPwmControl {
1559+ fn command_id ( ) -> EcCommands {
1560+ EcCommands :: LedPwmControl
1561+ }
1562+ }
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ use crate::chromium_ec::commands::FpLedBrightnessLevel;
4141use crate :: chromium_ec:: commands:: RebootEcCmd ;
4242use crate :: chromium_ec:: commands:: RgbS ;
4343use crate :: chromium_ec:: commands:: TabletModeOverride ;
44+ use crate :: chromium_ec:: commands:: EcRequestLedPwmControl ;
45+ use crate :: chromium_ec:: command:: EcRequestRaw ;
46+ use crate :: chromium_ec:: commands:: * ;
4447use crate :: chromium_ec:: EcResponseStatus ;
4548use crate :: chromium_ec:: { print_err, EcFlashType } ;
4649use crate :: chromium_ec:: { EcError , EcResult } ;
@@ -1556,6 +1559,23 @@ fn selftest(ec: &CrosEc) -> Option<()> {
15561559 let boardid = ec. read_board_id_hc ( BoardIdType :: DGpu1 ) ;
15571560 println ! ( "dGPU1 Board ID: {:?}" , boardid) ;
15581561
1562+ // Framework 13 defaults
1563+ // Amber <9 1 0>
1564+ // White <4 10 5>
1565+ // Red <8 0 0>
1566+ // Green <0 16 0>
1567+ // Blue <0 0 8>
1568+ EcRequestLedPwmControl {
1569+ // charging LED
1570+ led_id : 0 ,
1571+ // Amber
1572+ led_color : 6 ,
1573+ pwm_r : 9 ,
1574+ pwm_g : 1 ,
1575+ pwm_b : 0 ,
1576+ } . send_command ( ec) . unwrap ( ) ;
1577+
1578+
15591579 return Some ( ( ) ) ;
15601580 if let Some ( platform) = smbios:: get_platform ( ) {
15611581 println ! ( " SMBIOS Platform: {:?}" , platform) ;
You can’t perform that action at this time.
0 commit comments