mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
add unit test for crsfFrameCmdCRC
This commit is contained in:
parent
e24d55f0a7
commit
565f23074f
1 changed files with 15 additions and 0 deletions
|
@ -45,6 +45,7 @@ extern "C" {
|
||||||
|
|
||||||
void crsfDataReceive(uint16_t c);
|
void crsfDataReceive(uint16_t c);
|
||||||
uint8_t crsfFrameCRC(void);
|
uint8_t crsfFrameCRC(void);
|
||||||
|
uint8_t crsfFrameCmdCRC(void);
|
||||||
uint8_t crsfFrameStatus(void);
|
uint8_t crsfFrameStatus(void);
|
||||||
uint16_t crsfReadRawRC(const rxRuntimeState_t *rxRuntimeState, uint8_t chan);
|
uint16_t crsfReadRawRC(const rxRuntimeState_t *rxRuntimeState, uint8_t chan);
|
||||||
|
|
||||||
|
@ -140,6 +141,20 @@ TEST(CrossFireTest, TestCrsfFrameStatus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t buadrateNegotiationFrame[] = {
|
||||||
|
0xC8,0x0C,0x32,0xC8,0xEC,0x0A,0x70,0x01,0x00,0x1E,0x84,0x80,0x22,0x72
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(CrossFireTest, TestCrsfCmdFrameCrc)
|
||||||
|
{
|
||||||
|
crsfFrame = *(const crsfFrame_t*)buadrateNegotiationFrame;
|
||||||
|
crsfFrameDone = true;
|
||||||
|
const uint8_t crsfCmdFrameCrc = crsfFrameCmdCRC();
|
||||||
|
const uint8_t crsfFrameCrc = crsfFrameCRC();
|
||||||
|
EXPECT_EQ(crsfCmdFrameCrc, crsfFrame.frame.payload[crsfFrame.frame.frameLength - CRSF_FRAME_LENGTH_ADDRESS - CRSF_FRAME_LENGTH_FRAMELENGTH - 1]);
|
||||||
|
EXPECT_EQ(crsfFrameCrc, crsfFrame.frame.payload[crsfFrame.frame.frameLength - CRSF_FRAME_LENGTH_ADDRESS - CRSF_FRAME_LENGTH_FRAMELENGTH]);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Frame is of form
|
* Frame is of form
|
||||||
* <Device address> <Frame length> < Type> <Payload> < CRC>
|
* <Device address> <Frame length> < Type> <Payload> < CRC>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue