<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proj+user1</id>
		<title>Embedded Systems Learning Academy - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proj+user1"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php/Special:Contributions/Proj_user1"/>
		<updated>2026-05-11T10:02:12Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72787</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72787"/>
				<updated>2024-12-19T23:32:20Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   Core gameplay development&lt;br /&gt;
**   Gitlab and integrating all parts of code&lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   Interface LED matrix with SJ2 board and core gameplay&lt;br /&gt;
**   Ensure coding standards&lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   Audio system research and design&lt;br /&gt;
**   Assist on all parts of the project&lt;br /&gt;
*  Navya&lt;br /&gt;
**   MP3 module driver development&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement :&lt;br /&gt;
&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
&lt;br /&gt;
Paddle-Ball Collision Logic :&lt;br /&gt;
&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We extend our heartfelt gratitude to Professor Preet and the ISA for organizing such an outstanding class and setting high standards. Their guidance and expectations continually motivated us to strive for excellence and surpass our own limits.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72786</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72786"/>
				<updated>2024-12-19T23:31:54Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Software Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   Core gameplay development&lt;br /&gt;
**   Gitlab and integrating all parts of code&lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   Interface LED matrix with SJ2 board and core gameplay&lt;br /&gt;
**   Ensure coding standards&lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   Audio system research and design&lt;br /&gt;
**   Assist on all parts of the project&lt;br /&gt;
*  Navya&lt;br /&gt;
**   MP3 module driver development&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We extend our heartfelt gratitude to Professor Preet and the ISA for organizing such an outstanding class and setting high standards. Their guidance and expectations continually motivated us to strive for excellence and surpass our own limits.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72785</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72785"/>
				<updated>2024-12-19T23:31:25Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /*  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   Core gameplay development&lt;br /&gt;
**   Gitlab and integrating all parts of code&lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   Interface LED matrix with SJ2 board and core gameplay&lt;br /&gt;
**   Ensure coding standards&lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   Audio system research and design&lt;br /&gt;
**   Assist on all parts of the project&lt;br /&gt;
*  Navya&lt;br /&gt;
**   MP3 module driver development&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We extend our heartfelt gratitude to Professor Preet and the ISA for organizing such an outstanding class and setting high standards. Their guidance and expectations continually motivated us to strive for excellence and surpass our own limits.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72783</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72783"/>
				<updated>2024-12-19T23:30:31Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   Core gameplay development&lt;br /&gt;
**   Gitlab and integrating all parts of code&lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   Interface LED matrix with SJ2 board and core gameplay&lt;br /&gt;
**   Ensure coding standards&lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   Audio system research and design&lt;br /&gt;
**   Assist on all parts of the project&lt;br /&gt;
*  Navya&lt;br /&gt;
**   MP3 module driver development&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We extend our heartfelt gratitude to Professor Preet and the ISA for organizing such an outstanding class and setting high standards. Their guidance and expectations continually motivated us to strive for excellence and surpass our own limits.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72777</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72777"/>
				<updated>2024-12-19T23:20:32Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Acknowledgement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sure! Here is the updated table with your provided data in the requested format:&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We extend our heartfelt gratitude to Professor Preet and the ISA for organizing such an outstanding class and setting high standards. Their guidance and expectations continually motivated us to strive for excellence and surpass our own limits.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72776</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72776"/>
				<updated>2024-12-19T23:19:37Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Parts List &amp;amp; Cost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sure! Here is the updated table with your provided data in the requested format:&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| # &lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| SJ2 Board&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Waveshare 64x64 4096 Pixels RGB Full-Color LED Matrix Panel&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $43.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HiLetgo GD3300&lt;br /&gt;
| Amazon&lt;br /&gt;
| 1&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| SPST Normal Open ON/Off 2 Pin Round Button&lt;br /&gt;
| Amazon&lt;br /&gt;
| 3&lt;br /&gt;
| $8.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MMA845XQ&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72768</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72768"/>
				<updated>2024-12-19T23:13:31Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sure! Here is the updated table with your provided data in the requested format:&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, gather insights, and discuss with team members  &lt;br /&gt;
* Initial ordering of parts (SJ2 board, 64x64 LED Matrix, GD3300 MP3 module).&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
* 10/21/2024&lt;br /&gt;
* 10/21/2024&lt;br /&gt;
| &lt;br /&gt;
* 10/27/2024&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals.  &lt;br /&gt;
* Identify and select sensors and peripherals.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
* 10/28/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;  &lt;br /&gt;
* Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024  &lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024  &lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.  &lt;br /&gt;
* Develop basic game graphics and user interfaces on LED matrix.  &lt;br /&gt;
* Develop code to control LED matrix based on accelerometer input.  &lt;br /&gt;
* Familiarize with GD3300 MP3 decoder module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
* 11/11/2024&lt;br /&gt;
* 11/11/2024  &lt;br /&gt;
* 11/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
* 11/17/2024  &lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.  &lt;br /&gt;
* Integrate game logic with LED matrix display.  &lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024  &lt;br /&gt;
* 11/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024  &lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Test hardware integration and debug accelerometer-controlled input.  &lt;br /&gt;
* Optimize DMA usage for efficient LED matrix updates.  &lt;br /&gt;
* Validate UART-based communication with GD3300 MP3 module.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
|&lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024  &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024  &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Implement advanced game mechanics (e.g., power-ups, increasing difficulty).  &lt;br /&gt;
* Optimize and fine-tune user experience and interactions.  &lt;br /&gt;
* Test and validate system performance under real-time conditions.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
|&lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024  &lt;br /&gt;
* 12/02/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024  &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Finalize sprite designs and integrate animations with LED matrix.  &lt;br /&gt;
* Conduct system-wide integration testing.  &lt;br /&gt;
* Address edge cases in game logic and audio synchronization.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
|&lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024  &lt;br /&gt;
* 12/09/2024&lt;br /&gt;
|&lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024  &lt;br /&gt;
* 12/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Perform final testing of the complete system, ensuring stability and performance.  &lt;br /&gt;
* Prepare and conduct final demonstrations.  &lt;br /&gt;
* Submit final project code to GitLab and update project documentation and wiki.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;  &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72765</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72765"/>
				<updated>2024-12-19T23:09:21Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72764</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72764"/>
				<updated>2024-12-19T23:07:56Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Prepare for endless bouncing, breaking, and gnome-busting excitement! Jardinaiins reinvents classic brick-breaking gameplay with a delightful twist. Dive into vibrant, garden-themed levels filled with challenging obstacles, quirky gnome antics, and thrilling power-ups. Smash through barriers, outsmart mischievous gnomes, and uncover surprises as you progress in this fun and addictive adventure!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
•  Interface the SJ2 board with the Waveshare 64x64 RGB LED Matrix Panel to display dynamic text, colorful images, and animations. The onboard GPIOs of the SJ2 microcontroller will drive the LED panel, and its chainable design will be utilized to facilitate scalability for larger displays.&lt;br /&gt;
•  Use the MMA845XQ accelerometer onboard the SJ2 board as the player controller, mapping tilt and motion inputs to control animations, select media, or interact with displayed content on the LED matrix.&lt;br /&gt;
•  Integrate the HiLetgo GD3300 UART Control Serial MP3 Music Player Module to enable digital audio output by leveraging the SJ2 board’s UART protocol. The system will send serial commands for operations like play, pause, track selection, and volume control.&lt;br /&gt;
•  Utilize the General Purpose Direct Memory Access (GPDMA) controller on the SJ2 board for memory-to-memory transfers, reducing delays during video buffer updates for the LED matrix.&lt;br /&gt;
•  Leverage the DMA controller's memory-to-peripheral function to minimize frequent I2S interrupts while loading digital audio content to the MP3 module, optimizing system performance.&lt;br /&gt;
•  Implement an SD card peripheral driver on the SJ2 board to facilitate reading and writing of multimedia data, enabling seamless storage and retrieval of audio and visual content for playback and display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Controller&lt;br /&gt;
The accelerometer on the SJ2 board manages paddle movement by sampling the y-axis magnitude 17 times over a 17-millisecond period and calculating the average. This value is capped at a maximum of 700 within a range of 1000. To make it simpler, the tilt value is divided by 31, producing 32 possible readings, which correspond to 5 bits of data. Each time there is a change in magnitude or a button press, the controller transmits a single byte of data to the console. This byte encapsulates all the necessary information for controlling the on-screen paddle. The first two bits indicate button input, with 0 representing no input and 1 indicating input detection. The third bit specifies the tilt direction, where 0 means left and 1 means right. The remaining five bits represent the accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio&lt;br /&gt;
Sound effects are added using MP3 Serial Decoder HiLetgo GD3300, source code was written on our own. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Paddle Movement&lt;br /&gt;
The paddle movement is driven by accelerometer data wirelessly transmitted from the SJ-Two board to the LPC4088 board. This data is mapped to 63 possible positions for the paddle. Initially, the paddle would instantly move to the position corresponding to the accelerometer input. However, this approach was refined by introducing an algorithm that allows for a smoother transition between positions. The algorithm calculates paddle velocity based on the &amp;quot;current desired position&amp;quot; and the previous position. Parameters of the algorithm were fine-tuned iteratively to achieve a smooth and responsive paddle movement.&lt;br /&gt;
Paddle-Ball Collision Logic&lt;br /&gt;
The ball's position is updated each frame by adding delta_x and delta_y to its current x and y coordinates. If the ball's next y-position crosses the paddle's y-position, a paddle collision check is performed. To do this, the ball's movement is modeled as a slope derived from delta_x and delta_y. Using this slope, along with the ball's current position and one pixel above the paddle's y-position, a point-slope equation (y2−y1)=m(x2−x1)(y_2 - y_1) = m(x_2 - x_1)(y2​−y1​)=m(x2​−x1​) is used to calculate the x-position of the ball at the time it reaches that y-coordinate.&lt;br /&gt;
Once the expected collision point is determined, the ball's collision magnitude and its next position's magnitude are calculated. By comparing these magnitudes, a time fraction for the frame is derived to estimate when the ball might have collided with the paddle. Using the paddle's current position and velocity, the paddle's previous position is estimated to determine how far it moved during this time fraction. By multiplying the time fraction by the paddle's x-position change, it is possible to check whether the paddle was underneath the ball at the moment it reached the pixel above the paddle's y-position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Ball-Collision Logic&lt;br /&gt;
The initial ball collision logic relied on pixel values to detect when the ball entered a brick. However, this approach failed to handle cases where the ball entered a brick diagonally, requiring the logic to be completely reworked. In the updated version, the focus shifted to determining whether the ball was crossing into an area containing a brick. This was achieved by dividing the playing field into a grid representing the positions of the bricks.&lt;br /&gt;
The new logic involved an initial check to see if the ball was crossing a boundary near a brick. If the ball crossed only the x-boundary, a collision check was performed to determine if it hit a brick. Similarly, if it crossed only the y-boundary, another collision check was conducted. In cases where the ball crossed both x- and y-boundaries, additional logic was applied to determine which boundary the ball crossed first. This updated method effectively handled diagonal collisions and improved the overall accuracy of the collision detection.&lt;br /&gt;
This experience highlighted the value of abandoning ineffective solutions and adopting new approaches, as they can lead to better outcomes.&lt;br /&gt;
Paddle Movement&lt;br /&gt;
We encountered an issue where the paddle would slow down as it neared the walls. This happened because the difference between the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position decreased near the walls, resulting in a reduced paddle velocity. To address this, we adjusted the logic so that whenever the accelerometer data mapped to the minimum or maximum paddle index, the &amp;quot;current desired paddle position&amp;quot; was extended. This adjustment ensured that the paddle velocity remained consistent, preventing the paddle from slowing down as it approached the walls.&lt;br /&gt;
Paddle – Collision Logic&lt;br /&gt;
During final integration and testing, one major issue we faced was a bug where the ball failed to detect collisions with the paddle, causing it to pass through instead of bouncing off. To troubleshoot this, we implemented a clever debugging method: changing the ball's colour during each collision check. This allowed us to visually confirm whether the collision logic was being executed. Through this approach, we discovered that the section of code responsible for checking paddle collisions was being skipped, even when the ball's next y-position had crossed the paddle's y-position. This debugging method proved invaluable in identifying and resolving the root cause of the issue.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We thoroughly enjoyed the process of creating this project and gained a wealth of knowledge along the way. Our driver development skills were sharpened as we wrote drivers for various modules, including the LED matrix and MP3 decoder. Additionally, our understanding of the FreeRTOS API deepened, and we acquired fundamental game and graphics development skills through our work with the LED matrix.&lt;br /&gt;
Throughout the project, we faced numerous challenges, such as getting the LED matrix driver to function properly, implementing collision detection with multiple game objects, and designing and maintaining a complex game logic state machine, among many others. Each obstacle provided valuable learning experiences and contributed to our growth as developers. By applying design principles and communication protocols learned in lectures, we successfully brought this project to life. Key concepts we utilized include UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes, binary semaphores, queues, task creation, stack sizing, task scheduling, interrupt service routines, and bootloaders.&lt;br /&gt;
Through countless hours of testing and verification, we learned the critical importance of allocating sufficient time for integration and debugging, as it greatly increases the likelihood of a successful outcome. Without this phase, the project might have faced significant issues upon delivery. We hope this project serves as a helpful resource for future engineers and wish you all great success and enjoyable development experiences ahead!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72587</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72587"/>
				<updated>2024-11-26T22:38:44Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72586</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72586"/>
				<updated>2024-11-26T22:36:09Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Abstract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72585</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72585"/>
				<updated>2024-11-26T22:35:40Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Project Title */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Jardinaiins&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Parking Frenzy is car parking video game. The player will be able to move the car in right or left direction, the road itself will be descending towards the car and will also consist of obstacles such as other vehicles. The road will have lanes through which the car must navigate to ultimately be able to slot itself into the right parking spot alongside the road. The parking spots will be randomly generated along the edge of the LED matrix and the player must navigate the car into the spot at the right time or else it will result in a crash. The difficulty of the game will increase as the player reaches a certain amount of points. The difficulty will increase in terms of the speed of the car and the number of obstacles. The final score of the player will be displayed at the end of every game. a speaker attached to the board will generate the game sounds.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72571</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72571"/>
				<updated>2024-11-06T03:55:16Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Parking Frenzy&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Parking Frenzy is car parking video game. The player will be able to move the car in right or left direction, the road itself will be descending towards the car and will also consist of obstacles such as other vehicles. The road will have lanes through which the car must navigate to ultimately be able to slot itself into the right parking spot alongside the road. The parking spots will be randomly generated along the edge of the LED matrix and the player must navigate the car into the spot at the right time or else it will result in a crash. The difficulty of the game will increase as the player reaches a certain amount of points. The difficulty will increase in terms of the speed of the car and the number of obstacles. The final score of the player will be displayed at the end of every game. a speaker attached to the board will generate the game sounds.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/14/2024&lt;br /&gt;
