Displays a full size image (96px by 96px) on the Hexiwear OLED display then displays a smaller image (96px by 32px) on the bottom portion of the display.

Dependencies:   Hexi_OLED_SSD1351

Fork of Hexi_OLED_Image_Example by Hexiwear

Committer:
khuang
Date:
Fri Aug 26 23:06:14 2016 +0000
Revision:
2:2f0f1b37dae3
Parent:
1:ecdf33275ec0
Child:
3:84f8d56a3ded
Image Example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
khuang 0:64580390e64a 1 #include "mbed.h"
khuang 0:64580390e64a 2 #include "Hexi_OLED_SSD1351.h"
khuang 0:64580390e64a 3 #include "images.h"
khuang 0:64580390e64a 4 #include "OLED_types.h"
khuang 0:64580390e64a 5
khuang 0:64580390e64a 6 /*
khuang 2:2f0f1b37dae3 7 * Bitmaps need to be formatted as 16bppRgb565, flipped vertically
khuang 2:2f0f1b37dae3 8 * and a 6 byte header needs to be appended at the start of the array.
khuang 2:2f0f1b37dae3 9 * Use the following tool to create arrays for images.
khuang 2:2f0f1b37dae3 10 * https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
khuang 2:2f0f1b37dae3 11 * It takes an image and outputs the array. It handles the flipping and the 6 byte header.
khuang 2:2f0f1b37dae3 12 * Image needs to be converted outside the tool to fit the screen
khuang 2:2f0f1b37dae3 13 * (Max Dimensions:96px by 96px).
khuang 0:64580390e64a 14 */
khuang 0:64580390e64a 15
khuang 0:64580390e64a 16 int main() {
khuang 0:64580390e64a 17
khuang 2:2f0f1b37dae3 18 /* Pointer for the image to be displayed */
khuang 0:64580390e64a 19 const uint8_t *image1;
khuang 0:64580390e64a 20 const uint8_t *image2;
khuang 0:64580390e64a 21
khuang 2:2f0f1b37dae3 22 /* Setting pointer location of the 96 by 96 pixel bitmap */
khuang 0:64580390e64a 23 image1 = NXP_whole_bmp;
khuang 0:64580390e64a 24
khuang 2:2f0f1b37dae3 25 /* Setting pointer location of the 96 by 32 pixel bitmap */
khuang 0:64580390e64a 26 image2 = NXP_banner_bmp;
khuang 0:64580390e64a 27
khuang 2:2f0f1b37dae3 28 /* Instantiate the SSD1351 OLED Driver */
khuang 0:64580390e64a 29 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC)
khuang 0:64580390e64a 30
khuang 2:2f0f1b37dae3 31 /* Turn on the backlight of the OLED Display */
khuang 0:64580390e64a 32 oled.DimScreenON();
khuang 0:64580390e64a 33
khuang 0:64580390e64a 34 while (true) {
khuang 0:64580390e64a 35
khuang 2:2f0f1b37dae3 36 /* Fill the screen with white to overwrite previous image */
khuang 0:64580390e64a 37 oled.FillScreen(COLOR_WHITE);
khuang 2:2f0f1b37dae3 38
khuang 2:2f0f1b37dae3 39 /* Fill 96px by 96px Screen with 96px by 96px NXP Image starting at x=0,y=0 */
khuang 0:64580390e64a 40 oled.DrawImage(image1,0,0);
khuang 0:64580390e64a 41
khuang 0:64580390e64a 42 Thread::wait(2000);
khuang 0:64580390e64a 43
khuang 2:2f0f1b37dae3 44 /* Fill the screen with white to overwrite previous image */
khuang 0:64580390e64a 45 oled.FillScreen(COLOR_WHITE);
khuang 2:2f0f1b37dae3 46 /* Draw 96px by 32px NXP Banner at the bottom by setting x =0,y=64(96-32)*/
khuang 0:64580390e64a 47 oled.DrawImage(image2,0,64);
khuang 0:64580390e64a 48
khuang 0:64580390e64a 49 Thread::wait(2000);
khuang 0:64580390e64a 50
khuang 0:64580390e64a 51 }
khuang 0:64580390e64a 52 }
khuang 0:64580390e64a 53