AnsweredAssumed Answered

KW40Z_Connectivity_Software_1.0.1 serial interface type

Question asked by seanwu on May 5, 2016
Latest reply on May 16, 2016 by Jorge Antonio Alcala Vazquez

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

Outcomes