rumcake

Trait rumcake::via::ViaKeyboard

source ·
pub trait ViaKeyboard {
    type Layout: KeyboardLayout;
    type StorageType: StorageDevice = EmptyStorageDevice;

    const VIA_ENABLED: bool = true;
    const VIA_FIRMWARE_VERSION: u32 = 1u32;
    const VIA_EEPROM_LAYOUT_OPTIONS_SIZE: usize = 1usize;
    const VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT: u32 = 0u32;
    const DYNAMIC_KEYMAP_LAYER_COUNT: usize = <Self::Layout>::LAYERS;
    const DYNAMIC_KEYMAP_MACRO_COUNT: u8 = 0u8;
    const DYNAMIC_KEYMAP_MACRO_BUFFER_SIZE: u16 = 0u16;
    const BACKLIGHT_TYPE: Option<BacklightType> = None;

    // Provided methods
    fn get_storage_service(
    ) -> Option<&'static StorageService<'static, <Self::StorageType as StorageDevice>::FlashStorageType, Self::StorageType>>
       where [(); <<Self::StorageType as StorageDevice>::FlashStorageType as
                 FlashStorage>::ERASE_SIZE]: { ... }
    fn get_macro_buffer(
    ) -> Option<&'static mut MacroBuffer<'static, { _ }, { _ }>> { ... }
    fn handle_via_command(data: &mut [u8]) -> bool { ... }
    fn handle_set_layout_options(updated_layout: u32) { ... }
    fn handle_custom_value_command(data: &mut [u8], _len: u8) { ... }
}
Expand description

A trait that keyboards must implement to use the Via protocol.

Required Associated Types§

source

type Layout: KeyboardLayout

The layout that this Via instance will control.

Provided Associated Types§

source

type StorageType: StorageDevice = EmptyStorageDevice

The storage device used to store Via data.

Provided Associated Constants§

source

const VIA_ENABLED: bool = true

source

const VIA_FIRMWARE_VERSION: u32 = 1u32

Version of your firmware.

source

const VIA_EEPROM_LAYOUT_OPTIONS_SIZE: usize = 1usize

How many bytes are needed to represent the number of possible layout options for your keyboard.

source

const VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT: u32 = 0u32

The default layout option to use for your keyboard in the Via app.

source

const DYNAMIC_KEYMAP_LAYER_COUNT: usize = <Self::Layout>::LAYERS

The number of layers that you can modify in the Via app. This number must be equal to or less than the number of layers in your keyberon layout, KeyboardLayout::LAYERS.

source

const DYNAMIC_KEYMAP_MACRO_COUNT: u8 = 0u8

The number of macros that your keyboard can store. You should use setup_macro_buffer to implement this. If you plan on using macros, this should be non-zero.

source

const DYNAMIC_KEYMAP_MACRO_BUFFER_SIZE: u16 = 0u16

The total amount of bytes that can be used to store macros assigned by Via. You should use setup_macro_buffer to implement this. If you plan on using macros, this should be non-zero.

source

const BACKLIGHT_TYPE: Option<BacklightType> = None

Determines how QK_BACKLIGHT keycodes should be converted to a crate::keyboard::Keycode and vice versa. If this is None, then backlighting keycodes will not be converted.

Provided Methods§

source

fn get_storage_service( ) -> Option<&'static StorageService<'static, <Self::StorageType as StorageDevice>::FlashStorageType, Self::StorageType>>

source

fn get_macro_buffer() -> Option<&'static mut MacroBuffer<'static, { _ }, { _ }>>

Obtain a reference to macro data created by Via. You should use setup_macro_buffer to implement this. If this returns Some, then ViaKeyboard::DYNAMIC_KEYMAP_MACRO_COUNT and ViaKeyboard::DYNAMIC_KEYMAP_MACRO_BUFFER_SIZE should be non-zero. Otherwise, ViaKeyboard::DYNAMIC_KEYMAP_MACRO_COUNT should be 0.

source

fn handle_via_command(data: &mut [u8]) -> bool

Override for handling a Via/Vial protocol packet.

Returning true indicates that a command is fully handled, so the Via/Vial task will not continue to process the data. Returning false will let the Via task continue to process the data, using the usual protocol. You should not send the data to the host using this method. Responses to the host are automatically handled by the Via/Vial task.

source

fn handle_set_layout_options(updated_layout: u32)

Optional handler that allows you to handle changes to the current layout options setting.

source

fn handle_custom_value_command(data: &mut [u8], _len: u8)

Optional handler that you can use to handle custom UI channel commands. See https://www.caniusevia.com/docs/custom_ui. This is currently only applicable to Via, not Vial.

This is called if the Via protocol is unable to handle a custom channel command. The current Via protocol implementation handles lighting (rgblight/underglow, backlight/simple-backlight, led_matrix/simple-backlight-matrix, rgb_matrix/rgb-backlight-matrix) channels.

Object Safety§

This trait is not object safe.

Implementors§