Skip to content

Conversation

@Schievel1
Copy link
Contributor

@Schievel1 Schievel1 commented Dec 28, 2025

Inplemented InputDevice for PMW3360 and PMW3389 optical mouse sensors. The driver is based on the existing PWM3610 driver in RMK and Zephyr's implementation.

Please note that this needs HaoboGu/rmk-template#18 in order for new projects from rmkit to work. (At least for RP2040 and STM32). Otherwise users need to do cargo add embassy-embedded-hal. Users of RP2040 and STM32 also need to add embassy-embedded-hal to their keyboards Cargo.toml to use the PMW33xx sensor.

BREAKING: PointingDevice and PointingProcessor replace Pmw3610Device and Pmw3610Processor. For the Pmw3610 the calls of ::new() for these stay the same, only the name changes. If using Rust to configure the keyboard change the calls, if using Toml nothing needs to be done.

Example Usage

[[input_device.pmw33xx]]
name = "trackball0"
sensor_type = "PMW3360" # or PMW3389

spi.instance = "SPI0"
spi.sck = "PIN_18"
spi.mosi = "PIN_19"
spi.miso = "PIN_16"
spi.cs = "PIN_17"
# By default this driver uses blocking SPI. For a small performance gain,
# you can define the DMA channels. Then the driver is using SPI with DMA.
# Figure out the DMA channel using the Peripherals from the embassy hal crate
# (embassy-rp, embassy-stm32 etc.) similar to the PINs.
# On nrf52 the driver alsways uses DMA, the channels do not need to be specified.
# spi.tx_dma = "DMA_CH2" # omit for nrf52
# spi.rx_dma = "DMA_CH3" # omit for nrf52

motion = "PIN_20" # Optional. If omitted, the sensor is polled.

cpi = 1600
rot_trans_angle = -15
liftoff_dist = 8
invert_x = true
# invert_y = true
# swap_xy = true

Todos

In the future, refactoring is needed to share implementation with JoyStick/ PWM3610 sensor or to handle SPI/I2C configs or generic processing like input transformation for pointing devices.

@github-actions
Copy link

github-actions bot commented Dec 28, 2025

Binary Size Report

use_config/nrf52832_ble

   text	   data	    bss	    dec	    hex	filename
 319328	   5072	  31676	 356076	  56eec	rmk-nrf52832
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.9% +7.78Ki  +2.9% +7.78Ki    .text
  +0.9% +2.29Ki  [ = ]       0    .strtab
  +0.8% +2.22Ki  [ = ]       0    .debug_line
  +0.1%    +176  [ = ]       0    .debug_ranges
   +16%      +9  [ = ]       0    [Unmapped]
  -1.7%     -12  [ = ]       0    .defmt
  -0.4%    -168  [ = ]       0    .debug_aranges
  -1.5%    -584  [ = ]       0    .debug_frame
  [ = ]       0  -2.5%    -800    .bss
  -1.3% -1.39Ki  [ = ]       0    .symtab
  -5.2% -1.95Ki  -5.2% -1.95Ki    .rodata
  -0.9% -4.51Ki  [ = ]       0    .debug_loc
  -0.2% -5.63Ki  [ = ]       0    .debug_str
  -1.1% -17.7Ki  [ = ]       0    .debug_info
  -0.3% -19.4Ki  +1.5% +5.05Ki    TOTAL

use_config/nrf52840_ble

   text	   data	    bss	    dec	    hex	filename
 356236	   5072	  45148	 406456	  633b8	rmk-nrf52840
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.3% +6.91Ki  +2.3% +6.91Ki    .text
  +0.9% +2.61Ki  [ = ]       0    .strtab
  +0.7% +2.13Ki  [ = ]       0    .debug_line
  +0.0%     +16  [ = ]       0    .debug_aranges
  +0.2%     +14  [ = ]       0    .debug_abbrev
   +13%      +6  [ = ]       0    [Unmapped]
  -1.3%     -11  [ = ]       0    .defmt
  -0.2%    -400  [ = ]       0    .debug_ranges
  -1.3%    -568  [ = ]       0    .debug_frame
  -1.0% -1.19Ki  [ = ]       0    .symtab
  -0.2% -1.37Ki  [ = ]       0    .debug_loc
  -4.7% -1.95Ki  -4.7% -1.95Ki    .rodata
  [ = ]       0  -6.6% -3.05Ki    .bss
  -0.1% -4.03Ki  [ = ]       0    .debug_str
  -0.9% -15.7Ki  [ = ]       0    .debug_info
  -0.2% -13.5Ki  +0.5% +1.91Ki    TOTAL

use_config/nrf52840_ble_split

   text	   data	    bss	    dec	    hex	filename
 429672	   6376	  43644	 479692	  751cc	central

   text	   data	    bss	    dec	    hex	filename
 282920	   5740	  26212	 314872	  4cdf8	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.6% +5.81Ki  +1.6% +5.81Ki    .text
  +0.4% +1.29Ki  [ = ]       0    .strtab
  +7.0%      +4  [ = ]       0    [Unmapped]
  -0.2%     -16  [ = ]       0    .debug_abbrev
  -2.1%     -17  [ = ]       0    .defmt
  -0.2%    -581  [ = ]       0    .debug_line
  -1.4%    -652  [ = ]       0    .debug_frame
  [ = ]       0  -1.5%    -664    .bss
  -1.1% -1.52Ki  [ = ]       0    .symtab
  -5.3% -2.35Ki  -5.3% -2.35Ki    .rodata
  -1.8% -3.66Ki  [ = ]       0    .debug_ranges
  -1.5% -9.39Ki  [ = ]       0    .debug_loc
  -2.0% -38.6Ki  [ = ]       0    .debug_info
  -1.6% -48.5Ki  [ = ]       0    .debug_str
  -1.4% -98.1Ki  +0.6% +2.81Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.8% +11.4Ki  +4.8% +11.4Ki    .text
  +1.3% +2.89Ki  [ = ]       0    .debug_line
  +0.7% +1.45Ki  [ = ]       0    .strtab
  +0.6%    +208  [ = ]       0    .debug_aranges
  +0.0%     +16  [ = ]       0    .symtab
  -4.9%      -3  [ = ]       0    [Unmapped]
  -2.5%     -13  [ = ]       0    .defmt
  -1.3%    -100  [ = ]       0    .debug_abbrev
  -1.4%    -388  [ = ]       0    .debug_frame
  -0.7%    -976  [ = ]       0    .debug_ranges
  [ = ]       0  -7.5% -1.99Ki    .bss
  -7.7% -2.47Ki  -7.7% -2.47Ki    .rodata
  -0.9% -3.44Ki  [ = ]       0    .debug_loc
  -3.2% -42.2Ki  [ = ]       0    .debug_info
  -3.1% -63.1Ki  [ = ]       0    .debug_str
  -2.1% -96.7Ki  +2.3% +6.89Ki    TOTAL

