mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
rp2040_local_i2c_init: update to latest version
This commit is contained in:
parent
5a9135961f
commit
dc02818ef1
2 changed files with 16 additions and 9 deletions
|
@ -6,14 +6,20 @@ license = "MIT OR Apache-2.0"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
|
||||||
|
[dependencies.rtic]
|
||||||
|
path = "../../rtic"
|
||||||
|
version = "2.0.0-alpha.1"
|
||||||
|
features = ["thumbv6-backend"]
|
||||||
|
|
||||||
|
[dependencies.rtic-monotonics]
|
||||||
|
path = "../../rtic-monotonics"
|
||||||
|
version = "1.0.0-alpha.1"
|
||||||
|
features = ["rp2040"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7"
|
cortex-m = "0.7"
|
||||||
rtic = { git = "https://github.com/rtic-rs/rtic", features = [
|
|
||||||
"thumbv6-backend",
|
|
||||||
] }
|
|
||||||
rtic-monotonics = { git = "https://github.com/rtic-rs/rtic", features = [
|
|
||||||
"rp2040",
|
|
||||||
] }
|
|
||||||
embedded-hal = { version = "0.2.7", features = ["unproven"] }
|
embedded-hal = { version = "0.2.7", features = ["unproven"] }
|
||||||
fugit = "0.3"
|
fugit = "0.3"
|
||||||
rp-pico = "0.7.0"
|
rp-pico = "0.7.0"
|
||||||
|
|
|
@ -25,8 +25,6 @@ mod app {
|
||||||
|
|
||||||
use panic_probe as _;
|
use panic_probe as _;
|
||||||
|
|
||||||
rtic_monotonics::make_rp2040_monotonic_handler!();
|
|
||||||
|
|
||||||
type I2CBus = I2C<
|
type I2CBus = I2C<
|
||||||
pac::I2C1,
|
pac::I2C1,
|
||||||
(
|
(
|
||||||
|
@ -51,8 +49,11 @@ mod app {
|
||||||
i2c_ctx: MaybeUninit<I2CBus> = MaybeUninit::uninit()
|
i2c_ctx: MaybeUninit<I2CBus> = MaybeUninit::uninit()
|
||||||
])]
|
])]
|
||||||
fn init(mut ctx: init::Context) -> (Shared, Local) {
|
fn init(mut ctx: init::Context) -> (Shared, Local) {
|
||||||
|
// Initialize the interrupt for the RP2040 timer and obtain the token
|
||||||
|
// proving that we have.
|
||||||
|
let rp2040_timer_token = rtic_monotonics::create_rp2040_monotonic_token!();
|
||||||
// Configure the clocks, watchdog - The default is to generate a 125 MHz system clock
|
// Configure the clocks, watchdog - The default is to generate a 125 MHz system clock
|
||||||
Timer::start(ctx.device.TIMER, &mut ctx.device.RESETS); // default rp2040 clock-rate is 125MHz
|
Timer::start(ctx.device.TIMER, &mut ctx.device.RESETS, rp2040_timer_token); // default rp2040 clock-rate is 125MHz
|
||||||
let mut watchdog = Watchdog::new(ctx.device.WATCHDOG);
|
let mut watchdog = Watchdog::new(ctx.device.WATCHDOG);
|
||||||
let clocks = clocks::init_clocks_and_plls(
|
let clocks = clocks::init_clocks_and_plls(
|
||||||
XOSC_CRYSTAL_FREQ,
|
XOSC_CRYSTAL_FREQ,
|
||||||
|
|
Loading…
Reference in a new issue