Removed global static channel_out and moved to interrupt state. TODO: make feature switch for slave specific stuff

This commit is contained in:
anton smeenk
2023-11-10 18:00:59 +01:00
parent 541b479b05
commit 8399d96e24
5 changed files with 24 additions and 67 deletions

View File

@ -1,43 +0,0 @@
[default.probe]
protocol = "Swd"
# USB vendor ID
# usb_vid = "6790"
# USB product ID
# usb_pid = "29987"
[default.flashing]
enabled = true
[default.reset]
# Whether or not the target should be reset.
# When flashing is enabled as well, the target will be reset after flashing.
enabled = true
# Whether or not the target should be halted after reset.
halt_afterwards = false
[default.general]
# The chip name of the chip to be debugged.
#chip = "STM32G030J6Mx"
chip = "STM32G070CBTx"
# A list of chip descriptions to be loaded during runtime.
chip_descriptions = []
# The default log level to be used.
log_level = "Warn"
[default.rtt]
enabled = false
# A list of channel associations to be displayed. If left empty, all channels are displayed.
channels = [
# { up = 0, down = 0, name = "name" }
]
# The duration in ms for which the logger should retry to attach to RTT.
timeout = 3000
# Whether timestamps in the RTTUI are enabled
show_timestamps = true
[default.gdb]
# Whether or not a GDB server should be opened after flashing.
# This is exclusive and cannot be used with RTT at the moment.
enabled = false
# The connection string in host:port format wher the GDB server will open a socket.
# gdb_connection_string

View File

@ -123,6 +123,7 @@ async fn main(spawner: Spawner) {
// start of the actual test
i2c.slave_start_listen().unwrap();
let receiver = i2c.slave_transaction_receiver();
loop {
counter += 1;
writeln!(&mut writer, "Loop: {}\r", counter).unwrap();
@ -143,7 +144,7 @@ async fn main(spawner: Spawner) {
writeln!(&mut writer, "Waiting for master activity\r").unwrap();
let t = i2c.slave_transaction().await;
let t = receiver.receive().await;
let dir = t.dir();
tcount += 1;
// preparations for the next round

View File

@ -10,7 +10,7 @@ use core::fmt::{self, Write};
use embassy_executor::Spawner;
use embassy_stm32::dma::NoDma;
// use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::i2c::{I2c, AddressIndex};
use embassy_stm32::i2c::{AddressIndex, I2c};
use embassy_stm32::time::Hertz;
use embassy_stm32::usart::UartTx;
use embassy_stm32::{bind_interrupts, i2c, peripherals, usart};
@ -83,6 +83,7 @@ async fn main(_spawner: Spawner) {
// start of the actual test
i2c.slave_start_listen().unwrap();
let receiver = i2c.slave_transaction_receiver();
loop {
counter += 1;
writeln!(&mut writer, "Loop: {}\r", counter).unwrap();
@ -94,7 +95,7 @@ async fn main(_spawner: Spawner) {
writeln!(&mut writer, "Waiting for master activity\r").unwrap();
let t = i2c.slave_transaction().await;
let t = receiver.receive().await;
writeln!(
&mut writer,
"Address: x{:2x} dir: {:?} size: x{:2x}, Result:{:?}\r",