Dear Sir,
I use hid_host example in KW40Z_Connectivity_Software_1.0.1
(C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\examples\bluetooth\hid_host).
I change the serial interface type from UART to I2C.
I find some the code in the function void shell_writeN(); in shell.c(Line237).
if( SHELL_IO_TYPE == gSerialMgrIICSlave_c ||
SHELL_IO_TYPE == gSerialMgrSPISlave_c )
{
uint8_t *pHdr = MEM_BufferAlloc(n+5);
if(pHdr)
{
pHdr[0] = 0x02;
pHdr[1] = 0x77;
pHdr[2] = 0x77;
pHdr[3] = n;
FLib_MemCpy(&pHdr[4], pBuff, n);
pHdr[4+n] = 0;
Serial_SyncWrite( gShellSerMgrIf, pHdr, n+5 );
MEM_BufferFree(pHdr);
}
}
else
{
Serial_SyncWrite(gShellSerMgrIf, (uint8_t*)pBuff, n);
}
If the type is I2C or SPI, there are 0x02, 0x77, 0x77, n(length) at the beginning , and 0 at the end of the message.
Why to define the value 0x02, 0x77,0x77, length? Could you explain it?
Thanks.
BR,
Sean Wu