I don't need timeout here
This commit is contained in:
parent
195ecf9bfa
commit
05b468e8ba
2 changed files with 31 additions and 2 deletions
32
.idea/cody_history.xml
generated
32
.idea/cody_history.xml
generated
|
|
@ -87,9 +87,39 @@
|
|||
<speaker value="ASSISTANT" />
|
||||
<text value="Certainly! Here's how we can create a single task that monitors both input pins using `select` and prints logs using `info!`: ```rust use embassy_futures::select::{select, Either}; #[embassy_executor::task] async fn monitor_pins(mut input4: Input<'static, GpioPin<4>>, mut input5: Input<'static, GpioPin<5>>) { loop { match select(input4.wait_for_rising_edge(), input5.wait_for_rising_edge()).await { Either::First(_) => info!("Rising edge detected on Pin 4!"), Either::Second(_) => info!("Rising edge detected on Pin 5!"), } Timer::after(Duration::from_millis(100)).await; } } #[main] async fn main(spawner: Spawner) { // ... (previous code remains the same) let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); let input4 = Input::new(io.pins.gpio4, Pull::Down); let input5 = Input::new(io.pins.gpio5, Pull::Down); spawner.spawn(monitor_pins(input4, input5)).unwrap(); // ... (rest of the code remains the same) } ``` This implementation creates a single task `monitor_pins` that takes both input pins as parameters. It uses `select` to wait for a rising edge on either pin, then prints the appropriate log message using `info!`. The task is spawned in the `main` function, passing both input pins as arguments." />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="HUMAN" />
|
||||
<text value="we have to keep the name of the type in the constants here, right? embassy tasks can't contain generics " />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="ASSISTANT" />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="HUMAN" />
|
||||
<text value="we have to keep the name of the type in the constants here, right? embassy tasks can't contain generics " />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="ASSISTANT" />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="HUMAN" />
|
||||
<text value="we have to keep the name of the pins in the type here, right? embassy tasks can't contain generics: #[embassy_executor::task] async fn monitor_pins( mut input4: Input&lt;'static, GpioPin&lt;4&gt;&gt;, mut input5: Input&lt;'static, GpioPin&lt;5&gt;&gt;, ) {" />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="ASSISTANT" />
|
||||
<text value="Yes, that's correct. In this case, we need to keep the specific pin numbers in the type signatures for `input4` and `input5`. Embassy tasks indeed cannot contain generics, so specifying the exact pin types `GpioPin<4>` and `GpioPin<5>` is the right approach. This ensures type safety and allows the compiler to verify that we're using the correct pins throughout our code." />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="HUMAN" />
|
||||
<text value="analog of dracut's install_items+=&quot; /etc/zfs/zroot.key &quot; in mkinitcpio for arch" />
|
||||
</message>
|
||||
<message>
|
||||
<speaker value="ASSISTANT" />
|
||||
<text value="To achieve the equivalent of dracut's `install_items+=" /etc/zfs/zroot.key "` in mkinitcpio for Arch Linux, you can use the `FILES` array in your mkinitcpio configuration. Add the following line to your `/etc/mkinitcpio.conf`: ``` FILES=(/etc/zfs/zroot.key) ``` This will include the specified file in your initramfs image. If you need to add multiple files, you can separate them with spaces: ``` FILES=(/etc/zfs/zroot.key /path/to/another/file) ``` After making this change, remember to regenerate your initramfs: ``` mkinitcpio -P ``` This approach will ensure that your ZFS key file is included in the initramfs, similar to how dracut's `install_items` works." />
|
||||
</message>
|
||||
</list>
|
||||
</messages>
|
||||
<updatedAt value="2024-08-08T23:07:31.542436259" />
|
||||
<updatedAt value="2024-08-08T23:29:01.352549629" />
|
||||
</chat>
|
||||
</list>
|
||||
</chats>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ async fn monitor_pins(
|
|||
Either::First(_) => info!("Rising edge detected on Pin 4!"),
|
||||
Either::Second(_) => info!("Rising edge detected on Pin 5!"),
|
||||
}
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue