I'm currently trying to translate the Crazyflie 2.0 firmware in ADA. Looking deeper in the code, I don't understand this piece of code, located in console.c:
Code: Select all
static const char fullMsg[] = "<F>\n";
// ...
int consolePutchar(int ch)
{
int i;
// ...
if (ch == '\n' || messageToPrint.size >= CRTP_MAX_DATA_SIZE)
{
if (crtpGetFreeTxQueuePackets() == 1)
{
for (i = 0; i < sizeof(fullMsg) && (messageToPrint.size - i) > 0; i++)
{
messageToPrint.data[messageToPrint.size - i] =
(uint8_t)fullMsg[sizeof(fullMsg) - i - 1];
}
}
consoleSendMessage();
}
xSemaphoreGive(synch);
}
return (unsigned char)ch;
}
Could you explain this to me, please?
