diff --git a/rmk-macro/src/config/mod.rs b/rmk-macro/src/config/mod.rs index 8dfbdbe1..e4b9ea86 100644 --- a/rmk-macro/src/config/mod.rs +++ b/rmk-macro/src/config/mod.rs @@ -58,7 +58,6 @@ pub enum MatrixType { direct_pin, } -#[allow(unused)] #[derive(Clone, Debug, Default, Deserialize)] pub struct MatrixConfig { #[serde(default)] @@ -176,6 +175,7 @@ pub struct SplitConfig { /// Configurations for each split board /// /// Either ble_addr or serial must be set, but not both. +#[allow(unused)] #[derive(Clone, Debug, Default, Deserialize)] pub struct SplitBoardConfig { /// Row number of the split board @@ -193,7 +193,7 @@ pub struct SplitBoardConfig { /// Matrix config for the split pub matrix: MatrixConfig, /// Input device config for the split - pub input_device: InputDeviceConfig, + pub input_device: Option, } /// Serial port config @@ -238,17 +238,61 @@ fn parse_duration_millis<'de, D: de::Deserializer<'de>>(deserializer: D) -> Resu /// Configurations for input devices /// #[derive(Clone, Debug, Default, Deserialize)] +#[allow(unused)] pub struct InputDeviceConfig { pub encoder: Option>, + pub pointing: Option>, } #[derive(Clone, Debug, Default, Deserialize)] +#[allow(unused)] pub struct EncoderConfig { + // Pin a of the encoder pub pin_a: String, + // Pin b of the encoder pub pin_b: String, - pub pin_btn: Option, + // Press button position in the keyboard matrix + // TODO: direct pin support? + pub btn_pos: Option<(u8, u8)>, + // Resolution pub resolution: Option, pub clockwise_pos: (u8, u8), pub counter_clockwise_pos: (u8, u8), - pub press_pos: Option<(u8, u8)>, } + + +/// Pointing device config +#[derive(Clone, Debug, Default, Deserialize)] +#[allow(unused)] +pub struct PointingDeviceConfig { + pub interface: Option, +} + +#[derive(Clone, Debug, Deserialize)] +#[allow(unused)] +pub enum CommunicationProtocol { + I2C(I2cConfig), + SPI(SpiConfig), +} + +/// SPI config +#[derive(Clone, Debug, Default, Deserialize)] +#[allow(unused)] +pub struct SpiConfig { + pub instance: String, + pub sck: String, + pub mosi: String, + pub miso: String, + pub cs: Option, + pub cpi: Option, +} + +/// I2C config +#[derive(Clone, Debug, Default, Deserialize)] +#[allow(unused)] +pub struct I2cConfig { + pub instance: String, + pub sda: String, + pub scl: String, + pub address: u8, +} \ No newline at end of file