Skip to content

Commit c149d44

Browse files
committed
led tuning
experimental command - will not ship with this Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 510b712 commit c149d44

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

framework_lib/src/chromium_ec/command.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

114115
pub trait EcRequest<R> {

framework_lib/src/chromium_ec/commands.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

framework_lib/src/commandline/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ use crate::chromium_ec::commands::FpLedBrightnessLevel;
4141
use crate::chromium_ec::commands::RebootEcCmd;
4242
use crate::chromium_ec::commands::RgbS;
4343
use 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::*;
4447
use crate::chromium_ec::EcResponseStatus;
4548
use crate::chromium_ec::{print_err, EcFlashType};
4649
use 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);

0 commit comments

Comments
 (0)