Fix warnings and errors found by the new cppcheck provided static code analysis.
This commit is contained in:
parent
b762780343
commit
bb85d083a7
7 changed files with 23 additions and 29 deletions
|
@ -40,7 +40,7 @@ struct
|
|||
|
||||
bool ProgrammerConfig_ProcessConfiguration(void)
|
||||
{
|
||||
memset(&ProgrammerConfig, sizeof(ProgrammerConfig), 0x00);
|
||||
memset(&ProgrammerConfig, 0x00, sizeof(ProgrammerConfig));
|
||||
|
||||
if (!(pf_open("CONF.txt") == FR_OK))
|
||||
{
|
||||
|
@ -61,8 +61,8 @@ bool ProgrammerConfig_ProcessConfiguration(void)
|
|||
&ProgrammerConfig.SigBytes[1],
|
||||
&ProgrammerConfig.SigBytes[2],
|
||||
&ProgrammerConfig.SigBytes[3]);
|
||||
|
||||
sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
|
||||
|
||||
sscanf(CurrentLine, "SPEED = %08lu", &ProgrammerConfig.ProgrammingSpeed);
|
||||
}
|
||||
} while (CurrentLine);
|
||||
|
||||
|
|
|
@ -114,18 +114,15 @@ int main(void)
|
|||
{
|
||||
Programmer_Task();
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
if (USB_CurrentMode == USB_MODE_Host)
|
||||
{
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
DiskHost_USBTask();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
DiskDevice_USBTask();
|
||||
#endif
|
||||
}
|
||||
DiskHost_USBTask();
|
||||
#endif
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
if (USB_CurrentMode == USB_MODE_Device)
|
||||
DiskDevice_USBTask();
|
||||
#endif
|
||||
|
||||
USB_USBTask();
|
||||
}
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
|
||||
bool DS1307_SetTimeDate(const TimeDate_t* NewTimeDate)
|
||||
{
|
||||
#if defined(DUMMY_RTC)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if !defined(DUMMY_RTC)
|
||||
DS1307_DateTimeRegs_t NewRegValues;
|
||||
const uint8_t WriteAddress = 0;
|
||||
|
||||
|
@ -41,6 +38,7 @@ bool DS1307_SetTimeDate(const TimeDate_t* NewTimeDate)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -55,10 +53,7 @@ bool DS1307_GetTimeDate(TimeDate_t* const TimeDate)
|
|||
TimeDate->Day = 1;
|
||||
TimeDate->Month = 1;
|
||||
TimeDate->Year = 1;
|
||||
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#else
|
||||
DS1307_DateTimeRegs_t CurrentRegValues;
|
||||
const uint8_t ReadAddress = 0;
|
||||
|
||||
|
@ -78,6 +73,7 @@ bool DS1307_GetTimeDate(TimeDate_t* const TimeDate)
|
|||
TimeDate->Day = (CurrentRegValues.Byte5.Fields.TenDay * 10) + CurrentRegValues.Byte5.Fields.Day;
|
||||
TimeDate->Month = (CurrentRegValues.Byte6.Fields.TenMonth * 10) + CurrentRegValues.Byte6.Fields.Month;
|
||||
TimeDate->Year = (CurrentRegValues.Byte7.Fields.TenYear * 10) + CurrentRegValues.Byte7.Fields.Year;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue