Hi,
May be I write not the appropriate syntax but this snippet of code don't ReIndent well.
May be I write not the appropriate syntax but this snippet of code don't ReIndent well.
Code: Select all
void NetRxChar(void)
{
static ushort State;
static ushort Qte;
static ushort CheckSum;
static ushort *Ptr;
static ushort Ack;
static ushort InChar;
InChar = NET_UDR;
switch (State)
{
case RESET :
if (InChar == '>') State = START1;
else State = RESET;
break;
case START1 :
if (InChar == '>') State = START2;
else State = RESET;
break;
case START2 :
if (InChar == '>') State = NODEID;
else State = RESET;
break;
case NODEID :
if (InChar == NetAddress) {State = QTE; Ack = TRUE;}
else if (InChar == BROADCASTACK) {State = QTE; Ack = TRUE;}
else if (InChar == BROADCASTNOACK) {State = QTE; Ack = FALSE;}
else if (InChar == BROADCASTDEVTYPE) {State = QTE; Ack = FALSE;}
else State = RESET;
break;
case QTE :
Qte = InChar;
CheckSum = 0;
Ptr = &NetRxData[0];
State = DATA;
break;
case DATA :
*Ptr = InChar;
CheckSum = CheckSum + *Ptr++;
if (Ptr > &NetRxData[NET_RXBUFFER]) State = RESET;
Qte--;
if (Qte == 0) State = CHECKSUM;
break;
case CHECKSUM :
if ((InChar==CheckSum)&&(Ack==TRUE)) NetNextEvent(&NetSendACK);
if ((InChar==CheckSum)&&(Ack==FALSE))NetNextEvent(&NetAnalyseData);
*Ptr++ = 0x00;
State = RESET;
break;
default :
State = RESET;
}
InChar = 0;
}