use_rust/nrf52840_ble_split

   text	   data	    bss	    dec	    hex	filename
 434804	   6376	  49244	 490424	  77bb8	central

   text	   data	    bss	    dec	    hex	filename
 281260	   5196	  24932	 311388	  4c05c	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.0% +7.66Ki  +2.0% +7.66Ki    .text
  +0.7% +2.24Ki  [ = ]       0    .strtab
  +0.6% +1.95Ki  [ = ]       0    .debug_line
  +0.0%      +8  [ = ]       0    .debug_aranges
   +17%      +8  [ = ]       0    [Unmapped]
  -1.6%     -13  [ = ]       0    .defmt
  -0.2%    -448  [ = ]       0    .debug_ranges
  -1.1%    -544  [ = ]       0    .debug_frame
  -0.8% -1.14Ki  [ = ]       0    .symtab
  [ = ]       0  -2.9% -1.39Ki    .bss
  -4.4% -1.98Ki  -4.4% -1.98Ki    .rodata
  -0.8% -4.94Ki  [ = ]       0    .debug_loc
  -0.4% -12.4Ki  [ = ]       0    .debug_str
  -0.7% -12.9Ki  [ = ]       0    .debug_info
  -0.3% -22.4Ki  +0.9% +4.29Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.6% +10.8Ki  +4.6% +10.8Ki    .text
  +1.0% +2.24Ki  [ = ]       0    .debug_line
  +0.8% +1.53Ki  [ = ]       0    .strtab
  +0.6%    +240  [ = ]       0    .debug_aranges
  +0.1%    +128  [ = ]       0    .symtab
   +30%     +13  [ = ]       0    [Unmapped]
  -3.2%     -17  [ = ]       0    .defmt
  -1.1%     -88  [ = ]       0    .debug_abbrev
  -0.9%    -248  [ = ]       0    .debug_frame
  [ = ]       0  -7.9% -2.01Ki    .bss
  -1.6% -2.16Ki  [ = ]       0    .debug_ranges
  -7.8% -2.56Ki  -7.8% -2.56Ki    .rodata
  -2.4% -9.66Ki  [ = ]       0    .debug_loc
  -3.1% -40.5Ki  [ = ]       0    .debug_info
  -2.8% -56.4Ki  [ = ]       0    .debug_str
  -2.1% -96.7Ki  +2.1% +6.20Ki    TOTAL

use_config/pi_pico_w_ble

   text	   data	    bss	    dec	    hex	filename
 590696	      0	  53108	 643804	  9d2dc	rmk-pi-pico-w
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.0% +5.73Ki  +2.0% +5.73Ki    .text
  +1.0% +2.40Ki  [ = ]       0    .strtab
  +0.2%    +652  [ = ]       0    .debug_line
  -0.0%      -1  [ = ]       0    .debug_abbrev
  -1.6%     -12  [ = ]       0    .defmt
 -23.1%     -12  [ = ]       0    [Unmapped]
  -0.1%     -32  [ = ]       0    .debug_aranges
  -1.0%    -368  [ = ]       0    .debug_frame
  -0.6%    -448  [ = ]       0    .symtab
  [ = ]       0  -1.5%    -800    .bss
  -0.6% -1.24Ki  [ = ]       0    .debug_ranges
  -0.8% -2.38Ki  -0.8% -2.38Ki    .rodata
  -0.9% -7.16Ki  [ = ]       0    .debug_loc
  -0.4% -10.9Ki  [ = ]       0    .debug_str
  -1.0% -20.8Ki  [ = ]       0    .debug_info
  -0.5% -34.6Ki  +0.4% +2.57Ki    TOTAL

use_config/pi_pico_w_ble_split

   text	   data	    bss	    dec	    hex	filename
 623740	      0	  60148	 683888	  a6f70	central

   text	   data	    bss	    dec	    hex	filename
 495760	      0	  42224	 537984	  83580	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.0% +6.38Ki  +2.0% +6.38Ki    .text
  +1.1% +3.11Ki  [ = ]       0    .strtab
  +0.2%    +786  [ = ]       0    .debug_line
  +0.4%    +152  [ = ]       0    .debug_aranges
  +0.2%     +20  [ = ]       0    .debug_abbrev
  +8.9%      +4  [ = ]       0    [Unmapped]
  -1.3%     -11  [ = ]       0    .defmt
  -0.7%    -268  [ = ]       0    .debug_frame
  -0.5%    -432  [ = ]       0    .symtab
  [ = ]       0  -0.9%    -512    .bss
  -1.0% -2.09Ki  [ = ]       0    .debug_ranges
  -0.8% -2.38Ki  -0.8% -2.38Ki    .rodata
  -0.6% -5.49Ki  [ = ]       0    .debug_loc
  -0.2% -7.16Ki  [ = ]       0    .debug_str
  -0.8% -17.0Ki  [ = ]       0    .debug_info
  -0.3% -24.4Ki  +0.5% +3.49Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.8% +9.64Ki  +4.8% +9.64Ki    .text
  +2.0% +3.61Ki  [ = ]       0    .strtab
  +0.5% +1.34Ki  [ = ]       0    .debug_line
  +0.9%    +496  [ = ]       0    .symtab
  [ = ]       0  +0.6%    +240    .bss
  +0.5%    +176  [ = ]       0    .debug_aranges
  +4.7%      +3  [ = ]       0    [Unmapped]
  -1.5%      -8  [ = ]       0    .defmt
  -0.2%     -18  [ = ]       0    .debug_abbrev
  -0.6%    -168  [ = ]       0    .debug_frame
  -0.9% -2.42Ki  -0.9% -2.42Ki    .rodata
  -2.3% -3.29Ki  [ = ]       0    .debug_ranges
  -1.6% -9.26Ki  [ = ]       0    .debug_loc
  -1.5% -23.2Ki  [ = ]       0    .debug_info
  -1.5% -32.6Ki  [ = ]       0    .debug_str
  -1.0% -55.7Ki  +1.4% +7.45Ki    TOTAL

use_rust/pi_pico_w_ble_split

   text	   data	    bss	    dec	    hex	filename
 623872	      0	  60460	 684332	  a712c	central

   text	   data	    bss	    dec	    hex	filename
 496100	      0	  42224	 538324	  836d4	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.0% +6.29Ki  +2.0% +6.29Ki    .text
  +1.1% +3.15Ki  [ = ]       0    .strtab
  +0.2%    +961  [ = ]       0    .debug_line
  +0.4%    +152  [ = ]       0    .debug_aranges
   +16%      +7  [ = ]       0    [Unmapped]
  +0.0%      +2  [ = ]       0    .debug_abbrev
  -1.3%     -11  [ = ]       0    .defmt
  -0.3%    -208  [ = ]       0    .symtab
  -0.7%    -268  [ = ]       0    .debug_frame
  [ = ]       0  -0.9%    -512    .bss
  -0.4%    -944  [ = ]       0    .debug_ranges
  -0.8% -2.38Ki  -0.8% -2.38Ki    .rodata
  -0.6% -4.91Ki  [ = ]       0    .debug_loc
  -0.2% -7.11Ki  [ = ]       0    .debug_str
  -0.8% -17.1Ki  [ = ]       0    .debug_info
  -0.3% -22.4Ki  +0.5% +3.40Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.8% +9.73Ki  +4.9% +9.73Ki    .text
  +2.0% +3.66Ki  [ = ]       0    .strtab
  +0.5% +1.47Ki  [ = ]       0    .debug_line
  +1.4%    +752  [ = ]       0    .symtab
  [ = ]       0  +0.6%    +240    .bss
  +0.5%    +176  [ = ]       0    .debug_aranges
  +8.9%      +4  [ = ]       0    [Unmapped]
  -1.5%      -8  [ = ]       0    .defmt
  -0.6%    -168  [ = ]       0    .debug_frame
  -0.9% -2.42Ki  -0.9% -2.42Ki    .rodata
  -2.2% -3.26Ki  [ = ]       0    .debug_ranges
  -1.7% -9.95Ki  [ = ]       0    .debug_loc
  -1.5% -23.2Ki  [ = ]       0    .debug_info
  -1.5% -32.1Ki  [ = ]       0    .debug_str
  -1.0% -55.3Ki  +1.5% +7.55Ki    TOTAL

use_config/rp2040

   text	   data	    bss	    dec	    hex	filename
 135564	      0	  14636	 150200	  24ab8	rmk-rp2040
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +5.4% +6.00Ki  +5.4% +6.00Ki    .text
  +3.1% +2.93Ki  [ = ]       0    .strtab
  +0.6%    +907  [ = ]       0    .debug_line
  +1.6%    +125  [ = ]       0    .debug_abbrev
  +0.2%     +24  [ = ]       0    .debug_aranges
  -3.5%     -12  [ = ]       0    .defmt
 -32.1%     -17  [ = ]       0    [Unmapped]
  -0.3%     -80  [ = ]       0    .symtab
  -1.4%    -224  [ = ]       0    .debug_frame
  [ = ]       0  -5.6%    -808    .bss
  -1.8% -1.30Ki  [ = ]       0    .debug_ranges
 -11.6% -1.96Ki -11.6% -1.96Ki    .rodata
  -3.4% -8.98Ki  [ = ]       0    .debug_loc
  -1.0% -13.2Ki  [ = ]       0    .debug_str
  -2.2% -20.0Ki  [ = ]       0    .debug_info
  -1.2% -35.8Ki  +2.3% +3.26Ki    TOTAL

use_config/rp2040_split

   text	   data	    bss	    dec	    hex	filename
 149352	      0	  16520	 165872	  287f0	central

   text	   data	    bss	    dec	    hex	filename
  33820	      0	   3208	  37028	   90a4	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.8% +5.88Ki  +4.8% +5.88Ki    .text
  +3.0% +3.16Ki  [ = ]       0    .strtab
  +0.3%    +465  [ = ]       0    .debug_line
  +0.9%    +152  [ = ]       0    .debug_aranges
  +0.4%     +30  [ = ]       0    .debug_abbrev
  -2.9%     -11  [ = ]       0    .defmt
 -25.9%     -14  [ = ]       0    [Unmapped]
  -0.2%     -80  [ = ]       0    .symtab
  -1.5%    -268  [ = ]       0    .debug_frame
  [ = ]       0  -3.1%    -496    .bss
  -2.3% -1.84Ki  [ = ]       0    .debug_ranges
 -10.4% -1.95Ki -10.5% -1.95Ki    .rodata
  -1.6% -5.04Ki  [ = ]       0    .debug_loc
  -0.6% -8.36Ki  [ = ]       0    .debug_str
  -1.8% -18.0Ki  [ = ]       0    .debug_info
  -0.8% -25.9Ki  +2.2% +3.44Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +36% +7.35Ki   +36% +7.35Ki    .text
   +16% +4.22Ki  [ = ]       0    .strtab
  +2.1% +1.24Ki  [ = ]       0    .debug_line
  [ = ]       0   +14%    +264    .bss
  +1.3%    +160  [ = ]       0    .debug_aranges
  +0.9%     +80  [ = ]       0    .symtab
   +22%      +9  [ = ]       0    [Unmapped]
  -4.8%      -7  [ = ]       0    .defmt
  -2.6%    -144  [ = ]       0    .debug_frame
  -3.2%    -188  [ = ]       0    .debug_abbrev
  -5.0%    -240  -5.0%    -240    .rodata
  -8.7% -1.27Ki  [ = ]       0    .debug_ranges
  -0.5% -2.62Ki  [ = ]       0    .debug_str
 -11.6% -6.34Ki  [ = ]       0    .debug_loc
  -2.9% -9.48Ki  [ = ]       0    .debug_info
  -0.7% -7.22Ki   +26% +7.37Ki    TOTAL

