aboutsummaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/picardy/Cargo.lock33
-rw-r--r--sw/picardy/src/main.rs20
2 files changed, 37 insertions, 16 deletions
diff --git a/sw/picardy/Cargo.lock b/sw/picardy/Cargo.lock
index 19f0e2d..bc7632c 100644
--- a/sw/picardy/Cargo.lock
+++ b/sw/picardy/Cargo.lock
@@ -17,12 +17,13 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
[[package]]
name = "as-slice"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37dfb65bc03b2bc85ee827004f14a6817e04160e3b1a28931986a666a9290e70"
+checksum = "bb4d1c23475b74e3672afa8c2be22040b8b7783ad9b461021144ed10a46bb0e6"
dependencies = [
"generic-array 0.12.3",
"generic-array 0.13.2",
+ "generic-array 0.14.4",
"stable_deref_trait",
]
@@ -70,9 +71,9 @@ dependencies = [
[[package]]
name = "cortex-m-rt"
-version = "0.6.12"
+version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00d518da72bba39496024b62607c1d8e37bcece44b2536664f1132a73a499a28"
+checksum = "980c9d0233a909f355ed297ef122f257942de5e0a2cb1c39f60684b65bcb90fb"
dependencies = [
"cortex-m-rt-macros",
"r0",
@@ -127,6 +128,16 @@ dependencies = [
]
[[package]]
+name = "generic-array"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
name = "hd44780-driver"
version = "0.3.0"
dependencies = [
@@ -177,9 +188,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.19"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
+checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [
"unicode-xid",
]
@@ -277,9 +288,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.39"
+version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9"
+checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd"
dependencies = [
"proc-macro2",
"quote",
@@ -305,6 +316,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c"
[[package]]
+name = "version_check"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
+
+[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/sw/picardy/src/main.rs b/sw/picardy/src/main.rs
index d6f2bf9..66c00c5 100644
--- a/sw/picardy/src/main.rs
+++ b/sw/picardy/src/main.rs
@@ -25,6 +25,8 @@
#![no_main]
#![no_std]
+use core::mem::MaybeUninit;
+use core::fmt::Write;
use cortex_m_rt::ExceptionFrame;
use cortex_m_semihosting::hprintln;
use panic_semihosting as _;
@@ -32,22 +34,21 @@ use panic_semihosting as _;
use stm32f1xx_hal::{
prelude::*,
pac,
+ pac::interrupt,
i2c,
gpio,
delay::Delay,
- timer::{Timer, Event},
+ timer::{CountDownTimer, Timer, Event},
qei::QeiOptions,
};
-use stm32f1xx_hal::stm32::{/*NVIC, Interrupt,*/ interrupt};
-
use embedded_hal::digital::v2::{OutputPin};
use hd44780_driver::{Cursor, CursorBlink, Display, DisplayMode, HD44780};
pub mod ui;
pub mod si_clock;
-use core::fmt::Write;
+static mut TIMER1: MaybeUninit<CountDownTimer<pac::TIM1>> = MaybeUninit::uninit();
enum Mode {
VFO,
@@ -275,11 +276,12 @@ fn main() -> ! {
let mut last_encoder_count = qei.count();
- let mut timer1 = Timer::tim1(dp.TIM1, &clocks, &mut rcc.apb2)
- .start_count_down(40.hz());
+ let timer1 = unsafe { &mut *TIMER1.as_mut_ptr() };
+ *timer1 = Timer::tim1(dp.TIM1, &clocks, &mut rcc.apb2)
+ .start_count_down(1.hz());
timer1.listen(Event::Update);
- //unsafe { NVIC::unmask(Interrupt::TIM1_UP); }
+ unsafe { pac::NVIC::unmask(pac::Interrupt::TIM1_UP); }
loop {
let mut update_disp_required = false;
@@ -358,7 +360,7 @@ fn main() -> ! {
last_encoder_count = encoder_count;
- delay.delay_ms(20u8);
+ //delay.delay_ms(20u8);
//cortex_m::asm::wfi();
}
@@ -366,6 +368,8 @@ fn main() -> ! {
#[interrupt]
fn TIM1_UP() {
+ let timer1 = unsafe { &mut *TIMER1.as_mut_ptr() };
+ timer1.clear_update_interrupt_flag();
}
#[cortex_m_rt::exception]