Simplify more, working with reportId
Signed-off-by: fly <merspieler@alwaysdata.com>
This commit is contained in:
parent
42eca6a0ef
commit
971b151d03
2 changed files with 6 additions and 5 deletions
|
@ -19,6 +19,7 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
|
||||||
0x05, 0x01, // UsagePage(Generic Desktop[0x0001])
|
0x05, 0x01, // UsagePage(Generic Desktop[0x0001])
|
||||||
0x09, 0x04, // UsageId(Joystick[0x0004])
|
0x09, 0x04, // UsageId(Joystick[0x0004])
|
||||||
0xA1, 0x01, // Collection(Application)
|
0xA1, 0x01, // Collection(Application)
|
||||||
|
0x85, 0x01, // ReportId(1)
|
||||||
0x09, 0x01, // UsageId(Pointer[0x0001])
|
0x09, 0x01, // UsageId(Pointer[0x0001])
|
||||||
0xA1, 0x00, // Collection(Physical)
|
0xA1, 0x00, // Collection(Physical)
|
||||||
0x09, 0x30, // UsageId(X[0x0030])
|
0x09, 0x30, // UsageId(X[0x0030])
|
||||||
|
@ -49,12 +50,12 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
|
||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
||||||
#[packed_struct(endian = "lsb", size_bytes = "6")]
|
#[packed_struct(endian = "lsb", size_bytes = "8")]
|
||||||
pub struct CustomInputReport {
|
pub struct CustomInputReport {
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
pub x: u16,
|
pub report_id: u8,
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
pub y: u16,
|
pub axis: [u16; 2],
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
pub buttons: u16,
|
pub buttons: u16,
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,8 +253,8 @@ fn get_report(pins: &mut MyPins, adc1: &mut adc::Adc<pac::ADC1>, cal: &Calibrati
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomInputReport {
|
CustomInputReport {
|
||||||
x: values_norm[0],
|
report_id: 1,
|
||||||
y: values_norm[1],
|
axis: values_norm,
|
||||||
buttons,
|
buttons,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue