About 17.4 Question? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.17 Pointers and Arrays (https://forum.misra.org.uk/forumdisplay.php?fid=44) +---- Thread: About 17.4 Question? (/showthread.php?tid=1242) |
About 17.4 Question? - hutry999 - 05-05-2016 I need read some parameters from EEPROM. My Code as below: typedef struct { Uint16 ErrorCode; Uint16 ErrDCVoltage; Uint16 ErrMCUState; Uint8 ErrMotorModeCmd; Uint8 ErrDriveState; Uint16 ErrTorqueCmd; Uint16 ErrTorqueFed; Uint16 ErrSpeedSet; Uint16 ErrSpeed; Uint8 ErrIGBTTemp; Uint8 ErrMotorTemp; Uint16 ErrUd; Uint16 ErrUq; Uint16 ErrIdRef; Uint16 ErrIqRef; Uint16 ErrIdFed; Uint16 ErrIqFed; Uint16 ErrState; Uint8 Err12V; Uint8 Angle; Uint8 AngleInit; Uint8 ErrMCUTemp; Uint16 DC_Cur; }ErrorLog_t; void LoadError(ErrorLog_t* Err,Uint16 Index) { Uint16 i; Uint16 *PrErrLog; PrErrLog = (uint16 *)Err; for(i=0u;iErrorCode = ReadEeprom(0u); Err->ErrDCVoltage = ReadEeprom(1u); Err->ErrMCUState = ReadEeprom(2u); .... if my struct has more than 100 items, What can I do? Re: About 17.4 Question? - dg1980 - 09-05-2016 Can't you do something like this: Code: void LoadError(ErrorLog_t Err[],Uint16 Index) Re: About 17.4 Question? - misra-c - 24-06-2016 There are a number of issues with this example as written.
"MISRA C:2004 Permits Deviation permits for MISRA Compliance" which are available from the "MISRA resources" section of the MISRA forum (http://www.misra.org.uk/forum/viewtopic.php?t=1562). The MISRA working group can not give advice on particular coding design issues. |