Fix some lints
This commit is contained in:
parent
a07d13f4e8
commit
24daa0ad29
|
|
@ -4,7 +4,7 @@ use std::io::{Read, Write};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use const_gen::*;
|
use const_gen::*;
|
||||||
use indoc::formatdoc;
|
use indoc::{formatdoc, writedoc};
|
||||||
use json::JsonValue;
|
use json::JsonValue;
|
||||||
use slint_build::{CompilerConfiguration, EmbedResourcesKind};
|
use slint_build::{CompilerConfiguration, EmbedResourcesKind};
|
||||||
use xz2::read::XzEncoder;
|
use xz2::read::XzEncoder;
|
||||||
|
|
@ -107,7 +107,15 @@ fn generate_vial_config() {
|
||||||
|
|
||||||
writeln!(out_file, "{}", const_declarations).unwrap();
|
writeln!(out_file, "{}", const_declarations).unwrap();
|
||||||
|
|
||||||
writeln!(out_file, "#[repr(u8)] pub enum CustomKeycodes {{").unwrap();
|
writedoc!(
|
||||||
|
out_file,
|
||||||
|
"
|
||||||
|
#[allow(dead_code, non_camel_case_types)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum CustomKeycodes {{
|
||||||
|
"
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
// const CUSTOM_KEYCODE_FIRST: u16 = 0x840;
|
// const CUSTOM_KEYCODE_FIRST: u16 = 0x840;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ pub unsafe extern "C" fn __xkbc_malloc(size: c_size_t) -> *mut c_void {
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn __xkbc_calloc(number: c_size_t, size: c_size_t) -> *mut c_void {
|
pub unsafe extern "C" fn __xkbc_calloc(number: c_size_t, size: c_size_t) -> *mut c_void {
|
||||||
let total_size = number as usize * size;
|
let total_size = number * size;
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = __xkbc_malloc(total_size) as *mut u8;
|
let ptr = __xkbc_malloc(total_size) as *mut u8;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ pub unsafe extern "C" fn __xkbc_memset(
|
||||||
c: c_int,
|
c: c_int,
|
||||||
n: c_size_t,
|
n: c_size_t,
|
||||||
) -> *mut c_void {
|
) -> *mut c_void {
|
||||||
if dest_original == null_mut() {
|
if dest_original.is_null() {
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
panic!("Attempted to memset a nullptr.");
|
panic!("Attempted to memset a nullptr.");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use core::alloc::Layout;
|
use core::alloc::Layout;
|
||||||
use core::convert::TryFrom;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::slice;
|
use core::slice;
|
||||||
|
|
||||||
|
|
@ -12,7 +11,6 @@ use embassy_time::Instant;
|
||||||
use esp_alloc::MemoryCapability;
|
use esp_alloc::MemoryCapability;
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use rmk::descriptor::KeyboardReport;
|
use rmk::descriptor::KeyboardReport;
|
||||||
use rmk::futures::FutureExt;
|
|
||||||
use rmk::hid::Report;
|
use rmk::hid::Report;
|
||||||
use rmk::types::action::{Action, KeyAction};
|
use rmk::types::action::{Action, KeyAction};
|
||||||
use rmk::{a, k, layer};
|
use rmk::{a, k, layer};
|
||||||
|
|
@ -167,7 +165,7 @@ pub fn create_hid_report_interceptor() -> impl Future<Output = ()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
previous_state = report.clone();
|
previous_state = *report;
|
||||||
|
|
||||||
for keycode in released_keys {
|
for keycode in released_keys {
|
||||||
debug!("Release: 0x{:02x} ({})", keycode, keycode);
|
debug!("Release: 0x{:02x} ({})", keycode, keycode);
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,15 @@ extern crate alloc;
|
||||||
|
|
||||||
use core::alloc::Layout;
|
use core::alloc::Layout;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::slice;
|
|
||||||
use core::sync::atomic::{AtomicBool, Ordering};
|
use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::string::String;
|
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use cfg_if::cfg_if;
|
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||||
use embassy_sync::channel::Channel;
|
use embassy_sync::channel::Channel;
|
||||||
use embassy_sync::signal::Signal;
|
use embassy_sync::signal::Signal;
|
||||||
use embassy_time::{Duration, Instant};
|
use embassy_time::Duration;
|
||||||
use esp_alloc::{HeapRegion, MemoryCapability};
|
use esp_alloc::{HeapRegion, MemoryCapability};
|
||||||
use esp_hal::Blocking;
|
use esp_hal::Blocking;
|
||||||
use esp_hal::clock::CpuClock;
|
use esp_hal::clock::CpuClock;
|
||||||
|
|
@ -45,12 +42,11 @@ use esp_hal::system::Stack;
|
||||||
use esp_hal::timer::timg::TimerGroup;
|
use esp_hal::timer::timg::TimerGroup;
|
||||||
use esp_rtos::embassy::Executor;
|
use esp_rtos::embassy::Executor;
|
||||||
use esp_storage::FlashStorage;
|
use esp_storage::FlashStorage;
|
||||||
use log::{LevelFilter, error, info, warn};
|
use log::{error, info};
|
||||||
use rmk::channel::{CONTROLLER_CHANNEL, ControllerSub};
|
use rmk::channel::{CONTROLLER_CHANNEL, ControllerSub};
|
||||||
use rmk::config::{BehaviorConfig, PositionalConfig, RmkConfig, StorageConfig, VialConfig};
|
use rmk::config::{BehaviorConfig, PositionalConfig, RmkConfig, StorageConfig, VialConfig};
|
||||||
use rmk::controller::{Controller, EventController};
|
use rmk::controller::{Controller, EventController};
|
||||||
use rmk::debounce::default_debouncer::DefaultDebouncer;
|
use rmk::debounce::default_debouncer::DefaultDebouncer;
|
||||||
use rmk::descriptor::KeyboardReport;
|
|
||||||
use rmk::event::ControllerEvent;
|
use rmk::event::ControllerEvent;
|
||||||
use rmk::hid::Report;
|
use rmk::hid::Report;
|
||||||
use rmk::input_device::Runnable;
|
use rmk::input_device::Runnable;
|
||||||
|
|
@ -58,16 +54,12 @@ use rmk::join_all;
|
||||||
use rmk::keyboard::Keyboard;
|
use rmk::keyboard::Keyboard;
|
||||||
use rmk::storage::async_flash_wrapper;
|
use rmk::storage::async_flash_wrapper;
|
||||||
use rmk::types::action::{Action, KeyAction};
|
use rmk::types::action::{Action, KeyAction};
|
||||||
use rmk::types::keycode::{HidKeyCode, KeyCode};
|
|
||||||
use rmk::{initialize_keymap_and_storage, run_devices, run_rmk};
|
use rmk::{initialize_keymap_and_storage, run_devices, run_rmk};
|
||||||
use slint::ComponentHandle;
|
|
||||||
use slint::platform::software_renderer::Rgb565Pixel;
|
use slint::platform::software_renderer::Rgb565Pixel;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use ui::AppWindow;
|
|
||||||
use xkbcommon::xkb::{self, FeedResult, KeyDirection, Keysym, Status};
|
|
||||||
use {esp_alloc as _, esp_backtrace as _};
|
use {esp_alloc as _, esp_backtrace as _};
|
||||||
|
|
||||||
use crate::keymap::{KEY_MESSAGE_CHANNEL, create_hid_report_interceptor};
|
use crate::keymap::create_hid_report_interceptor;
|
||||||
use crate::logging::LOG_LEVEL_FILTER;
|
use crate::logging::LOG_LEVEL_FILTER;
|
||||||
use crate::matrix::IoeMatrix;
|
use crate::matrix::IoeMatrix;
|
||||||
use crate::peripherals::st7701s::St7701s;
|
use crate::peripherals::st7701s::St7701s;
|
||||||
|
|
@ -430,12 +422,11 @@ impl Controller for UserController {
|
||||||
type Event = ControllerEvent;
|
type Event = ControllerEvent;
|
||||||
|
|
||||||
async fn process_event(&mut self, event: Self::Event) {
|
async fn process_event(&mut self, event: Self::Event) {
|
||||||
if let ControllerEvent::Key(
|
if let ControllerEvent::Key(keyboard_event, KeyAction::Single(Action::User(user_key_index))) =
|
||||||
keyboard_event,
|
event
|
||||||
KeyAction::Single(Action::User(user_key_index)),
|
&& user_key_index == CustomKeycodes::FOCUS_LCD as u8
|
||||||
) = event
|
&& keyboard_event.pressed
|
||||||
{
|
{
|
||||||
if user_key_index == CustomKeycodes::FOCUS_LCD as u8 && keyboard_event.pressed {
|
|
||||||
let enabled = !LCD_ENABLED.fetch_xor(true, Ordering::SeqCst);
|
let enabled = !LCD_ENABLED.fetch_xor(true, Ordering::SeqCst);
|
||||||
|
|
||||||
match enabled {
|
match enabled {
|
||||||
|
|
@ -446,9 +437,7 @@ impl Controller for UserController {
|
||||||
}
|
}
|
||||||
true => {
|
true => {
|
||||||
info!("Enabling LCD.");
|
info!("Enabling LCD.");
|
||||||
*rmk::channel::KEYBOARD_REPORT_SENDER.write().await =
|
*rmk::channel::KEYBOARD_REPORT_SENDER.write().await = &KEYBOARD_REPORT_PROXY;
|
||||||
&KEYBOARD_REPORT_PROXY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use core::{cell::RefCell, time::Duration};
|
||||||
|
|
||||||
use alloc::rc::Rc;
|
use alloc::rc::Rc;
|
||||||
use esp_hal::time::Instant;
|
use esp_hal::time::Instant;
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info};
|
||||||
use slint::{
|
use slint::{
|
||||||
PhysicalSize, SharedString, WindowSize,
|
PhysicalSize, SharedString, WindowSize,
|
||||||
platform::{
|
platform::{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use alloc::boxed::Box;
|
||||||
#[cfg(feature = "limit-fps")]
|
#[cfg(feature = "limit-fps")]
|
||||||
use crate::FRAME_DURATION_MIN;
|
use crate::FRAME_DURATION_MIN;
|
||||||
use crate::{
|
use crate::{
|
||||||
SIGNAL_LCD_SUBMIT, SIGNAL_UI_RENDER, keymap::KEY_MESSAGE_CHANNEL, ui::backend::SlintBackend,
|
SIGNAL_LCD_SUBMIT, SIGNAL_UI_RENDER, ui::backend::SlintBackend,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod backend;
|
pub mod backend;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue