|
|
|
@ -366,6 +366,33 @@ void sprocess(void)
|
|
|
|
|
sdelay = 100 + (rand() & 0x1F);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void emessage(void)
|
|
|
|
|
{
|
|
|
|
|
uint8_t blocksize;
|
|
|
|
|
uint8_t blocknum;
|
|
|
|
|
uint8_t b,i;
|
|
|
|
|
|
|
|
|
|
blocksize = rmessage[3];
|
|
|
|
|
blocknum = rmessage[4];
|
|
|
|
|
|
|
|
|
|
slen = 4 + blocknum / 8;
|
|
|
|
|
if(blocknum % 8) slen++;
|
|
|
|
|
memset(smessage,0,slen);
|
|
|
|
|
smessage[0] = 'e';
|
|
|
|
|
smessage[1] = rmessage[1];;
|
|
|
|
|
smessage[2] = rmessage[2];;
|
|
|
|
|
smessage[3] = rmessage[3];;
|
|
|
|
|
|
|
|
|
|
for(b = 0; b <= blocknum; b++) {
|
|
|
|
|
for(i = 0; i < blocksize; i++) {
|
|
|
|
|
if(eeprom_read_byte((const uint8_t *)(b * blocksize + i)) != 0xFF) {
|
|
|
|
|
smessage[4 + b / 8] |= (1 << b % 8);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rprocess(void)
|
|
|
|
|
{
|
|
|
|
|
uint8_t seq,i;
|
|
|
|
@ -477,6 +504,23 @@ static void rprocess(void)
|
|
|
|
|
sctl = 0x19 | (seq << 5);
|
|
|
|
|
sendmsg();
|
|
|
|
|
break;
|
|
|
|
|
case 'K':
|
|
|
|
|
case 0xCB:
|
|
|
|
|
if (rlen != 4)
|
|
|
|
|
return;
|
|
|
|
|
hbw_receive_key(rmessage[2], rmessage[3] >> 2, rmessage[3] & 0x3);
|
|
|
|
|
slen = 0;
|
|
|
|
|
sctl = 0x19 | (seq << 5);
|
|
|
|
|
sendmsg();
|
|
|
|
|
break;
|
|
|
|
|
case 'E':
|
|
|
|
|
if (rlen != 4)
|
|
|
|
|
return;
|
|
|
|
|
emessage();
|
|
|
|
|
seq = (rctl >> 1) & 3;
|
|
|
|
|
sctl = 0x18 | (seq << 5);
|
|
|
|
|
sendmsg();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((rdest == 0xFFFFFFFF) &&
|
|
|
|
|