Begin
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
[build]
|
||||||
|
target = "thumbv6m-none-eabi"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
DEFMT_LOG = "trace"
|
||||||
|
|
||||||
|
[target.thumbv6m-none-eabi]
|
||||||
|
runner = 'probe-rs run --chip STM32G0B1RE'
|
||||||
|
rustflags = [
|
||||||
|
"-C", "link-arg=--nmagic",
|
||||||
|
"-C", "link-arg=-Tlink.x",
|
||||||
|
"-C", "link-arg=-Tdefmt.x",
|
||||||
|
]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/target
|
||||||
Generated
+1263
File diff suppressed because it is too large
Load Diff
+54
@@ -0,0 +1,54 @@
|
|||||||
|
[package]
|
||||||
|
name = "tts-test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "tts-test"
|
||||||
|
test = false
|
||||||
|
bench = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cortex-m = {
|
||||||
|
version = "0.7",
|
||||||
|
features = ["inline-asm", "critical-section-single-core"]
|
||||||
|
}
|
||||||
|
cortex-m-rt = "0.7"
|
||||||
|
|
||||||
|
embassy-stm32 = {
|
||||||
|
version = "0.6",
|
||||||
|
features = [
|
||||||
|
"rt",
|
||||||
|
"defmt",
|
||||||
|
"memory-x",
|
||||||
|
"stm32g0b1re",
|
||||||
|
"time-driver-any",
|
||||||
|
"exti",
|
||||||
|
"unstable-pac",
|
||||||
|
"cyw43"
|
||||||
|
],
|
||||||
|
}
|
||||||
|
embassy-executor = {
|
||||||
|
version = "0.10",
|
||||||
|
features = ["platform-cortex-m", "executor-thread", "defmt"],
|
||||||
|
}
|
||||||
|
embassy-time = {
|
||||||
|
version = "0.5",
|
||||||
|
features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cyw43 = {
|
||||||
|
version = "0.7",
|
||||||
|
features = ["defmt"],
|
||||||
|
}
|
||||||
|
|
||||||
|
embedded-hal-bus = "0.3"
|
||||||
|
embedded-can = "0.4"
|
||||||
|
|
||||||
|
defmt = "1.1"
|
||||||
|
defmt-rtt = "1.2"
|
||||||
|
|
||||||
|
panic-probe = { version = "1.0", features = ["print-defmt"]}
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
debug = 2
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
#![no_main]
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
|
use defmt::*;
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_stm32::{Config, bind_interrupts, dma::InterruptHandler, i2c::{self, ErrorInterruptHandler, EventInterruptHandler, I2c}, peripherals::{DMA1_CH1, DMA1_CH2, I2C2}};
|
||||||
|
|
||||||
|
use defmt_rtt as _;
|
||||||
|
use panic_probe as _;
|
||||||
|
|
||||||
|
bind_interrupts!(struct Irqs {
|
||||||
|
DMA1_CHANNEL2_3 => InterruptHandler<DMA1_CH2>;
|
||||||
|
DMA1_CHANNEL1 => InterruptHandler<DMA1_CH1>;
|
||||||
|
I2C2_3 => EventInterruptHandler<I2C2>, ErrorInterruptHandler<I2C2>;
|
||||||
|
});
|
||||||
|
|
||||||
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
|
let config = Config::default();
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
|
let mut i2c_cfg = i2c::Config::default();
|
||||||
|
// i2c_cfg.sda_pullup = true;
|
||||||
|
// i2c_cfg.scl_pullup = true;
|
||||||
|
i2c_cfg.sda_pullup = false;
|
||||||
|
i2c_cfg.scl_pullup = false;
|
||||||
|
let mut i2c = I2c::new(
|
||||||
|
p.I2C2,
|
||||||
|
p.PA7, p.PA6,
|
||||||
|
p.DMA1_CH1, p.DMA1_CH2,
|
||||||
|
Irqs,
|
||||||
|
i2c_cfg);
|
||||||
|
|
||||||
|
i2c.write(0x1A, &[0x02u8]).await.unwrap();
|
||||||
|
|
||||||
|
info!("Success!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user