Skip to content
Closed
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
9 changes: 9 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Rust PR Review Instructions
CI overview:
* CI will build the project and run `cargo test` and `cargo clippy`.
* Feature combinations are checked with `cargo hack`.
* Do not comment on compile errors, compiler warnings, or clippy warnings.

Pay special attention to...
* code that uses async selection APIs such as `select`, `selectN`, `select_array`, `select_slice`, or is marked with a drop safety comment. These functions drop the futures that don't finish. Check that values are not lost when this happens.
* code that could possibly panic or is marked with a panic safety comment.
4 changes: 2 additions & 2 deletions .github/workflows/device-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: baptiste0928/cargo-install@v3
with:
crate: device-driver-cli
version: 1.0.3
version: 1.0.9
- name: Generate files
run: device-driver-cli --manifest device.yaml --device-name Registers -o ci_gen_registers.rs
- name: Check that the files are the exact same
Expand All @@ -31,4 +31,4 @@ jobs:
old: ci_gen_registers.rs
new: src/registers/generated.rs
mode: strict
tolerance: same
tolerance: same
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ embedded-hal = "1.0.0"
embedded-hal-async = "1.0.0"
embedded-usb-pd = { git = "https://github.com/OpenDevicePartnership/embedded-usb-pd", default-features = false }
# When updating `device-driver`, also update the version of device-driver-cli in the README and in the device-driver.yml workflow.
device-driver = { version = "1.0.3", default-features = false }
device-driver = { version = "1.0.9", default-features = false }
defmt = { version = "0.3.0", optional = true }
log = { version = "0.4.14", optional = true }
embassy-sync = { version = "0.8.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Driver for TPS6699x series PD controller
This driver uses the [device-driver](https://crates.io/crates/device-driver) crate to define the register mapping. If any changes are made to the register map manifest file `device.yaml`, `src/registers/generated.rs` must be regenerated by running the following commands:

```bash
$ cargo install device-driver-cli --version 1.0.3
$ cargo install device-driver-cli --version 1.0.9
$ device-driver-cli --manifest device.yaml --device-name Registers -o src/registers/generated.rs
```
6 changes: 3 additions & 3 deletions examples/rt685s-evk/Cargo.lock

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

10 changes: 5 additions & 5 deletions examples/rt685s-evk/src/bin/fw_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ bind_interrupts!(struct Irqs {
type Bus<'a> = I2cDevice<'a, NoopRawMutex, I2cMaster<'a, Async>>;
type Controller<'a> = pd_controller::controller::Controller<NoopRawMutex, Bus<'a>>;

type Interrupt<'a> = pd_controller::Interrupt<'a, NoopRawMutex, Bus<'a>>;
type InterruptProcessor<'a> = pd_controller::interrupt::InterruptProcessor<'a, NoopRawMutex, Bus<'a>>;

#[embassy_executor::task]
async fn interrupt_task(mut int_in: Input<'static>, mut interrupt: Interrupt<'static>) {
async fn interrupt_task(mut int_in: Input<'static>, mut interrupt: InterruptProcessor<'static>) {
pd_controller::task::interrupt_task(&mut int_in, [&mut interrupt].as_mut_slice()).await;
}

Expand All @@ -47,15 +47,15 @@ async fn main(spawner: Spawner) {
let device = I2cDevice::new(bus);

static CONTROLLER: StaticCell<Controller<'static>> = StaticCell::new();
let controller = CONTROLLER.init(Controller::new_tps66994(device, ADDR0).unwrap());
let (mut pd, interrupt) = controller.make_parts();
let controller = CONTROLLER.init(Controller::new_tps66994(device, Default::default(), ADDR0).unwrap());
let (mut pd, interrupt_processor, _interrupt_receiver) = controller.make_parts();

let mut delay = Delay;
info!("Resetting PD controller");
pd.reset(&mut delay).await.unwrap();

info!("Spawing PD interrupt task");
spawner.spawn(interrupt_task(int_in, interrupt).unwrap());
spawner.spawn(interrupt_task(int_in, interrupt_processor).unwrap());

let pd_fw_bytes = [0u8].as_slice(); //include_bytes!("../../fw.bin").as_slice();

Expand Down
14 changes: 7 additions & 7 deletions examples/rt685s-evk/src/bin/plug_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ bind_interrupts!(struct Irqs {
type Bus<'a> = I2cDevice<'a, NoopRawMutex, I2cMaster<'a, Async>>;
type Controller<'a> = pd_controller::controller::Controller<NoopRawMutex, Bus<'a>>;

type Interrupt<'a> = pd_controller::Interrupt<'a, NoopRawMutex, Bus<'a>>;
type InterruptProcessor<'a> = pd_controller::interrupt::InterruptProcessor<'a, NoopRawMutex, Bus<'a>>;

#[embassy_executor::task]
async fn interrupt_task(mut int_in: Input<'static>, mut interrupt: Interrupt<'static>) {
async fn interrupt_task(mut int_in: Input<'static>, mut interrupt: InterruptProcessor<'static>) {
pd_controller::task::interrupt_task(&mut int_in, [&mut interrupt].as_mut_slice()).await;
}

Expand All @@ -46,17 +46,17 @@ async fn main(spawner: Spawner) {
let device = I2cDevice::new(bus);

static CONTROLLER: StaticCell<Controller<'static>> = StaticCell::new();
let controller = CONTROLLER.init(Controller::new_tps66994(device, ADDR0).unwrap());
let (mut pd, interrupt) = controller.make_parts();
let controller = CONTROLLER.init(Controller::new_tps66994(device, Default::default(), ADDR0).unwrap());
let (mut pd, interrupt_processor, mut interrupt_receiver) = controller.make_parts();

info!("Spawing PD interrupt task");
spawner.spawn(interrupt_task(int_in, interrupt).unwrap());
spawner.spawn(interrupt_task(int_in, interrupt_processor).unwrap());

loop {
let mut plug_event_mask = IntEventBus1::new_zero();
plug_event_mask.set_plug_event(true);
let flags = pd
.wait_interrupt_any(false, [plug_event_mask; MAX_SUPPORTED_PORTS])
let flags = interrupt_receiver
.wait_any_masked(false, [plug_event_mask; MAX_SUPPORTED_PORTS])
.await;

for (i, flag) in flags.iter().enumerate().take(pd.num_ports()) {
Expand Down
Loading
Loading