use_rust/rp2040_split

   text	   data	    bss	    dec	    hex	filename
 148668	      0	  16100	 164768	  283a0	central

   text	   data	    bss	    dec	    hex	filename
  34508	      0	   3440	  37948	   943c	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +4.8% +5.90Ki  +4.8% +5.90Ki    .text
  +3.0% +3.17Ki  [ = ]       0    .strtab
  +0.3%    +539  [ = ]       0    .debug_line
  +0.9%    +152  [ = ]       0    .debug_aranges
  +0.4%     +30  [ = ]       0    .debug_abbrev
 -11.5%      -7  [ = ]       0    [Unmapped]
  -2.9%     -11  [ = ]       0    .defmt
  -0.0%     -16  [ = ]       0    .symtab
  -1.5%    -268  [ = ]       0    .debug_frame
  [ = ]       0  -3.3%    -512    .bss
  -1.7% -1.38Ki  [ = ]       0    .debug_ranges
 -10.3% -1.95Ki -10.4% -1.95Ki    .rodata
  -1.8% -5.33Ki  [ = ]       0    .debug_loc
  -0.6% -7.96Ki  [ = ]       0    .debug_str
  -1.8% -18.0Ki  [ = ]       0    .debug_info
  -0.8% -25.1Ki  +2.2% +3.45Ki    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +35% +7.39Ki   +35% +7.39Ki    .text
   +17% +4.27Ki  [ = ]       0    .strtab
  +2.1% +1.24Ki  [ = ]       0    .debug_line
  [ = ]       0   +12%    +256    .bss
  +1.3%    +168  [ = ]       0    .debug_aranges
  +1.0%     +96  [ = ]       0    .symtab
  -4.8%      -7  [ = ]       0    .defmt
 -23.3%     -10  [ = ]       0    [Unmapped]
  -2.1%    -116  [ = ]       0    .debug_frame
  -3.2%    -188  [ = ]       0    .debug_abbrev
  -3.9%    -200  -3.9%    -200    .rodata
  -8.3% -1.22Ki  [ = ]       0    .debug_ranges
  -0.4% -2.21Ki  [ = ]       0    .debug_str
 -10.6% -5.67Ki  [ = ]       0    .debug_loc
  -2.7% -9.14Ki  [ = ]       0    .debug_info
  -0.5% -5.59Ki   +25% +7.44Ki    TOTAL

use_config/stm32f1

   text	   data	    bss	    dec	    hex	filename
  51108	     24	   6832	  57964	   e26c	rmk-stm32f1
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +2.8% +13.0Ki  [ = ]       0    .debug_info
  +1.0% +5.82Ki  [ = ]       0    .debug_str
  +1.0%   +1022  [ = ]       0    .debug_loc
  +2.3%    +832  [ = ]       0    .debug_ranges
   +10%     +88   +11%     +88    .rodata
 -14.8%      -9  [ = ]       0    [Unmapped]
  -2.7%    -160  [ = ]       0    .debug_aranges
  -0.4%    -362  [ = ]       0    .debug_line
  -3.4%    -388  [ = ]       0    .debug_frame
  -1.3%    -684  -1.4%    -684    .text
  -4.1%    -736  [ = ]       0    .symtab
  [ = ]       0 -10.3%    -784    .bss
  -3.2%    -920  [ = ]       0    .strtab
  +1.2% +17.5Ki  -2.3% -1.35Ki    TOTAL

use_config/stm32f4

   text	   data	    bss	    dec	    hex	filename
 141340	    320	  16360	 158020	  26944	rmk-stm32f4
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +7.64Ki  [ = ]       0    .debug_str
  +6.5% +7.39Ki  +6.5% +7.39Ki    .text
  +2.5% +2.69Ki  [ = ]       0    .strtab
  +0.7% +1.17Ki  [ = ]       0    .debug_line
  +0.2%     +48  [ = ]       0    .debug_aranges
  +8.0%      +4  [ = ]       0    [Unmapped]
  -2.7%     -11  [ = ]       0    .defmt
  -0.2%     -16  [ = ]       0    .debug_abbrev
  -2.4%    -508  [ = ]       0    .debug_frame
  [ = ]       0  -3.3%    -520    .bss
  -0.7%    -560  [ = ]       0    .debug_ranges
  -3.1% -1.22Ki  [ = ]       0    .symtab
 -10.7% -1.96Ki -10.7% -1.96Ki    .rodata
  -1.6% -3.53Ki  [ = ]       0    .debug_loc
  -1.7% -16.7Ki  [ = ]       0    .debug_info
  -0.2% -5.52Ki  +3.3% +4.93Ki    TOTAL