|&lt;br /&gt;
* 10/20/2024&lt;br /&gt;
|&lt;br /&gt;
* Review past projects, identify key insights, and collaborate with team members.&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/21/2024&lt;br /&gt;
*10/21/2024  &lt;br /&gt;
| &lt;br /&gt;
*10/27/2024&lt;br /&gt;
*10/27/2024&lt;br /&gt;
|&lt;br /&gt;
*Identify and select necessary sensors and peripherals.&lt;br /&gt;
*Place orders for necessary parts.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/28/2024&lt;br /&gt;
*10/28/2024&lt;br /&gt;
|&lt;br /&gt;
*11/03/2024&lt;br /&gt;
*11/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Learn about LED matrices and display &amp;quot;Jardinains.&amp;quot;&lt;br /&gt;
*Study accelerometer principles and operation.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
* 11/04/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Create gitlab repo for the project.&lt;br /&gt;
* Create fundamental game graphics and user interfaces on LED matrix.&lt;br /&gt;
* Develop and implement code to control LED matrix based on accelerometer input.&lt;br /&gt;
* Get familiarized with MP3 decoder.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
*11/11/2024&lt;br /&gt;
|&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
*11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Design and implement game rules and systems.&lt;br /&gt;
* Integrate game logic with LED matrix display.&lt;br /&gt;
* Integrate sound effects with game logic.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/18/2024&lt;br /&gt;
| &lt;br /&gt;
*11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Conduct comprehensive testing of code and hardware.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/25/2024&lt;br /&gt;
* 11/25/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Commit and push final code to GitLab.&lt;br /&gt;
* Update and complete wiki page with project details.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72525</id>
		<title>F24: Jardinains</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Jardinains&amp;diff=72525"/>
				<updated>2024-11-01T22:26:27Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: Created page with &amp;quot;=== Grading Criteria === &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt; *  How well is Software &amp;amp; Hardware Design described? *  How well can this report be used to reproduce this project? *  Code Quali...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Title ==&lt;br /&gt;
Parking Frenzy&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Parking Frenzy is car parking video game. The player will be able to move the car in right or left direction, the road itself will be descending towards the car and will also consist of obstacles such as other vehicles. The road will have lanes through which the car must navigate to ultimately be able to slot itself into the right parking spot alongside the road. The parking spots will be randomly generated along the edge of the LED matrix and the player must navigate the car into the spot at the right time or else it will result in a crash. The difficulty of the game will increase as the player reaches a certain amount of points. The difficulty will increase in terms of the speed of the car and the number of obstacles. The final score of the player will be displayed at the end of every game. a speaker attached to the board will generate the game sounds.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
Show list of your objectives.  This section includes the high level details of your project.  You can write about the various sensors or peripherals you used to get your project completed.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Dev Hitesh Malkan&lt;br /&gt;
**   &lt;br /&gt;
*  Nidhi Sharma&lt;br /&gt;
**   &lt;br /&gt;
*  Sunny Shah&lt;br /&gt;
**   &lt;br /&gt;
*  Navya&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/13/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/19/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/26/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/02/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Order circuit boards components and complete the design for printing&lt;br /&gt;
* circuit board and component assembly&lt;br /&gt;
* Circuit board testing&lt;br /&gt;
* Additional accessories if required and finalization of hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Integration of circuit boards and microcontroller&lt;br /&gt;
* Game logic development&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Not started&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
Give a simple list of the cost of your project broken down by components.  Do not write long stories here.&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Discuss your hardware design here.  Show detailed schematics, and the interface here.&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code.  Keep in mind that you are showing DESIGN of your software, not the inner workings of it.  &lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
This section includes implementation, but again, not the details, just the high level.  For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash.  You can include sub-sections for each of your component implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;Bug/issue name&amp;gt; ===&lt;br /&gt;
Discuss the issue and resolution.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
Upload a video of your project and post the link here.&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Any acknowledgement that you may wish to provide can be included here.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
List any references used in project.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
You can list the references you used.&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=72524</id>
		<title>Realtime OS on Embedded Systems</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=72524"/>
				<updated>2024-11-01T22:24:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /*  Fall 2024 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Program History ==&lt;br /&gt;
My contribution in Embedded System courses started with CmpE146.  This course teaches students on how to write UART, SPI, and I2C Drivers and interface their drivers to peripherals.  There are about 8 weekly labs in which students not only write drivers, but also learn the core of Real-time Operating Systems including threading (tasks), and inter-task communication using Queues and Semaphores.  FreeRTOS is the operating system used with C/C++ Compiler based on GNU.&lt;br /&gt;
&lt;br /&gt;
When the course was started by Dr. Ozemek @ SJSU (sometime before 2005), not many resources were out there.  Still, with helpful guidance from Dr. Ozemek, interesting projects were created.  This is when I started to help out in Embedded System Courses, and by collecting and sharing knowledge, we've raised the bar at SJSU!  &lt;br /&gt;
&lt;br /&gt;
There have been many great projects at SJSU, but since no one knew about them, the hard work went to a waste for anyone but the creator.  But now we've got the infrastructure to share the projects, which turn out as great references for future students.  Here is my project that started around 2007, and turned into Bachelor's Senior Design Project: &amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp YouTube Video of Self-Navigating Car]&lt;br /&gt;
&lt;br /&gt;
As of 2013, I have broadened my contribution to other embedded system courses like CmpE240, CmpE243 and CmpE244.&lt;br /&gt;
&lt;br /&gt;
== Lab Assignments ==&lt;br /&gt;
This article contains laboratory assignments and resources.  The assignments are under construction as we move towards SJ-One development board.&lt;br /&gt;
*  [[Embedded System Tutorial Tasks | Lesson 0: Multiple Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial GPIO | Lesson 1 : GPIO]]&lt;br /&gt;
*  [[Embedded System Tutorial UART | Lesson 2 : UART]]&lt;br /&gt;
*  [[Embedded System Tutorial SPI  | Lesson 3 : SPI]]&lt;br /&gt;
*  [[Embedded System I2C Tutorial  | Lesson 4 : I2C]]&lt;br /&gt;
*  [[Embedded System Tutorial Interrupts | Lesson 5 : Interrupts]]&lt;br /&gt;
*  [[Embedded System Tutorial FreeRTOS | Lesson 6 : FreeRTOS Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial File I/O | Lesson 7 : FreeRTOS Application Programming]]&lt;br /&gt;
&lt;br /&gt;
==== Class Project ====&lt;br /&gt;
* [[MP3 Player]]&lt;br /&gt;
&lt;br /&gt;
==Other reference articles==&lt;br /&gt;
*  [[Bitmasking Tutorial]] (+ GPIO Example)&lt;br /&gt;
*  [[ LPC17xx Memory Map &amp;amp; Interrupts]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Senior Design Projects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Semester Projects ==&lt;br /&gt;
Every semester, students are given about 7-10 weeks to complete their projects.  During this short time-span, students form groups, order parts, and begin working on their projects.  The work performed during the semester is documented at this Wiki.&lt;br /&gt;
&lt;br /&gt;
Here is the list of Preet's documented projects:&amp;lt;BR/&amp;gt;&lt;br /&gt;
*  [[Preet's Relay Controller Project]]&lt;br /&gt;
*  [[Nordic Low Powered Mesh Network stack]]&lt;br /&gt;
*  [http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp Senior Design Project (MS-CmpE) Video]&lt;br /&gt;
&lt;br /&gt;
Here is another resource for good project references :&lt;br /&gt;
[http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/ Cornell EE476 Projects]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2024 | Fall 2024]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F24: Dodge Cars]]&lt;br /&gt;
*  [[F24: Rival Rush]]&lt;br /&gt;
*  [[F24: Space 6]]&lt;br /&gt;
*  [[F24: Bounce Tales]]&lt;br /&gt;
*  [[F24: Tilt Maze]]&lt;br /&gt;
*  [[F24: Jardinains]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2022 | Fall 2022]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F22: DDRTOS]]&lt;br /&gt;
*  [[F22: xGameCreate]]&lt;br /&gt;
*  [[F22: Embedded Gamers]]&lt;br /&gt;
*  [[F22: Bob Burgers]]&lt;br /&gt;
*  [[F22: Space Warriors]]&lt;br /&gt;
*  [[F22: Thunder Flash]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2021 | Fall 2021]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F21: ACE MARIO]]&lt;br /&gt;
*  [[F21: Skeh-lleybones]]&lt;br /&gt;
*  [[F21: Sons of Ultron]]&lt;br /&gt;
*  [[F21: Juvenile Jumpers]]&lt;br /&gt;
*  [[F21: Treasure Dive]]&lt;br /&gt;
*  [[F21: FollowMe]]&lt;br /&gt;
*  [[F21: Flame Over]]&lt;br /&gt;
*  [[F21: Space Rage]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2020 | Fall 2020]] ===&lt;br /&gt;
*  [[F20: Jubeat]]&lt;br /&gt;
*  [[F20: Flappy]]&lt;br /&gt;
*  [[F20: Space Invaders]]&lt;br /&gt;
*  [[F20: Treasure Diver]]&lt;br /&gt;
*  [[F20: Tom &amp;amp; Jerry]]&lt;br /&gt;
*  [[F20: Hungry Snake]]&lt;br /&gt;
*  [[F20: Son of a Gun]]&lt;br /&gt;
*  [[F20: Corona Run]]&lt;br /&gt;
*  [[F20: Maddening Marbles]]&lt;br /&gt;
*  [[F20: Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2019 | Fall 2019]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F19: Smacman]]&lt;br /&gt;
*  [[F19: Tetris]]&lt;br /&gt;
*  [[F19: Space Impact]]&lt;br /&gt;
*  [[F19: Road Max Fury]]&lt;br /&gt;
*  [[F19: T-Rex Run!]]&lt;br /&gt;
*  [[F19: Infinity Mirror]]&lt;br /&gt;
*  [[F19: Tower Defense in Space]]&lt;br /&gt;
*  [[F19: Alien Wars]]&lt;br /&gt;
*  [[F19: Pocket tank]]&lt;br /&gt;
*  [[F19: M&amp;amp;B (Morph &amp;amp; Blend)]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2018 | Fall 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F18: Flappy Bird]]&lt;br /&gt;
*  [[F18: Catch me if you can]]&lt;br /&gt;
*  [[F18: Zero Zero UFO]]&lt;br /&gt;
*  [[F18: Goals of Glory]]&lt;br /&gt;
*  [[F18: Spartan Warrior]]&lt;br /&gt;
*  [[F18: Wireless sensor network]]&lt;br /&gt;
*  [[F18: baem geim]]&lt;br /&gt;
*  [[F18: Hit the Balloon]]&lt;br /&gt;
*  [[F18: 2048]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2018 | Spring 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S18: Team Nemesis(SJSU Cam)]]&lt;br /&gt;
*  [[S18: Death Race]]&lt;br /&gt;
*  [[S18: Hand gesture controlled multiplayer game]]&lt;br /&gt;
*  [[S18: Smart Rock Paper Scissors]]&lt;br /&gt;
*  [[S18: Spybot]]&lt;br /&gt;
*  [[S18: Audio Spectrum Analyzer with Graphics Display]]&lt;br /&gt;
*  [[S18: XY-Plotter]]&lt;br /&gt;
*  [[S18: RGB LED Sound Behavior on a Skateboard]]&lt;br /&gt;
*  [[S18: Spark - MP3 Music Player with Audio Spectrum]]&lt;br /&gt;
*  [[S18: Traffic Menace Video Game]]&lt;br /&gt;
*  [[S18: M.E.O.W]]&lt;br /&gt;
*  [[S18: Rahee]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2017 | Spring 2017]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S17: Wake up Barista]]&lt;br /&gt;
*  [[S17: Propeller Clock]]&lt;br /&gt;
*  [[S17: Sky Knight]]&lt;br /&gt;
*  [[S17: MyAutoHealth]]&lt;br /&gt;
*  [[S17: Logan]]&lt;br /&gt;
*  [[S17: ElectricBoard]]&lt;br /&gt;
*  [[S17: CamBot]]&lt;br /&gt;
*  [[S17: Sphero Droid]]&lt;br /&gt;
*  [[S17: Smart Planter]]&lt;br /&gt;
*  [[S17: Boom-Z Equalizer]]&lt;br /&gt;
*  [[S17: Interactive Snake and ladder ]]&lt;br /&gt;
*  [[S17: Smart Health Gear]]&lt;br /&gt;
*  [[S17: Halo]]&lt;br /&gt;
*  [[S17: Squad]]&lt;br /&gt;
*  [[S17: Smart security system]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2016 | Fall 2016]] ===&lt;br /&gt;
&lt;br /&gt;
CMPE146:&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=F16:_Seismograph F16: Seismograph]&lt;br /&gt;
* [[F16: Piano Glove]]&lt;br /&gt;
* [[F16: Object Detector]]&lt;br /&gt;
* [[F16: Autonomous Nautical System]]&lt;br /&gt;
* [[F16: Autonomous Fire Extinguishing Vehicle]]&lt;br /&gt;
* [[F16: Autonomous Runaway Alarm Car]]&lt;br /&gt;
* [[F16: E-Bike]]&lt;br /&gt;
* [[F16: NotifyBox]]&lt;br /&gt;
* [[F16: Wireless Tilt Controlled Camera Arm]]&lt;br /&gt;
* [[F16: OBD2 Reader]]&lt;br /&gt;
* [[F16: Micro Watch Monitoring System]]&lt;br /&gt;
* [[F16: Door Alarm System]]&lt;br /&gt;
* [[http://www.socialledge.com/sjsu/index.php?title=F16:_I2Coffee F16: UART Coffee]]&lt;br /&gt;
* [[F16: SJone to FPGA wireless integration]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2016 | Spring 2016]] ===&lt;br /&gt;
*  [[S16: Fantastic Four]]&lt;br /&gt;
*  [[S16: Simpsons]]&lt;br /&gt;
*  [[S16: Mars 1]]&lt;br /&gt;
*  [[S16: OpenSJ Bluz]]&lt;br /&gt;
*  [[S16: Motion Copy Bot]]&lt;br /&gt;
*  [[S16: Biker Assist]]&lt;br /&gt;
*  [[S16: Helios]]&lt;br /&gt;
*  [[S16: Sound Buddy]]&lt;br /&gt;
*  [[S16: Warriors]]&lt;br /&gt;
*  [[S16: Expendables]]&lt;br /&gt;
*  [[S16: Ahava]]&lt;br /&gt;
*  [[S16: Number 1]]&lt;br /&gt;
*  [[S16: SkyNet]]&lt;br /&gt;
*  [[S16: SmartDoorLock]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cmpe 146:&lt;br /&gt;
*  [[S16: Camera Gimbal]]&lt;br /&gt;
*  [[S16: Laser Harp]]&lt;br /&gt;
*  &amp;lt;strike&amp;gt;[[S16: Laser Cutter Motor Controller]]&amp;lt;/strike&amp;gt;&lt;br /&gt;
*  [[S16: Sprinkler]]&lt;br /&gt;
*  [[S16: The Jatrick Car]]&lt;br /&gt;
*  [[S16: Dan]]&lt;br /&gt;
*  [[S16: Robolamp]]&lt;br /&gt;
*  [[S16: Pinball]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2015 | Fall 2015]] ===&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[F15: Autonomous Mobile]]&lt;br /&gt;
* [[F15: Car Report]]&lt;br /&gt;
* [[F15: Electronic Piano]]&lt;br /&gt;
* [[F15: Doorknock over Bluetooth]]&lt;br /&gt;
* [[F15: Smart Car]]&lt;br /&gt;
* [[F15: Plant Control]]&lt;br /&gt;
* [[F15: Laser Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2015 | Spring 2015]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S15: Quadcopter - It flies]]&lt;br /&gt;
* [[S15: Remote Learner]]&lt;br /&gt;
* [[S15: Protocol Interface: I2C - CAN Bridge]]&lt;br /&gt;
* [[S15: Vision RC Car]]&lt;br /&gt;
* [[S15: SJeight Octocopter]]&lt;br /&gt;
* [[S15: Swarm Robots]]&lt;br /&gt;
* [[S15: Smart Sparta Parking System]]&lt;br /&gt;
* [[S15: Touch Navigator]]&lt;br /&gt;
* [[S15: Wizard's Chess System]]&lt;br /&gt;
* [[S15: Bug Rider]]&lt;br /&gt;
* [[S15: Real Time Brake Assist (RTBA)]]&lt;br /&gt;
* [[S15: Wireless Mesh Network]]&lt;br /&gt;
* [[S15: Wireless Power Transfer System]]&lt;br /&gt;
* [[S15: Drone]]&lt;br /&gt;
* [[S15: Tree Node using Google Protocol Buffers]]&lt;br /&gt;
* [[S15: Multi-media Car]]&lt;br /&gt;
* [[S15: Hand Gesture Recognition using IR Sensors]]&lt;br /&gt;
* [[S15: CAN controlled RGB LED cubes]]&lt;br /&gt;
* [[S15: Rubik's Cube Solver]]&lt;br /&gt;
* [[S15: RFID Security Box]]&lt;br /&gt;
* [[S15: Automated Meeting Room Reservation]]&lt;br /&gt;
* [[S15: Patient Buddy System (PBS)]]&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[S15: Hovercopter]]&lt;br /&gt;
* [[S15: Triclops: Smart RC Car]]&lt;br /&gt;
* [[S15: Connect Four - Robotic Player]]&lt;br /&gt;
* [[S15: Self-Balancing Robot]]&lt;br /&gt;
* [[S15: MP3 Player with Graphic Equalizer Display]]&lt;br /&gt;
* [[S15: Motion-Controlled RC Car]]&lt;br /&gt;
* [[S15: MENL (Monster Encounter Night Light) ]]&lt;br /&gt;
* [[S15: Tilt Motion Controlled LED Alarm Clock]]&lt;br /&gt;
* [[S15: Alarm Based Coffee Maker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2014 | Spring 2014]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*  Senior Project: [[Project Advising: Remote Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S14: Quadcopter]]&lt;br /&gt;
* [[S14: Smart Weather Clock]]&lt;br /&gt;
* [[S14: Divine WINd]]&lt;br /&gt;
* [[S14: Data Acquisition using CAN bus]]&lt;br /&gt;
* [[S14: E-Ink Display for Shopping Tags]]&lt;br /&gt;
* [[S14: Spectrum Analyzer for Audio Frequency Signals]]&lt;br /&gt;
* [[S14: CAN Firmware Uploader]]&lt;br /&gt;
* [[S14: Asset Management and Location System]]&lt;br /&gt;
* [[S14: Location  Tracker]]&lt;br /&gt;
* [[S14:  Androbot]]&lt;br /&gt;
* [[S14: Virtual Dog]]&lt;br /&gt;
* [[S14: Android based Automation]]&lt;br /&gt;
* [[S14: FaceTime Robo]]&lt;br /&gt;
* [[S14: Wireless Control Car]]&lt;br /&gt;
* [[S14: Power Efficient Security Door System for Light-rail using CAN Bus]]&lt;br /&gt;
* [[S14: Android based home monitoring system]]&lt;br /&gt;
* [[S14: Need For Speed]]&lt;br /&gt;
&lt;br /&gt;
CmpE146&lt;br /&gt;
* [[S14: Hyperintelligent NFC Locker of the Future]]&lt;br /&gt;
* [[S14: Smart Planter]]&lt;br /&gt;
* [[S14: Modular Security System]]&lt;br /&gt;
* [[S14: Autonomous Control System]]&lt;br /&gt;
* [[S14: Anti-Crash Car]]&lt;br /&gt;
* [[S14: Tricopter]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE240 Fall 2013 | Fall 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F13: POV Display]]&lt;br /&gt;
* [[F13: Line Following Robot]]&lt;br /&gt;
* [[F13: LED Display]]&lt;br /&gt;
* [[F13: Bulb Ramper]]&lt;br /&gt;
* [[F13: Garage Parking Assistant]]&lt;br /&gt;
* [[F13: Quadcopter]]&lt;br /&gt;
* [[F13: BarkMaster2000]]&lt;br /&gt;
* [[F13: Remote Control Car]]&lt;br /&gt;
* [[F13: Obstacle Avoidance Robot]]&lt;br /&gt;
* [[F13: Vehicle On Board Diagnostics]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2013 | Spring 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[S13: 2D Plotter]]&lt;br /&gt;
* [[S13: Smart Cube]]&lt;br /&gt;
* [[S13: Garage Parking Aid]]&lt;br /&gt;
* [[S13: Smart Security]]&lt;br /&gt;
* [[S13: Door Alarm System]]&lt;br /&gt;
* [[S13: Solar Panel Tracker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Fall 2012|Fall 2012]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F12: Evil Watchdog]]&lt;br /&gt;
* [[F12: Smart Bulb]]&lt;br /&gt;
* [[F12: All Your Base are Belong to You]]&lt;br /&gt;
* [[F12: Android Controlled MP3]]&lt;br /&gt;
* [[F12: Unified Wireless Health Monitoring System]]&lt;br /&gt;
* [[F12: OBD-II Android Monitor]]&lt;br /&gt;
* [[F12: Self-Driving GPS Following Car]]&lt;br /&gt;
* [[F12: Android Door Lock]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2012|Spring 2012]] ===&lt;br /&gt;
*  [[S12: FreeRTOS based QuadCopter]]&lt;br /&gt;
*  [[S12: Web-based MP3 Player]]&lt;br /&gt;
*  [[S12: Self Drive Car]]&lt;br /&gt;
*  [[S12: VAndroid]]&lt;br /&gt;
*  [[S12: Traffic Light Sensing Vehicle]]&lt;br /&gt;
*  [[S12: Sound Reader]]&lt;br /&gt;
*  [[S12: Remote Controlled MP3 Player]]&lt;br /&gt;
*  [[S12: Android Controlled Robot]]&lt;br /&gt;
*  [[S12: Eyes-Free GPS]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Handy References ==&lt;br /&gt;
*  [[Sample Project Report]]&lt;br /&gt;
*  [[Project Proposal Guidelines]]&lt;br /&gt;
*  [[CmpE146 Lab. Resources]]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67128</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67128"/>
				<updated>2021-12-18T13:18:39Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking the lost treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  '''Brian Ho'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  '''[https://www.linkedin.com/in/william-lai-525681139 Billy Lai]'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  '''Jasdip Sekhon'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  '''Isaac Wahhab'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
=== Project Presentation ===&lt;br /&gt;
* [https://docs.google.com/presentation/d/1pIAAq51RySaZrniwJGuuHpVVPT1xaE4mjnMTCl6fnXA/edit?usp=sharing Treasure Dive Demo Presentation]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67127</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67127"/>
				<updated>2021-12-18T12:56:45Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Abstract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking the lost treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  '''Brian Ho'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  '''[https://www.linkedin.com/in/william-lai-525681139 Billy Lai]'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  '''Jasdip Sekhon'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  '''Isaac Wahhab'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67126</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67126"/>
				<updated>2021-12-18T12:54:16Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  '''Brian Ho'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  '''[https://www.linkedin.com/in/william-lai-525681139 Billy Lai]'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  '''Jasdip Sekhon'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  '''Isaac Wahhab'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67125</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67125"/>
				<updated>2021-12-18T12:53:28Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
'''Brian Ho'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
'''[https://www.linkedin.com/in/william-lai-525681139 Billy Lai]'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
'''Jasdip Sekhon'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
'''Isaac Wahhab'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67124</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67124"/>
				<updated>2021-12-18T12:52:45Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
'''*  Brian Ho'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
'''*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
'''*  Jasdip Sekhon'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
'''*  Isaac Wahhab'''&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67123</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67123"/>
				<updated>2021-12-18T12:51:48Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- integrate two Zigbees RF modules integrated for wireless communication between the controller and LPC4088 board via UART protocol&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- enable digital audio output by developing an I2S driver and porting an audio tracker library&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function to decrease memory write times when updating the video buffer&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- utilize the DMA controller's memory-to-peripheral function to help reduce frequent I2S interrupts when loading digital audio contents&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
- implement an SD card peripheral driver to facilitate memory exchange between an SD card&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67122</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67122"/>
				<updated>2021-12-18T12:49:28Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and to use an accelerometer as the sensor for the player controller.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67121</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67121"/>
				<updated>2021-12-18T12:48:36Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67120</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67120"/>
				<updated>2021-12-18T12:47:50Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Acknowledgement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67119</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67119"/>
				<updated>2021-12-18T12:47:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Acknowledgement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
Another shoutout to our art designer Jacob for the unique artwork displayed in our game.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67118</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67118"/>
				<updated>2021-12-18T12:44:33Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead!&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67117</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67117"/>
				<updated>2021-12-18T12:44:22Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
For some of us, this was our first experience in designing and implementing a functional embedded system using FreeRTOS. The challenges we hurdled to accomplish our technical goals helped to shape a journey that was greatly enhanced by the opportunity to meet in person and having a hands-on approach to hardware and component integration. We were able to utilize design principles and implement communication protocols we learned in lecture to pull this project together. Some useful topics include: UART, SPI, I2C, I2S, DMA, FreeRTOS mutexes and binary semaphores, queues, task creation, stack size, task scheduler, interrupt service routines, bootloaders, etc. After extensive hours spent testing and verifying our implementation, we have learned that time allocated for integration and testing will significantly improve chances of a successful project. If we had skipped out on testing and verification, the project could have possibly crashed and burned when it was delivered. We hope this project can be of use to any future engineers following behind us, and we wish you all good times and happy development ahead.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67116</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67116"/>
				<updated>2021-12-18T12:19:31Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
[[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
[[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67115</id>
		<title>File:Cmpe-244-billy-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67115"/>
				<updated>2021-12-18T12:17:19Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: Proj user1 uploaded a new version of File:Cmpe-244-billy-pic.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67114</id>
		<title>File:Cmpe-244-billy-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67114"/>
				<updated>2021-12-18T12:16:17Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: Proj user1 uploaded a new version of File:Cmpe-244-billy-pic.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67113</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67113"/>
				<updated>2021-12-18T12:15:26Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-billy-pic.png]]&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67112</id>
		<title>File:Cmpe-244-billy-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-billy-pic.png&amp;diff=67112"/>
				<updated>2021-12-18T12:14:59Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67111</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67111"/>
				<updated>2021-12-18T12:05:43Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-jasdip-pic.png]]&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-jasdip-pic.png&amp;diff=67110</id>
		<title>File:Cmpe-244-jasdip-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-jasdip-pic.png&amp;diff=67110"/>
				<updated>2021-12-18T12:05:20Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67109</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67109"/>
				<updated>2021-12-18T12:02:35Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-isaac-pic.png ]]&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67108</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67108"/>
				<updated>2021-12-18T12:01:57Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [[File:Cmpe-244-isaac-pic.png |200px|thumb|left|Isaac Wahhab]]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-isaac-pic.png&amp;diff=67107</id>
		<title>File:Cmpe-244-isaac-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-isaac-pic.png&amp;diff=67107"/>
				<updated>2021-12-18T12:01:01Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67106</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67106"/>
				<updated>2021-12-18T11:59:05Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67105</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67105"/>
				<updated>2021-12-18T11:58:36Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎Brian Ho]]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67104</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67104"/>
				<updated>2021-12-18T11:58:10Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png ‎]]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67103</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67103"/>
				<updated>2021-12-18T11:57:56Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  [[File:Cmpe-244-brian-pic.png Brian Ho]]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-brian-pic.png&amp;diff=67102</id>
		<title>File:Cmpe-244-brian-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-brian-pic.png&amp;diff=67102"/>
				<updated>2021-12-18T11:57:22Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: Proj user1 uploaded a new version of File:Cmpe-244-brian-pic.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Brian Ho&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-brian-pic.png&amp;diff=67101</id>
		<title>File:Cmpe-244-brian-pic.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Cmpe-244-brian-pic.png&amp;diff=67101"/>
				<updated>2021-12-18T11:56:06Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: Brian Ho&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Brian Ho&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67100</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67100"/>
				<updated>2021-12-18T11:51:19Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67099</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67099"/>
				<updated>2021-12-18T11:51:04Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Treasure Dive''' ==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67098</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67098"/>
				<updated>2021-12-18T11:50:31Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Treasure Dive''' ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67097</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67097"/>
				<updated>2021-12-18T11:46:06Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Team Members &amp;amp; Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Treasure Dive''' ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  [https://www.linkedin.com/in/william-lai-525681139 Billy Lai]&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67096</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67096"/>
				<updated>2021-12-18T11:42:41Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Treasure Dive''' ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Billy Lai&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Collision Logic ====&lt;br /&gt;
The position of the ball is calculated by adding delta_x and delta_y to the ball's current x and y position. For each frame, if the ball's next Y position crosses the paddle's Y position, we would check for a paddle collision. To do this, we used the delta_x and delta_y to get the ball's movement as a slope. We then substituted the slope, the ball's current position, and 1 pixel above the paddle's Y position into a point-slope equation (y2 - y1) = m(x2 - x1) to get the paddle's X position at the time of the ball reaching the pixel above paddle's Y position. After finding the location where the ball is expected to collide with the paddle, we then calculated the ball's collision magnitude and the ball's next location's magnitude. Using a ratio of these two magnitudes, we have a frame time fraction of when the ball possibly collided with the paddle. Then, by using the paddle's current position and paddle velocity, we are able to find where the paddle previously was, and measure how far the paddle had moved during that time frame. By multiplying the time frame from the ball's collision magnitude to the paddle's change in X position, we are able to find whether the paddle was under the ball at the time of the ball reaching the pixel above the paddle's Y position.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67095</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67095"/>
				<updated>2021-12-18T11:36:41Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Treasure Dive''' ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Billy Lai&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67094</id>
		<title>F21: Treasure Dive</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_Treasure_Dive&amp;diff=67094"/>
				<updated>2021-12-18T11:36:04Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user1: /* LCD Peripheral */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:mermaid.png|thumb|500px|right|Game Screen Capture]]&lt;br /&gt;
