I am not a software engineer which means I am not really good at organizing my code, so this task might look very simple for you.
I have a qt c++ application for 32-bit ARM device (with lubuntu). The application contains a window which is used to debug the external custom instruction memory (64 rows of 32-bit instructions) of a different embedded device. I have created a function:
bool memoRead(uint32_t *memoRowData, uint8_t memoRowNumber);
This function reads data stored in a given row.
I want to create a different function which uses the given function to read and display content of 8 rows from the memory. Example: When I call
memoDebug(0);
The output should be data stored in rows 0 to 7, and when I call
memoDebug(1);
The output should be data stored in rows 8 to 15
The obvious way is to create 8 different uint32_t
variables, read each row separately and assign their values to the created 8 different variables and display/print them (which I have already done and succeeded). But I want to use something like array or struct instead and everything inside for loop to improve the code. In the future the memory size might increase significantly (65536 rows, and read 64 rows or more each time instead of 8).
What is the best and most efficient way of organizing my data and how should I use that?
Aucun commentaire:
Enregistrer un commentaire