feat: "optimize" scan (increase i2c speed)
This commit is contained in:
parent
29cf1459d8
commit
700bfcb4fd
@ -465,7 +465,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
let scl = p.PIN_17;
|
let scl = p.PIN_17;
|
||||||
|
|
||||||
let mut i2c_config = i2c::Config::default();
|
let mut i2c_config = i2c::Config::default();
|
||||||
let freq = 400_000;
|
let freq = 1_000_000;
|
||||||
i2c_config.frequency = freq;
|
i2c_config.frequency = freq;
|
||||||
let i2c = i2c::I2c::new_blocking(p.I2C0, scl, sda, i2c_config);
|
let i2c = i2c::I2c::new_blocking(p.I2C0, scl, sda, i2c_config);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ impl<const N_ROWS: usize, const N_COLS: usize> KeyMatrix<N_ROWS, N_COLS> {
|
|||||||
|
|
||||||
// scan frequency
|
// scan frequency
|
||||||
// this might(?) panic if the scan takes longer than the tick
|
// this might(?) panic if the scan takes longer than the tick
|
||||||
let mut ticker = Ticker::every(Duration::from_millis(8));
|
let mut ticker = Ticker::every(Duration::from_micros(3600));
|
||||||
|
|
||||||
let chan = midi::MidiChannel::new(0);
|
let chan = midi::MidiChannel::new(0);
|
||||||
const MAX_NOTES: usize = 128;
|
const MAX_NOTES: usize = 128;
|
||||||
@ -80,7 +80,7 @@ impl<const N_ROWS: usize, const N_COLS: usize> KeyMatrix<N_ROWS, N_COLS> {
|
|||||||
loop {
|
loop {
|
||||||
let profile: bool = counter == 0;
|
let profile: bool = counter == 0;
|
||||||
counter += 1;
|
counter += 1;
|
||||||
counter %= 50;
|
counter %= 500;
|
||||||
let prof_start = Instant::now();
|
let prof_start = Instant::now();
|
||||||
let mut prof_time_last_col = prof_start;
|
let mut prof_time_last_col = prof_start;
|
||||||
let mut prof_dur_col = Duration::from_ticks(0);
|
let mut prof_dur_col = Duration::from_ticks(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user