Simplify more, working with reportId

Signed-off-by: fly <merspieler@alwaysdata.com>
This commit is contained in:
fly 2024-05-14 10:33:37 +02:00
parent 42eca6a0ef
commit 971b151d03
2 changed files with 6 additions and 5 deletions

View file

@ -19,6 +19,7 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
0x05, 0x01, // UsagePage(Generic Desktop[0x0001])
0x09, 0x04, // UsageId(Joystick[0x0004])
0xA1, 0x01, // Collection(Application)
0x85, 0x01, // ReportId(1)
0x09, 0x01, // UsageId(Pointer[0x0001])
0xA1, 0x00, // Collection(Physical)
0x09, 0x30, // UsageId(X[0x0030])
@ -49,12 +50,12 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
];
#[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 {
#[packed_field]
pub x: u16,
pub report_id: u8,
#[packed_field]
pub y: u16,
pub axis: [u16; 2],
#[packed_field]
pub buttons: u16,
}

View file

@ -253,8 +253,8 @@ fn get_report(pins: &mut MyPins, adc1: &mut adc::Adc<pac::ADC1>, cal: &Calibrati
}
CustomInputReport {
x: values_norm[0],
y: values_norm[1],
report_id: 1,
axis: values_norm,
buttons,
}
}