Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ mctp-rs = { git = "https://github.com/dymk/mctp-rs" }
num_enum = { version = "0.7.5", default-features = false }
portable-atomic = { version = "1.11", default-features = false }
paste = "1.0.15"
power-policy-service = { path = "./power-policy-service" }
fixed = "1.23.1"
heapless = "0.8.*"
log = "0.4"
Expand Down
3 changes: 3 additions & 0 deletions battery-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ log = { workspace = true, optional = true }
zerocopy.workspace = true
mctp-rs = { workspace = true, features = ["espi"] }
heapless.workspace = true
power-policy-service.workspace = true

[features]
default = []
Expand All @@ -35,11 +36,13 @@ defmt = [
"embassy-sync/defmt",
"embedded-batteries-async/defmt",
"mctp-rs/defmt",
"power-policy-service/defmt",
]
log = [
"dep:log",
"embedded-services/log",
"embassy-time/log",
"embassy-sync/log",
"power-policy-service/log",
]
mock = []
4 changes: 3 additions & 1 deletion battery-service/src/acpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
use core::ops::Deref;

use embedded_batteries_async::acpi::{PowerSourceState, PowerUnit};
use embedded_services::{info, power::policy::PowerCapability, trace};
use embedded_services::{info, trace};

use battery_service_messages::{
AcpiBatteryResponse, BixFixedStrings, DeviceId, PifFixedStrings, STD_BIX_BATTERY_SIZE, STD_BIX_MODEL_SIZE,
STD_BIX_OEM_SIZE, STD_BIX_SERIAL_SIZE, STD_PIF_MODEL_SIZE, STD_PIF_OEM_SIZE, STD_PIF_SERIAL_SIZE,
};

use power_policy_service::capability::PowerCapability;

use crate::{
AcpiBatteryError,
context::PsuState,
Expand Down
14 changes: 7 additions & 7 deletions battery-service/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use embassy_sync::mutex::Mutex;
use embassy_sync::signal::Signal;
use embassy_time::{Duration, with_timeout};
use embedded_services::GlobalRawMutex;
use embedded_services::comms::MailboxDelegateError;
use embedded_services::power::policy::PowerCapability;
use embedded_services::{IntrusiveList, debug, error, info, intrusive_list, trace, warn};
use power_policy_service::capability::PowerCapability;

use core::ops::DerefMut;
use core::sync::atomic::AtomicUsize;
Expand Down Expand Up @@ -528,9 +527,10 @@ impl Context {
*self.power_info.lock().await
}

pub(crate) fn set_power_info(
// TODO: bring back when power policy messaging is working again
/*pub(crate) fn set_power_info(
&self,
power_info: &embedded_services::power::policy::CommsData,
power_info: &power_policy_service::service::event::CommsData,
) -> Result<(), MailboxDelegateError> {
let mut guard = self
.power_info
Expand All @@ -540,13 +540,13 @@ impl Context {
let psu_state = guard.deref_mut();

match power_info {
embedded_services::power::policy::CommsData::ConsumerDisconnected(_) => {
power_policy_service::service::event::CommsData::ConsumerDisconnected(_) => {
*psu_state = PsuState {
psu_connected: false,
power_capability: None,
}
}
embedded_services::power::policy::CommsData::ConsumerConnected(_device_id, power_capability) => {
power_policy_service::service::event::CommsData::ConsumerConnected(_device_id, power_capability) => {
*psu_state = PsuState {
psu_connected: true,
power_capability: Some(power_capability.capability),
Expand All @@ -557,7 +557,7 @@ impl Context {

trace!("Battery: PSU state: {:?}", psu_state);
Ok(())
}
}*/
}

impl Default for Context {
Expand Down
7 changes: 5 additions & 2 deletions battery-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ impl comms::MailboxDelegate for Service {
})?
} else if let Some(battery_request) = message.data.get::<AcpiBatteryRequest>() {
self.context.send_acpi_cmd(*battery_request);
} else if let Some(power_policy_msg) = message.data.get::<embedded_services::power::policy::CommsMessage>() {
self.context.set_power_info(&power_policy_msg.data)?;
}
// TODO: address in refactor
/*else if let Some(power_policy_msg) = message.data.get::<power_policy_service::service::event::Event>()
{
self.context.set_power_info(&power_policy_msg.data)?;
}*/

Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion embedded-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ document-features.workspace = true
embassy-sync.workspace = true
embassy-time.workspace = true
embassy-futures.workspace = true
embedded-batteries-async.workspace = true
embedded-cfu-protocol.workspace = true
embedded-hal-async.workspace = true
embedded-io-async.workspace = true
Expand Down
43 changes: 0 additions & 43 deletions embedded-service/src/event.rs

This file was deleted.

4 changes: 0 additions & 4 deletions embedded-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ pub mod activity;
pub mod broadcaster;
pub mod buffer;
pub mod comms;
pub mod event;
pub mod fmt;
pub mod hid;
pub mod init;
pub mod ipc;
pub mod keyboard;
pub mod power;
pub mod relay;
pub mod sync;
pub mod type_c;

/// Hidden re-exports used by macros defined in this crate.
/// Not part of the public API — do not depend on these directly.
Expand Down Expand Up @@ -85,5 +82,4 @@ pub async fn init() {
comms::init();
activity::init();
keyboard::init();
power::policy::init();
}
3 changes: 0 additions & 3 deletions embedded-service/src/power/mod.rs

This file was deleted.

Loading