Project

General

Profile

Revision 382

report changes

View differences:

proj/doc/report/report.tex
217 217
Configuration of the UART was made using the functions \texttt{graph\_init} and \texttt{graph\_cleanup} developed during the project. Drawing to the buffer is made primarily through the functions \texttt{graph\_get\_XRes}, \linebreak \texttt{graph\_get\_YRes}, \texttt{graph\_set\_pixel}, \texttt{graph\_clear\_screen} and \texttt{graph\_draw}.\par
218 218
Basic sprites are constructed from small XPM files, or loaded at runtime from XPM2 files. A XPM2 file is a XPM file stripped from all the C syntax, leaving only the strings. This format is easier to load at runtime than XPM. A XPM file can be easily converted to a XPM2 file using the function \texttt{xpm\_save\_as\_xpm2}. All XPM arrays of strings are loaded to bitmaps using the function \texttt{xpm\_load} provided by the LCF.
219 219
\subsection{Real-Time Clock (RTC)}
220
The RTC was configured to poll the UIP (update in progress) bit of Register A, to check if any updates are occurring. While the the UIP bit is set, no reading operation over the registers containing the date and time information is done. As soon as the UIP bit has value zero, the reading operation will then be done.\par
221
The RTC is used to obtain the date and time the high-scores were obtained for the game-modes.
220
The RTC was configured to issue interrupts and if the interrupt source is an Update Event, in which the bit 4 of Register C will be set, then the values of time will be updated by reading their registers.\par
221
The date isn't updated unless asked, this is, on the interrupt notification the date isn't updated, and the reading process is different from the time. If it's asked to read the date then the date registers will be read two consecutive times, and will repeat the process if the date values of consecutive readings isn't equal, this ensures the values read are correct in case any update occurs. These updates aren't as frequent as the time values so there's no need to update it every second.\par
222
To manage RTC interrupt subscription, function \texttt{subscribe\_rtc\_interrupt} was implemented. In order to enable the Update Event Interrupts, the function \texttt{rtc\_set\_updates\_int} that enables or disables the Update Events interrupts by writing to bit 4 of register B. To manage mouse interrupts, function \texttt{rtc\_ih} was implemented, that verifies if the source if from an Update Event by reading register C and verifying bit 4 and if so updates the time values (seconds, minutes and hours). To ease the process of reading and writing values to the RTC, functions \texttt{rtc\_read\_register} and \texttt{rtc\_write\_register} were implemented as general functions, while having specific functions for reading the date and time values, such as \texttt{rtc\_read\_min} among others, that use the general functions cited above.\par
223
The RTC is used to obtain date and time for the scoreboards on the game-modes.
222 224

  
223 225
\subsection{Serial port}
224 226
The UART was configured to issue interrupts for Receiver Ready and Transmitter Empty. Communication is processed with the same parameters at both ends, at a bit-rate of 115200bps, 8 bits per char, 2 stop bits. UART FIFOs are not used. The protocols that were developed will be discussed in section \ref{sec:details}. \par
proj/src/project/src/proj.c
375 375
                            shoot_bullet(shooter2, bullet_list, bsp_bullet);
376 376
                            bullet_info->new_bullet = false;
377 377
                        }
378
                            printf("Reach1\n");
378 379
                        break;
379
                            printf("Reach1\n");
380 380
                }
381 381
            }
382 382
        }

Also available in: Unified diff