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:
cotigac
Date:
Sun Aug 28 16:51:18 2016 +0000
Revision:
3:84f8d56a3ded
Parent:
2:2f0f1b37dae3
removed dependencies to oled types

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
khuang 0:64580390e64a 5 /*
khuang 2:2f0f1b37dae3 6 * Bitmaps need to be formatted as 16bppRgb565, flipped vertically
khuang 2:2f0f1b37dae3 7 * and a 6 byte header needs to be appended at the start of the array.
khuang 2:2f0f1b37dae3 8 * Use the following tool to create arrays for images.
khuang 2:2f0f1b37dae3 9 * https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
khuang 2:2f0f1b37dae3 10 * It takes an image and outputs the array. It handles the flipping and the 6 byte header.
khuang 2:2f0f1b37dae3 11 * Image needs to be converted outside the tool to fit the screen
khuang 2:2f0f1b37dae3 12 * (Max Dimensions:96px by 96px).
khuang 0:64580390e64a 13 */
khuang 0:64580390e64a 14
khuang 0:64580390e64a 15 int main() {
khuang 0:64580390e64a 16
khuang 2:2f0f1b37dae3 17 /* Pointer for the image to be displayed */
khuang 0:64580390e64a 18 const uint8_t *image1;
khuang 0:64580390e64a 19 const uint8_t *image2;
khuang 0:64580390e64a 20
khuang 2:2f0f1b37dae3 21 /* Setting pointer location of the 96 by 96 pixel bitmap */
khuang 0:64580390e64a 22 image1 = NXP_whole_bmp;
khuang 0:64580390e64a 23
khuang 2:2f0f1b37dae3 24 /* Setting pointer location of the 96 by 32 pixel bitmap */
khuang 0:64580390e64a 25 image2 = NXP_banner_bmp;
khuang 0:64580390e64a 26
khuang 2:2f0f1b37dae3 27 /* Instantiate the SSD1351 OLED Driver */
khuang 0:64580390e64a 28 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC)
khuang 0:64580390e64a 29
khuang 2:2f0f1b37dae3 30 /* Turn on the backlight of the OLED Display */
khuang 0:64580390e64a 31 oled.DimScreenON();
khuang 0:64580390e64a 32
cotigac 3:84f8d56a3ded 33 while (true)
cotigac 3:84f8d56a3ded 34 {
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);
cotigac 3:84f8d56a3ded 46
khuang 2:2f0f1b37dae3 47 /* Draw 96px by 32px NXP Banner at the bottom by setting x =0,y=64(96-32)*/
khuang 0:64580390e64a 48 oled.DrawImage(image2,0,64);
khuang 0:64580390e64a 49
khuang 0:64580390e64a 50 Thread::wait(2000);
cotigac 3:84f8d56a3ded 51 }
khuang 0:64580390e64a 52 }
khuang 0:64580390e64a 53