Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Instructions: This exam is completely open book and open notes. You may use any coding techniques and may introduce any variables unless otherwise specified.
Motivation : The beginning of our class has focused on the basics of Embedded systems and both the C and Assembly languages that are used to program our microcontrollers. I mentioned in class that the study of Embedded systems has many parallels to a Signals and Systems course, both including inputs that are operated on to produce outputs. In Embedded systems, inputs are typically provided by sensors and outputs are implemented as actuators. One of the most common ways to provide this I/O capability to an operator is through the use of a TFT touch screen.
During a recent Embedded project, the primary human I/O utilized a wearable round TFT touch screen similar to a watch form. factor. The TFT I choose was a 240 x 240 pixel 1.28” display (reasonable due to its size and resolution). This exam focusses on the design and implementation considerations of this peripheral. Start a PlatformIO project, select you STM32F429 microcontroller, and lets build the project.
Question 1:
One of the requirements of using a screen is often displaying an image. For this screen, The image is requires to be a single row oriented array of 16 bit “color” values. So if your image is a square 20 x 20 image, you need to setup a 400 element array of 16 bit values (row by row). There are plent of tools available to convert images to RGB values, which is referred to 24 bit color: 8 bits for Red, followed by 8 bits for Green, followed by 8 bits for Blue (blue is the LSB). To save memory, the TFT screen does not use 24 bit color, but uses 16 bit color instead. The format is called RGB 565 (5 bits of Red, 6 bits of Green, 5 bits of Blue; 16 total bits where Blue is least significant. For each color, the new format takes the MSBits to make the new truncate bits. Lets assume we have a 20 x 20 image that we already converted to RGB, meaning we have a uint8_t array called myImage[1200] which contains 3 bytes for each pixel (that’s why the array size is 400 x 3 = 1200).
Formats:
RGB = R7 RRRRRRR0 G7GGGGGGG0 B7 BBBBBBB0 (3 BYTES)
RGB565= R7 RRRR3G7GG5 G4GG2 B7 BBBB3 (2 BYTES)
Write an ARM assembly function called convImage that takes in three parameters. The first parameter is a pointer to myImage. The second parameter is a pointer to a uint16_t array that holds the converted 16 bit color values of the image. The third parameter is the number of pixels in the image. The function should be generic for any size image. Be sure to comment appropriately.