[[File:Cmpe-244-controller-pic.png|thumb|600px|right|Game Controller]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== Grading Criteria ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&lt;br /&gt;
*  How well is Software &amp;amp; Hardware Design described?&lt;br /&gt;
*  How well can this report be used to reproduce this project?&lt;br /&gt;
*  Code Quality&lt;br /&gt;
*  Overall Report Quality:&lt;br /&gt;
**  Software Block Diagrams&lt;br /&gt;
**  Hardware Block Diagrams&lt;br /&gt;
**:  Schematic Quality&lt;br /&gt;
**  Quality of technical challenges and solutions adopted.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Treasure Dive''' ==&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Treasure Dive is a modern one player game inspired by the popular arcade game Breakout, which was released by Atari in 1976. The ancients rambled about an unconfirmed tale of a shipwreck that saw no survivors. As an adventurous and skilled free diver, you are seeking treasure buried deep in an ocean abyss. You dove down all the way to the seafloor and found the buried treasure but need to make it back to the surface to see another day! The player uses a wireless controller to control an on-screen paddle to break bricks on the top of the screen. When enough bricks are broken, a passage is revealed, allowing you to get closer to the surface.&lt;br /&gt;
&lt;br /&gt;
== Objectives &amp;amp; Introduction ==&lt;br /&gt;
The objective of this project is to interface an LPC4088 to a VGA monitor by leveraging the LCD controller and use an accelerometer as the sensor for the player to control the paddle.&lt;br /&gt;
Two Zigbees RF modules will be integrated for wireless communication between the controller and LPC4088 board via UART protocol.&lt;br /&gt;
Digital audio output will be enabled by developing an I2S driver and porting an audio tracker library.&lt;br /&gt;
The General Purpose Direct Memory Access (GPDMA) controller memory-to-memory function will be utilized to decrease memory write times when updating the video buffer.&lt;br /&gt;
The DMA controller's memory-to-peripheral function will help reduce the frequent I2S interrupts when loading digital audio contents.&lt;br /&gt;
An SD card peripheral driver to facilitate memory exchange between an SD card will also be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
*  Brian Ho&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Interfacing the accelerometer&lt;br /&gt;
**   Digital to Analog Conversion resistor ladder design used to interface digital LCD controller signal with analog VGA port signal&lt;br /&gt;
**   PCB planning and acquisition&lt;br /&gt;
**   Procurement of controller hardware&lt;br /&gt;
**   Wireless communication via Zigbees RF modules and UART protocol&lt;br /&gt;
**   Wireless controller logic and integration&lt;br /&gt;
**   Ball movement and wall/brick collision logic&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Billy Lai&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   Increased CPU clock rate from 96 MHz to 120 MHz&lt;br /&gt;
**   Initial memory write timing and measurements to estimate memory write capacity&lt;br /&gt;
**   DMA driver memory-to-memory implementation for transferring graphics data to video buffer&lt;br /&gt;
**   I2S with DMA memory-to-peripheral implementation to reduce memory-write interrupts when I2S Tx FIFO level is low&lt;br /&gt;
**   Paddle movement and paddle collision logic, testing and integration&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Jasdip Sekhon&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   PCB design and planning&lt;br /&gt;
**   File loading method algorithm for storing loaded files in memory&lt;br /&gt;
**   Audio track and audio effects selection for gameplay audio&lt;br /&gt;
**   Palette manipulation for gameplay&lt;br /&gt;
**   Software development and integration&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
*  Isaac Wahhab&lt;br /&gt;
**   Wiki project schedule planning&lt;br /&gt;
**   DAC resistor ladder design and integration&lt;br /&gt;
**   Hardware procurement (LPC4088 board, Zigbees, VGA monitor, etc)&lt;br /&gt;
**   VGA driving through LCD controller&lt;br /&gt;
**   Audio tracker library port&lt;br /&gt;
**   Digital audio output using I2S&lt;br /&gt;
**   Palette scrolling feature implementation&lt;br /&gt;
**   Graphics rendering&lt;br /&gt;
**   Vertical scrolling implementation for the video buffer&lt;br /&gt;
**   Sprite testing and implementation for the ball&lt;br /&gt;
**   SD card peripheral driver for reading assets from SD card&lt;br /&gt;
**   Art assets acquisition&lt;br /&gt;
**   Hardware/software development and integration&lt;br /&gt;
**   Gameplay logic design&lt;br /&gt;
**   Gameplay audio and level design&lt;br /&gt;
**   Final testing and integration&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
*09/21/2021&lt;br /&gt;
|&lt;br /&gt;
*09/27/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Initial ordering of parts (LPC 4088 board, 64x64 LED screen)&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*09/28/2021   &lt;br /&gt;
| &lt;br /&gt;
*10/04/2021 &lt;br /&gt;
|&lt;br /&gt;
* Submit project proposals&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/05/2021&lt;br /&gt;
|&lt;br /&gt;
*10/11/2021&lt;br /&gt;
|&lt;br /&gt;
* Test if board can drive VGA&lt;br /&gt;
* Test varying clock rates&lt;br /&gt;
* Hardware cursor on VGA&lt;br /&gt;
* Rough display driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 10/12/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2021&lt;br /&gt;
|&lt;br /&gt;
* DAC resistor ladder&lt;br /&gt;
* RGB channels&lt;br /&gt;
* Palette shifting&lt;br /&gt;
* Measure memory buffer writing timing&lt;br /&gt;
* Wiki schedule planning&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*10/19/2021&lt;br /&gt;
|&lt;br /&gt;
*10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Calculate upper-bound for VGA refresh timings&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Joystick functionality&lt;br /&gt;
* SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*10/26/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/01/2021&lt;br /&gt;
|&lt;br /&gt;
* Audio peripheral&lt;br /&gt;
* Wireless communication using Zigbee module&lt;br /&gt;
* PCB planning&lt;br /&gt;
* Accelerometer driver&lt;br /&gt;
* Continue SD card driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/02/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/08/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue audio peripheral&lt;br /&gt;
* Continue wireless communication using Zigbee module&lt;br /&gt;
* Continue accelerometer driver&lt;br /&gt;
* PCB finalizing and ordering &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/09/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/15/2021&lt;br /&gt;
|&lt;br /&gt;
* Convert PNG data to graphics format&lt;br /&gt;
* Game background functionality&lt;br /&gt;
* Sprite functionality&lt;br /&gt;
* User interface&lt;br /&gt;
* Integrate components&lt;br /&gt;
* Initial testing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 11/16/2021&lt;br /&gt;
| &lt;br /&gt;
* 11/22/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue everything from last week&lt;br /&gt;
* Game physics (wall collision and AI movement)&lt;br /&gt;
* Measurements for wooden case&lt;br /&gt;
* Art assets (audio and visual)&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*11/23/2021&lt;br /&gt;
| &lt;br /&gt;
*11/29/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Fine-tune user experience&lt;br /&gt;
* Make case&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 11&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Continue fine-tune user experience&lt;br /&gt;
* Integrate hardware&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 12&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/16/2021&lt;br /&gt;
|&lt;br /&gt;
* Final testing&lt;br /&gt;
* Final demo&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bill Of Materials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [https://www.embeddedartists.com/products/lpc4088-developers-kit LPC4088-32 Developer's Kit]&lt;br /&gt;
| 1&lt;br /&gt;
| $300.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| Microcontroller Board&lt;br /&gt;
| [http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems/page/sj2-board SJ2 Board]&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Bluetooth Module&lt;br /&gt;
| [https://hub.digi.com/support/products/digi-xbee/digi-xbee-s1 Digi XBee-S1]&lt;br /&gt;
| 2&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| DAC PCB&lt;br /&gt;
| [https://jlcpcb.com JLCPCB (Set of 5)]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Monitor&lt;br /&gt;
| Asus TFT Monitor&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Mini Breadboard&lt;br /&gt;
| [https://www.amazon.com/EL-CK-002-Electronic-Breadboard-Capacitor-Potentiometer/dp/B01ERP6WL4/ref=pd_sbs_147_2/132-6936347-2117569?_encoding=UTF8&amp;amp;pd_rd_i=B01ERP6WL4&amp;amp;pd_rd_r=6a783095-ec87-42ae-9f01-a5ebc9a44607&amp;amp;pd_rd_w=V2aU6&amp;amp;pd_rd_wg=11h1i&amp;amp;pf_rd_p=d66372fe-68a6-48a3-90ec-41d7f64212be&amp;amp;pf_rd_r=368WNKXFBBQY2FJQ4119&amp;amp;psc=1&amp;amp;refRID=368WNKXFBBQY2FJQ4119 ELEGOO Mini Breadboard]&lt;br /&gt;
| 1&lt;br /&gt;
| $13.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Arcade buttons&lt;br /&gt;
| [https://www.amazon.com/EG-STARTS-Illuminated-Buttons-Raspberry/dp/B01N11BDX9?pd_rd_w=DiSpt&amp;amp;pf_rd_p=5bc65336-a8b0-4888-9e70-4d4ce2f6bd59&amp;amp;pf_rd_r=JCH2VQYXFPHND4XZ4FAM&amp;amp;pd_rd_r=8d6243dd-e1bd-4dae-9b19-be2e00f3085f&amp;amp;pd_rd_wg=K4lt9&amp;amp;pd_rd_i=B01N11BDX9&amp;amp;psc=1&amp;amp;ref_=pd_bap_d_rp_1_i EG STARTS LED Arcade Buttons]&lt;br /&gt;
| 2&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| VGA cable&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SD card&lt;br /&gt;
| N/A&lt;br /&gt;
| 1&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
We designed our PCB using Autodesk EAGLE based on the tutorial on PCB design during the class lecture. We ordered our PCB to be manufactured from JLCPCB. The PCB consists of an R-2R resistor ladder DAC for the purpose of converting the digital signal from the microcontroller to analog to display graphics on the VGA monitor.  Since the VGA input for each color channel is 0-0.7V, the resistor ladder scaled the LPC4088 outputs into proper DAC values for the VGA to take in.  Five bits are passed to each of the red, green, and blue channels of the VGA in addition to other signals, such as Horizontal sync (HSYNC) and Vertical sync (VSYNC).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:pcbSchematic.png|500px|thumb|left|PCB Schematic]]&lt;br /&gt;
[[File:pcbLayout.png|500px|thumb|right|PCB Layout]]&lt;br /&gt;
[[File:pcbPic-min.png|500px|thumb|right|Manufactured PCB]]&lt;br /&gt;
[[File:pcbManufactured.png|500px|thumb|left|Soldered PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
&lt;br /&gt;
Two Digi XBee devices were used to communicate between the SJ2-Board controller and the LPC4088 board to control the paddle on the game.  The XBee devices were programmed using the XTCU programming application provided by Digi International.  The SJ2-Board used one XBee as a transmitted and the LPC4088 used another as a receiver.  The two modules communicated using UART frames and a single byte represented any change of movement or button presses sent by the controller.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| XCTU&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Transmitter&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Receiver&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CH&lt;br /&gt;
| C&lt;br /&gt;
| C&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| ID&lt;br /&gt;
| 6969&lt;br /&gt;
| 6969&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| CE&lt;br /&gt;
| Coordinator&lt;br /&gt;
| Endpoint&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Baud Rate&lt;br /&gt;
| 9600&lt;br /&gt;
| 9600&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[File:sj2Board.png|380px|thumb|center|SJ2 Board]]&lt;br /&gt;
[[File:CMPE146_F16_MW_XbeeModule.jpg|200px|thumb|center|XBee Device]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two LED buttons were used to interface with the controller as inputs. They were both set up using GPIO.&lt;br /&gt;
[[File:VGA LED Button.jpg|200px|thumb|center|LED Button]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:VGA_Controller_Block_Diagram.PNG|380px|thumb|center|Controller Block Diagram]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== I2S Peripheral and Stereo Audio Decoder ====&lt;br /&gt;
&lt;br /&gt;
The LPC4088 is equipped with an I2S stereo encoder. This module provides a hardware-enabled solution for sending I2S-encoded audio data packets to stereo decoders, which produce the corresponding audio waveform. For this project, since 16-bit stereo audio playback was chosen, data packets transmitted on this interface were sent in the following format:&lt;br /&gt;
&lt;br /&gt;
[[File:I2S_audio_data_word.png]]&lt;br /&gt;
&lt;br /&gt;
Here, each word of data encodes a single packet of audio in two 16-bit sections: one signal level for the left channel, and another for the right. These 4 bytes are sent at a rate of 44100 Hz, resulting in a total data transmission of 176400 bytes a second. Rather than needing to be software-defined, this transmission is automatically handled by hardware using a 8-word deep FIFO queue that manages streaming out the audio data at a fixed rate, saving a significant amount of CPU cycles. &lt;br /&gt;
&lt;br /&gt;
This encoded audio signal was sent to a dedicated external [https://www.nxp.com/docs/en/data-sheet/UDA1380.pdf stereo decoder], which output to a 3.5 mm audio jack connected to speakers in the VGA monitor.&lt;br /&gt;
&lt;br /&gt;
==== LCD Peripheral ====&lt;br /&gt;
&lt;br /&gt;
The LCD peripheral was configured for 16-bit color palette (5 bits of color data for each color level -- red, green, and blue -- and an unused intensity bit), at a resolution of 800 by 600 pixels, and with an active color palette size of 256 colors. Since the logic for driving an LCD display has the same concepts (horizontal blanking, vertical blanking, etc) and timing information for any given resolution was the same, we were able to directly drive a VGA display with the same signals and timing data (after the digital signal had been converted to analog).&lt;br /&gt;
&lt;br /&gt;
[[File:LCD_%2B_VGA_Video_signal.png]]&lt;br /&gt;
&lt;br /&gt;
The timing register configurations needed to achieve the requested video display was derived from a dedicated website for [http://tinyvga.com/vga-timing/800x600@60Hz VGA signal info].&lt;br /&gt;
&lt;br /&gt;
==== External Memory ====&lt;br /&gt;
&lt;br /&gt;
The game's visual assets and tracker audio file (both after being loaded from an SD card) and the game's video buffer required more memory than what is present natively in the microcontroller. To accommodate this, an external 32MiB memory module was used. This module was interfaced with using the external memory controller peripheral present on the board.&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
==== Controller ====&lt;br /&gt;
&lt;br /&gt;
There is an internal accelerometer on the SJ2 board that is utilized as the movement controls for the paddle movement.  The y-axis value of the magnitude is polled 17 times in 17 milliseconds and is divided by 17 to get an average reading per that time frame.  The maximum tilt value that can be read by the controller is set to 700 out of the total 1000 (highest possible value).  The current tilt value is divided by 31 to get a total of 32 possible readings to represent 5 bits of magnitude.&lt;br /&gt;
&lt;br /&gt;
The controller sends one byte of data to the console whenever there is any change in magnitude on the accelerometer or button changes.  The byte contains all the information needed to control the paddle on the screen.  The first two bits on the byte represent 0 if there is no button input and 1 if there is a button input.  The third bit represents whether the controller is tilted left or right with 0 being left and 1 being right.  The last five bits represent the controller accelerometer's magnitude.&lt;br /&gt;
&lt;br /&gt;
[[File:VGA_UART_Frame.PNG]]&lt;br /&gt;
&lt;br /&gt;
==== Audio ====&lt;br /&gt;
&lt;br /&gt;
Sound design was provided to the project (in the form of music and sound effects) through the use of a [https://https://en.wikipedia.org/wiki/Music_tracker tracker audio library]. Source code was adopted from the [https://github.com/schismtracker/schismtracker Schism Tracker] library and altered with the following modifications:&lt;br /&gt;
&lt;br /&gt;
- All UI logic was stripped from the source code&lt;br /&gt;
&lt;br /&gt;
- All file handling logic was reworked to use the SD card reading functions, as the project does not support POSIX file calls&lt;br /&gt;
&lt;br /&gt;
- The [https://www.libsdl.org/ Simple DirectMedia Layer] hooks were replaced with a FreeRTOS task that periodically called the waveform generation callback function, which was passed to the I2S peripheral hooked up to a stereo decoder.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
==== Ball Logic ====&lt;br /&gt;
&lt;br /&gt;
The ball is controlled by the buttons and the controller accelerometer values.  When the button is pressed, the ball is initially sent with a random velocity.  The velocity is determined by a substate timer and is initially set as one of 6 possible values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Substate Count&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X-Velocity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y-Velocity&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| -4&lt;br /&gt;
| -2&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| 2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| -2&lt;br /&gt;
| -4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| 1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| -1&lt;br /&gt;
| -5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ball's velocity changes whenever it detects a collision with either the side of the screen, the bricks on the top of the level, or the paddle at the bottom.  If colliding with the paddle, the ball's velocity will take into account the paddle's velocity and add it to its current velocity.  This is done by adding the paddle's x-velocity and adjusting the y-velocity by normalizing the velocity vectors to have a magnitude of 5.  This means the ball will always be moving with a magnitude of 5 in any direction after it hits the paddle.  If the ball collides with anything other than the paddle, then the velocity of the ball is changed with no increase or decrease of magnitude.  If the ball collides on the side of a wall or block, the x-velocity will reflect (go from negative to positive or vice-versa) and the y-velocity will remain constant.  If the ball collides on the top or bottom of a block, the y-velocity will reflect and the x-velocity will remain constant.  If it appears that the ball collides with the side and top or bottom of something, then the ball will check whichever face it will collide with first and then calculate the other face.  Lastly, when the ball collides with the bottom of the screen, then the player experiences a &amp;quot;death&amp;quot; and the ball will reset on the paddle.  If the ball collides with the top of the screen, the screen will scroll up for the user to play on the next level.&lt;br /&gt;
 &lt;br /&gt;
Whenever the ball collides with a brick, the brick will disappear.  To accomplish this, there is a 2-D array of unsigned integers that contains the values of the bricks.  If the integer is 0, then there is no block.  If the integer is any value other than 0, then the block is filled and has collision logic.  If the ball approaches a region that might have a block, then there will be a check within that 2-D to see if the block is filled or empty.  If the block is filled, there will be the collision logic that changes the vector of the ball and sets the integer value in the 2-D array to 0 to represent that the block has been broken.&lt;br /&gt;
&lt;br /&gt;
==== Paddle Movement ====&lt;br /&gt;
The paddle movement is controlled by the accelerometer data being wirelessly transmitted from the SJ-Two board to the LPC4088 board. The accelerometer data will map to 63 possible indexes for the paddle location. Originally, the paddle would jump directly into the corresponding index location depending on the accelerometer input. We later iterated on this process by implementing an algorithm to smoothly transition into these indexes. This was done by calculating a paddle velocity using the &amp;quot;current desired paddle position&amp;quot; and the previous paddle position. We adjusted the parameters of the algorithm iteratively to produce the smooth paddle movement.&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
Describe the challenges of your project.  What advise would you give yourself or someone else if your project can be started from scratch again?&lt;br /&gt;
Make a smooth transition to testing section and described what it took to test your project.&lt;br /&gt;
&lt;br /&gt;
Include sub-sections that list out a problem and solution, such as:&lt;br /&gt;
&lt;br /&gt;
=== VGA Interfacing ===&lt;br /&gt;
A DAC resistor ladder was designed and a corresponding custom PCB was acquired to interface the 3.3V digital LCD controller signal with the analog VGA input signal. The VGA cable takes between 0V (completely dark) and 0.7V (maximum brightness) for color pin inputs. The DAC resistor ladder was designed and implemented on a breadboard to verify the design. Validating the design on a breadboard gave us a clear vision during PCB design and planning.&lt;br /&gt;
&lt;br /&gt;
=== VGA Write Timings ===&lt;br /&gt;
There were initial tests that were required to be done to see if using a VGA monitor as an output was a viable option for this project.  We had to test memory write timings to see if they were fast enough to match the refresh rate of the monitor.  Those tests would decide how much of the screen buffer we could write to during the blanking periods during the VGA refresh.  This was a good learning experience for testing hardware capabilities and should be done whenever introducing any new aspects to a project.&lt;br /&gt;
&lt;br /&gt;
=== Ball Collision Logic ===&lt;br /&gt;
The initial version of the ball collision used pixel values to see if the ball was entering the brick.  The problem was that this logic did not account for the case where the ball enters the brick diagonally and the logic for that version of the collision had to be scrapped.  The later iteration of the logic was changed to checking whether the ball was potentially crossing into an area that had a brick.  This was done by separating the checks into a grid that represented the locations of the blocks.  In this case, there was an initial check to see if the ball was crossing a boundary where there might be a new brick.  If the ball is crossing the x-boundary and not the y-boundary, then there would be a collision check to see if it collided with a block.  If it is crossing the y-boundary and not the x-boundary, once again then there would be a collision check to see if it collided with a block.  If it is crossing both the x-boundary and y-boundary, then there would be a check to see which boundary the ball would cross first.  This new logic allowed for us to account for the case where the block enters the block diagonally.  This taught us that sometimes it is beneficial to scrap a previous iteration and use a new approach to solving a problem because it may lead to better results.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Movement ===&lt;br /&gt;
One issue we discovered was the paddle would slow down as it approached the walls. This was due to the difference in &amp;quot;current desired paddle position&amp;quot; and the previous paddle position becoming smaller as the walls were approached, leading to a smaller paddle velocity. To account for this, whenever the accelerometer sent data that mapped to the minimum or maximum paddle index, we would increase the distance of the &amp;quot;current desired paddle position&amp;quot; so the paddle velocity would not slow the paddle down as it approached the walls.&lt;br /&gt;
&lt;br /&gt;
=== Paddle Collision Logic ===&lt;br /&gt;
During final integration and testing, one of the biggest issues we encountered was a bug where the ball would not detect a collision with the paddle.  The ball would phase right through the paddle instead of bouncing off of it.  One of the great ideas that we thought of was to change the color of the ball during each check to see if the checks would go through.  This debug check allowed us to verify that section of code that checked for paddle collisions was being skipped even though the ball's next Y position had crossed the paddle's Y position. By having this debugging method, we were able to root cause the issue.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Conclude your project here.  You can recap your testing and problems.  You should address the &amp;quot;so what&amp;quot; part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
[https://www.youtube.com/watch?v=ipngAGlN86c SJSU CMPE 244 FALL 2021: Embedded Software Project Gameplay]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
*  [https://gitlab.com/fayek.wahhab/sjtwo-c/-/tree/feature/i2s_dma2 Treasure Dive Baseline for Demo Source Code]&lt;br /&gt;
*  [https://gitlab.com/hobriandh/sjtwo-c/-/tree/final_controller Controller for Demo Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to acknowledge and thank our instructor Preetpal Kang for sharing his knowledge in embedded software development using FreeRTOS.&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*[https://gitlab.com/sjtwo-c-dev/sjtwo-c/-/blob/master/LPC408X_7X%20User%20Manual.pdf LPC408x/407x Datasheet]&lt;br /&gt;
*[https://www.freertos.org/Documentation/RTOS_book.html FreeRTOS Documentation]&lt;br /&gt;
*[http://elm-chan.org/fsw/ff/00index_e.html FatFs - Generic FAT Filesystem Module]&lt;br /&gt;
*[https://www.digi.com/resources/library/data-sheets/ds_xbeemultipointmodules Xbee Datasheet]&lt;br /&gt;
*[http://books.socialledge.com/books/embedded-drivers-real-time-operating-systems Embedded Drivers &amp;amp; Real Time Operating Systems Lessons]&lt;/div&gt;</summary>
		<author><name>Proj user1</name></author>	</entry>

	</feed>