Got mouse coords working with iOS peripheral

This commit is contained in:
Adam Greenwood-Byrne 2021-03-28 16:57:45 +01:00
parent 2c10af666b
commit 50a3b2fb7a

View file

@ -163,17 +163,17 @@ void acl_poll()
unsigned char d2 = bt_waitReadByte(); unsigned char d2 = bt_waitReadByte();
unsigned int dlen = d1 | (d2 << 8); unsigned int dlen = d1 | (d2 << 8);
if (dlen > 7) {
unsigned char data[dlen]; unsigned char data[dlen];
for (int i=0;i<dlen;i++) data[i] = bt_waitReadByte(); for (int i=0;i<dlen;i++) data[i] = bt_waitReadByte();
if (dlen > 7) {
unsigned int length = data[0] | (data[1] << 8); unsigned int length = data[0] | (data[1] << 8);
unsigned int channel = data[2] | (data[3] << 8); unsigned int channel = data[2] | (data[3] << 8);
unsigned char opcode = data[4]; unsigned char opcode = data[4];
if (thandle == connection_handle && opcode == 0x1b) { if (thandle == connection_handle && opcode == 0x1b) {
if (channel == 4 && data[5] == 0x2a && data[6] == 0x00) { if (channel == 4 && data[5] == 0x3b && data[6] == 0x00) {
if (length == 7) msetxy(data[7] | (data[8] << 8), data[9] | (data[10] << 8)); if (length == 7) msetxy(data[7] | (data[8] << 8), data[9] | (data[10] << 8));
if (length == 5) msetbut(data[7], data[8]); if (length == 5) msetbut(data[7], data[8]);
} }