use_config/stm32h7

   text	   data	    bss	    dec	    hex	filename
 126928	    264	  15552	 142744	  22d98	rmk-stm32h7
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +21%  +355Ki  [ = ]       0    .debug_str
   +28%  +239Ki  [ = ]       0    .debug_info
   +38% +59.7Ki  [ = ]       0    .debug_loc
   +29% +34.7Ki  [ = ]       0    .debug_line
   +37% +28.8Ki   +37% +28.8Ki    .text
   +44% +25.1Ki  [ = ]       0    .debug_ranges
   +44% +23.3Ki  [ = ]       0    .strtab
   +32% +8.50Ki  [ = ]       0    .symtab
   +15% +4.62Ki  [ = ]       0    .debug_aranges
  [ = ]       0   +41% +4.45Ki    .bss
   +30% +4.37Ki  [ = ]       0    .debug_frame
   +14% +1.94Ki   +14% +1.94Ki    .rodata
  +5.0%    +319  [ = ]       0    .debug_abbrev
   +38%     +59  [ = ]       0    .defmt
   +56%     +19  [ = ]       0    [Unmapped]
   +25%  +786Ki   +34% +35.2Ki    TOTAL

@Schievel1 Schievel1 changed the title add PMW3360 driver feat: PMW3360 input device Dec 28, 2025
@Schievel1
Copy link
Contributor Author

This builds on NRF52xy, STM32 and RP2040 at least. I am lacking hardware right now to test out if the sensor really works on the NRF52 chips and STM32.

@Schievel1 Schievel1 changed the title feat: PMW3360 input device feat: PMW3360 and PMW3389 input devices Dec 31, 2025
@Schievel1
Copy link
Contributor Author

@whitelynx Maybe you can test the PMW3389 support when your mouse is ready. I am lacking the hardware and that sensor is too expensive for me to buy it just to test that out.

Schievel1 added a commit to Schievel1/rmk-template that referenced this pull request Dec 31, 2025
See also HaoboGu/rmk#689

Using BlockingAsync for the PMW33xx sensors requires the dependency
Schievel1 added a commit to Schievel1/rmk-template that referenced this pull request Dec 31, 2025
See also HaoboGu/rmk#689

Using BlockingAsync for the PMW33xx sensors requires the dependency
@Schievel1
Copy link
Contributor Author

Schievel1 commented Jan 1, 2026

I think the PointingDevices should be able to set the resolution and rotational transform angle at runtime.

For this I would implement Controller for the PointingDevice, and the new functions of PointingDevice would require an ID for the sensor.

Then I would like to add to the keyboardevents(?) the event Keyboardevents::PointingSetResolution((u8, i16)).
The u8 being the ID, the i16 the desired resolution.

Is this the best way to do it? I'm not sure if this should be in keyboardevents or if pointing devices should get their own events enum.

@HaoboGu
Copy link
Owner

HaoboGu commented Jan 1, 2026

I think the PointingDevices should be able to set the resolution and rotational transform angle at runtime.

For this I would implement Controller for the PointingDevice, and the new functions of PointingDevice would require an ID for the sensor.

Then I would like to add to the keyboardevents(?) the event Keyboardevents::PointingSetResolution((u8, i16)). The u8 being the ID, the i16 the desired resolution.

Is this the best way to do it? I'm not sure if this should be in keyboardevents or if pointing devices should get their own events enum.

Yeah, the simplest way is to add a PointingSetResolution(u8, i16) variant to ControllerEvent.

I think it still needs some design. The main issues of the current event system are

  1. Now once a variant of ControllerEvent is added, it exists even no subscriber uses it at all, ideally in the enum only the variant which will be consumed exists
  2. If users don't want to modify RMK source code, now there's no way to make runtime change of a device/processor/controller
  3. Now there's no id for controllers, and the published events have no id too

@Schievel1
Copy link
Contributor Author

I solved the ID thing, at least for Pointing devices, and with your other PR we solve the thing with custom processors.
For the first point I have no idea how you could solve this. Other than Feature mess. But is it really a big problem not all variants of the enum are used?

@HaoboGu
Copy link
Owner

HaoboGu commented Jan 2, 2026

It isn't a big problem, it's just not very elegant -- having unnecessary variants wastes some RAM

I'm thinking about introducing some feature gates, but if we want users to add their own event, the current event enum should be revised maybe?

HaoboGu pushed a commit to HaoboGu/rmk-template that referenced this pull request Jan 3, 2026
See also HaoboGu/rmk#689

Using BlockingAsync for the PMW33xx sensors requires the dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants