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
17 changes: 16 additions & 1 deletion Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ members = [
"keyboard-service",
"power-policy-interface",
"odp-service-common",
"type-c-interface",
]
exclude = ["examples/*"]

Expand Down Expand Up @@ -105,6 +106,7 @@ static_cell = "2.1.0"
toml = { version = "0.8", default-features = false }
thermal-service-messages = { path = "./thermal-service-messages" }
time-alarm-service-messages = { path = "./time-alarm-service-messages" }
type-c-interface = { path = "./type-c-interface" }
syn = "2.0"
tps6699x = { git = "https://github.com/OpenDevicePartnership/tps6699x" }
tokio = { version = "1.42.0" }
Expand Down
17 changes: 16 additions & 1 deletion examples/rt685s-evk/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 examples/rt685s-evk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ embedded-usb-pd = { git = "https://github.com/OpenDevicePartnership/embedded-usb
"defmt",
] }
type-c-service = { path = "../../type-c-service", features = ["defmt"] }
type-c-interface = { path = "../../type-c-interface", features = ["defmt"] }
time-alarm-service = { path = "../../time-alarm-service", features = ["defmt"] }
time-alarm-service-messages = { path = "../../time-alarm-service-messages", features = [
"defmt",
Expand Down
39 changes: 4 additions & 35 deletions examples/rt685s-evk/src/bin/type_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ use embassy_sync::once_lock::OnceLock;
use embassy_sync::pubsub::PubSubChannel;
use embassy_time::{self as _, Delay};
use embedded_cfu_protocol::protocol_definitions::{FwUpdateOffer, FwUpdateOfferResponse, FwVersion, HostToken};
use embedded_services::GlobalRawMutex;
use embedded_services::event::NoopSender;
use embedded_services::{GlobalRawMutex, IntrusiveList};
use embedded_services::{error, info};
use embedded_usb_pd::GlobalPortId;
use power_policy_interface::psu;
use power_policy_service::psu::ArrayEventReceivers;
use power_policy_service::service::registration::ArrayRegistration;
use static_cell::StaticCell;
use tps6699x::asynchronous::embassy as tps6699x;
use type_c_interface::port::ControllerId;
use type_c_service::driver::tps6699x::{self as tps6699x_drv};
use type_c_service::service::Service;
use type_c_service::type_c::{Cached, ControllerId};
use type_c_service::wrapper::ControllerWrapper;
use type_c_service::wrapper::backing::{IntermediateStorage, ReferencedStorage, Storage};
use type_c_service::wrapper::proxy::PowerProxyDevice;
Expand Down Expand Up @@ -143,11 +143,8 @@ async fn main(spawner: Spawner) {
.await
.unwrap();

static CONTROLLER_CONTEXT: StaticCell<type_c_service::type_c::controller::Context> = StaticCell::new();
let controller_context = CONTROLLER_CONTEXT.init(type_c_service::type_c::controller::Context::new());

static CONTROLLER_LIST: StaticCell<IntrusiveList> = StaticCell::new();
let controller_list = CONTROLLER_LIST.init(IntrusiveList::new());
static CONTROLLER_CONTEXT: StaticCell<type_c_interface::service::context::Context> = StaticCell::new();
let controller_context = CONTROLLER_CONTEXT.init(type_c_interface::service::context::Context::new());

static STORAGE: StaticCell<Storage<TPS66994_NUM_PORTS, GlobalRawMutex>> = StaticCell::new();
let storage = STORAGE.init(Storage::new(
Expand Down Expand Up @@ -227,7 +224,6 @@ async fn main(spawner: Spawner) {
let type_c_service = TYPE_C_SERVICE.init(Service::create(
Default::default(),
controller_context,
controller_list,
power_policy_publisher,
power_policy_subscriber,
));
Expand All @@ -249,31 +245,4 @@ async fn main(spawner: Spawner) {
));

spawner.must_spawn(pd_controller_task(wrapper));

// Sync our internal state with the hardware
controller_context
Comment thread
RobertZ2011 marked this conversation as resolved.
.sync_controller_state_external(CONTROLLER0_ID)
.await
.unwrap();

embassy_time::Timer::after_secs(10).await;

let status = controller_context
.get_controller_status_external(CONTROLLER0_ID)
.await
.unwrap();

info!("Controller status: {:?}", status);

let status = controller_context
.get_port_status_external(PORT0_ID, Cached(true))
.await
.unwrap();
info!("Port status: {:?}", status);

let status = controller_context
.get_port_status_external(PORT1_ID, Cached(true))
.await
.unwrap();
info!("Port status: {:?}", status);
}
12 changes: 4 additions & 8 deletions examples/rt685s-evk/src/bin/type_c_cfu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ use embassy_time::Timer;
use embassy_time::{self as _, Delay};
use embedded_cfu_protocol::protocol_definitions::*;
use embedded_cfu_protocol::protocol_definitions::{FwUpdateOffer, FwUpdateOfferResponse, FwVersion};
use embedded_services::GlobalRawMutex;
use embedded_services::event::NoopSender;
use embedded_services::{GlobalRawMutex, IntrusiveList};
use embedded_services::{error, info};
use embedded_usb_pd::GlobalPortId;
use power_policy_interface::psu;
use power_policy_service::psu::ArrayEventReceivers;
use power_policy_service::service::registration::ArrayRegistration;
use static_cell::StaticCell;
use tps6699x::asynchronous::embassy as tps6699x;
use type_c_interface::port::ControllerId;
use type_c_service::driver::tps6699x::{self as tps6699x_drv};
use type_c_service::service::Service;
use type_c_service::type_c::ControllerId;
use type_c_service::wrapper::ControllerWrapper;
use type_c_service::wrapper::backing::{IntermediateStorage, ReferencedStorage, Storage};
use type_c_service::wrapper::proxy::PowerProxyDevice;
Expand Down Expand Up @@ -227,11 +227,8 @@ async fn main(spawner: Spawner) {
.await
.unwrap();

static CONTROLLER_CONTEXT: StaticCell<type_c_service::type_c::controller::Context> = StaticCell::new();
let controller_context = CONTROLLER_CONTEXT.init(type_c_service::type_c::controller::Context::new());

static CONTROLLER_LIST: StaticCell<IntrusiveList> = StaticCell::new();
let controller_list = CONTROLLER_LIST.init(IntrusiveList::new());
static CONTROLLER_CONTEXT: StaticCell<type_c_interface::service::context::Context> = StaticCell::new();
let controller_context = CONTROLLER_CONTEXT.init(type_c_interface::service::context::Context::new());

static STORAGE: StaticCell<Storage<TPS66994_NUM_PORTS, GlobalRawMutex>> = StaticCell::new();
let storage = STORAGE.init(Storage::new(
Expand Down Expand Up @@ -315,7 +312,6 @@ async fn main(spawner: Spawner) {
let type_c_service = TYPE_C_SERVICE.init(Service::create(
Default::default(),
controller_context,
controller_list,
power_policy_publisher,
power_policy_subscriber,
));
Expand Down
17 changes: 16 additions & 1 deletion examples/std/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 examples/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ embedded-cfu-protocol = { git = "https://github.com/OpenDevicePartnership/embedd
embedded-batteries-async = "0.3"
battery-service = { path = "../../battery-service", features = ["log", "mock"] }
type-c-service = { path = "../../type-c-service", features = ["log"] }
type-c-interface = { path = "../../type-c-interface", features = ["log"] }

embedded-sensors-hal-async = "0.3.0"
embedded-fans-async = "0.2.0"
Expand Down
Loading
Loading