Updates
Update 1
Wii Nunchuk
After some experimentation with delays in the initialization sequence, I have successfully interfaced with the Wii Nunchuk via I2C.
The picture on the right shows the data received from Nunchuk, displayed via UART
Buttons C and Z work fine - 0 for pressed and 1 for not pressed
Range of the joysticks are limited - range from about 0x23 to 0xe0, rather than 0x00 to 0xFF.
Can account for this range when programming, or can try with a different Nunchuks
ILI9341 TFT LCD Screen
I spent the majority of this week working on interfacing with the ILI9341 TFT LCD screen
Unfortunately, I have not been able to get the screen to initialize
I think that one of the following is responsible:
Something wrong with the SPI setup
Something wrong with the SPI send function
Will use a logic analyzer to check validity of the SPI setup and send function
Something wrong with the initialization sequence, like delays and timing
I have looked at the initialization sequence of this LCD driver from the datasheet and other libraries, but had no luck
If SPI setup is correct and initialization sequence not working, I will try using a different display
Update 2
After connecting the logic analyzer
I fixed the SPI settings
Turns out, PC14 and PC15, the pins I chose for DC and RST, are reserved for OSC32 on the Disco Board
switched to PH0 and PH1 as output pins for DC and RST
ILI9341 Screen Successfully completed its initialization sequence
After experimenting with the ILI9341 screen,
240 * 320 screen, each pixel was represented by 16bits or 2 bytes
Each full screen draw would take 153 K Bytes
The frames were not drawing fast enough => flickering
This needs techniques such as overdrawing to speed things up
Due to slow frames with the ILI9341 screen, I decided to switch to a smaller, simpler LCD screen : the Nokia 5110 LCD Display.
48*84 monochrome display, each pixel represented by 0 or 1
48*84 = 4032 bits or 504 Bytes
It is feasible to drawn on a frame buffer, and send it out to the screen
Using the Adafruit PCD8544 library as reference, I have implemented a simple library to initialize the LCD, as well as draw simple shapes.
I have finished setting up the game screen and some basic collision, but haven't implemented paddle collision or game state logic.
Update 3
Implemented a state machine for different game states, like start game, pause, game over
Added collision to paddles
Added basic AI for enemy paddle