Skip to content
Merged
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
88 changes: 0 additions & 88 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cortex-m-rt = "0.7.5"
critical-section = "1.1"
defmt = "0.3"
document-features = "0.2.7"
embassy-executor = "0.9.1"
embassy-futures = "0.1.2"
embassy-imxrt = { git = "https://github.com/OpenDevicePartnership/embassy-imxrt" }
embassy-sync = "0.7.2"
Expand All @@ -69,7 +68,7 @@ postcard = "1.*"
proc-macro2 = "1.0"
quote = "1.0"
rand_core = "0.6.4"
rstest = {version = "0.26.1", default-features = false }
rstest = { version = "0.26.1", default-features = false }
serde = { version = "1.0.*", default-features = false }
static_cell = "2.1.0"
toml = { version = "0.8", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions battery-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ workspace = true

[dependencies]
defmt = { workspace = true, optional = true }
embassy-executor.workspace = true
embassy-futures.workspace = true
embassy-sync.workspace = true
embassy-time.workspace = true
Expand All @@ -31,7 +30,6 @@ defmt = [
"embedded-services/defmt",
"embassy-time/defmt",
"embassy-sync/defmt",
"embassy-executor/defmt",
"embedded-batteries-async/defmt",
"mctp-rs/defmt",
]
Expand All @@ -40,5 +38,4 @@ log = [
"embedded-services/log",
"embassy-time/log",
"embassy-sync/log",
"embassy-executor/log",
]
18 changes: 2 additions & 16 deletions battery-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ use embassy_futures::select::select;
use embedded_services::{
comms::{self, EndpointID},
ec_type::message::StdHostRequest,
error, info, trace,
trace,
};

mod acpi;
pub mod context;
pub mod controller;
pub mod device;
pub mod task;
pub mod wrapper;

/// Standard Battery Service.
Expand Down Expand Up @@ -134,18 +135,3 @@ pub async fn wait_for_battery_response() -> context::BatteryResponse {
pub async fn get_state() -> context::State {
SERVICE.context.get_state().await
}

/// Battery service task.
#[embassy_executor::task]
pub async fn task() {
info!("Starting battery-service task");

if comms::register_endpoint(&SERVICE, &SERVICE.endpoint).await.is_err() {
error!("Failed to register battery service endpoint");
return;
}

loop {
SERVICE.process_next().await;
}
}
17 changes: 17 additions & 0 deletions battery-service/src/task.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use embedded_services::{comms, error, info};

use crate::SERVICE;

/// Battery service task.
pub async fn task() {
info!("Starting battery-service task");

if comms::register_endpoint(&SERVICE, &SERVICE.endpoint).await.is_err() {
error!("Failed to register battery service endpoint");
return;
}

loop {
SERVICE.process_next().await;
}
}
3 changes: 0 additions & 3 deletions cfu-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ workspace = true

[dependencies]
defmt = { workspace = true, optional = true }
embassy-executor.workspace = true
embassy-futures.workspace = true
embassy-sync.workspace = true
embassy-time.workspace = true
Expand All @@ -25,14 +24,12 @@ defmt = [
"embedded-services/defmt",
"embassy-time/defmt",
"embassy-sync/defmt",
"embassy-executor/defmt",
"embedded-cfu-protocol/defmt",
]
log = [
"dep:log",
"embedded-services/log",
"embassy-time/log",
"embassy-sync/log",
"embassy-executor/log",
"embedded-cfu-protocol/log",
]
20 changes: 1 addition & 19 deletions cfu-service/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_std]

use embassy_sync::once_lock::OnceLock;
use embedded_cfu_protocol::client::CfuReceiveContent;
use embedded_cfu_protocol::components::CfuComponentTraits;
use embedded_cfu_protocol::protocol_definitions::*;
Expand All @@ -11,6 +10,7 @@ use embedded_services::{comms, error, info, trace};
pub mod buffer;
pub mod host;
pub mod splitter;
pub mod task;

pub struct CfuClient {
/// Cfu Client context
Expand Down Expand Up @@ -110,21 +110,3 @@ impl CfuClient {
}

impl comms::MailboxDelegate for CfuClient {}

#[embassy_executor::task]
pub async fn task() {
info!("Starting cfu client task");
static CLIENT: OnceLock<CfuClient> = OnceLock::new();
let cfuclient = CLIENT.get_or_init(|| CfuClient::create().expect("cfu client singleton already initialized"));

if comms::register_endpoint(cfuclient, &cfuclient.tp).await.is_err() {
error!("Failed to register cfu endpoint");
return;
}

loop {
if let Err(e) = cfuclient.process_request().await {
error!("Error processing request: {:?}", e);
}
}
}
21 changes: 21 additions & 0 deletions cfu-service/src/task.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use embassy_sync::once_lock::OnceLock;
use embedded_services::{comms, error, info};

use crate::CfuClient;

pub async fn task() {
info!("Starting cfu client task");
static CLIENT: OnceLock<CfuClient> = OnceLock::new();
let cfuclient = CLIENT.get_or_init(|| CfuClient::create().expect("cfu client singleton already initialized"));

if comms::register_endpoint(cfuclient, &cfuclient.tp).await.is_err() {
error!("Failed to register cfu endpoint");
return;
}

loop {
if let Err(e) = cfuclient.process_request().await {
error!("Error processing request: {:?}", e);
}
}
}
1 change: 0 additions & 1 deletion debug-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repository.workspace = true
bbq2 = "0.4.2"
critical-section.workspace = true
defmt.workspace = true
embassy-executor.workspace = true
embassy-sync.workspace = true
embassy-time.workspace = true
embedded-services.workspace = true
Expand Down
7 changes: 1 addition & 6 deletions debug-service/src/debug_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub async fn host_endpoint_id() -> EndpointID {
/// - Idempotent: repeated or concurrent calls return the same global instance.
/// - Panics if endpoint registration fails (e.g. duplicate registration).
///
/// The typical caller is the Embassy task [`debug_service`].
/// The typical caller is the task [`crate::task::debug_service`].
///
/// # Example
/// ```no_run
Expand All @@ -153,8 +153,3 @@ pub async fn debug_service_entry(endpoint: comms::Endpoint) {
// Emit an initial defmt frame so the defmt_to_host_task can drain and verify the path.
debug!("debug service initialized and endpoint registered");
}

#[embassy_executor::task]
pub async fn debug_service(endpoint: comms::Endpoint) {
debug_service_entry(endpoint).await;
}
Loading