feat: "optimize" scan (increase i2c speed)

This commit is contained in:
dogeystamp 2024-10-13 21:51:34 -04:00
parent 29cf1459d8
commit 700bfcb4fd
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 3 additions and 3 deletions

View File

@ -465,7 +465,7 @@ async fn main(_spawner: Spawner) {
let scl = p.PIN_17;
let mut i2c_config = i2c::Config::default();
let freq = 400_000;
let freq = 1_000_000;
i2c_config.frequency = freq;
let i2c = i2c::I2c::new_blocking(p.I2C0, scl, sda, i2c_config);

View File

@ -62,7 +62,7 @@ impl<const N_ROWS: usize, const N_COLS: usize> KeyMatrix<N_ROWS, N_COLS> {
// scan frequency
// 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);
const MAX_NOTES: usize = 128;
@ -80,7 +80,7 @@ impl<const N_ROWS: usize, const N_COLS: usize> KeyMatrix<N_ROWS, N_COLS> {
loop {
let profile: bool = counter == 0;
counter += 1;
counter %= 50;
counter %= 500;
let prof_start = Instant::now();
let mut prof_time_last_col = prof_start;
let mut prof_dur_col = Duration::from_ticks(0);