Tool/software:
Moving from Motor Control SDK 5.02 to 5.03, and I saw that the SPI_setcharLength function has a new check in it. What is the purpose for the new "bool originalStatus = ..." line, and then the new if check for that flag before enabling the module. I didn't see a release note or fix note or anything, and have no problem picking it up, I am just puzzled at why it changed. Does it have something to do if we were in the middle of a software reset?
static inline void
SPI_setcharLength(uint32_t base, uint16_t charLength)
{
//
// Check the arguments.
//
ASSERT((charLength >= 1U) && (charLength <= 16U));
bool originalStatus = ((HWREGH(base + SPI_O_CCR) & (SPI_CCR_SPISWRESET))
== SPI_CCR_SPISWRESET );
SPI_disableModule(base);
HWREGH(base + SPI_O_CCR) = (HWREGH(base + SPI_O_CCR) & ~SPI_CCR_SPICHAR_M) |
(charLength - 1U);
//
// Restore original status
//
if(originalStatus){
SPI_enableModule(base);
}
}
Here is a diff between 5.02 and 5.03 for this function: