Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Hexi_OLED_SSD1351
Fork of Hexi_OLED_Image_Example by
main.cpp
00001 #include "mbed.h" 00002 #include "Hexi_OLED_SSD1351.h" 00003 #include "images.h" 00004 00005 /* 00006 * Bitmaps need to be formatted as 16bppRgb565, flipped vertically 00007 * and a 6 byte header needs to be appended at the start of the array. 00008 * Use the following tool to create arrays for images. 00009 * https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool 00010 * It takes an image and outputs the array. It handles the flipping and the 6 byte header. 00011 * Image needs to be converted outside the tool to fit the screen 00012 * (Max Dimensions:96px by 96px). 00013 */ 00014 00015 int main() { 00016 00017 /* Pointer for the image to be displayed */ 00018 const uint8_t *image1; 00019 const uint8_t *image2; 00020 00021 /* Setting pointer location of the 96 by 96 pixel bitmap */ 00022 image1 = NXP_whole_bmp; 00023 00024 /* Setting pointer location of the 96 by 32 pixel bitmap */ 00025 image2 = NXP_banner_bmp; 00026 00027 /* Instantiate the SSD1351 OLED Driver */ 00028 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC) 00029 00030 /* Turn on the backlight of the OLED Display */ 00031 oled.DimScreenON(); 00032 00033 while (true) 00034 { 00035 00036 /* Fill the screen with white to overwrite previous image */ 00037 oled.FillScreen(COLOR_WHITE); 00038 00039 /* Fill 96px by 96px Screen with 96px by 96px NXP Image starting at x=0,y=0 */ 00040 oled.DrawImage(image1,0,0); 00041 00042 Thread::wait(2000); 00043 00044 /* Fill the screen with white to overwrite previous image */ 00045 oled.FillScreen(COLOR_WHITE); 00046 00047 /* Draw 96px by 32px NXP Banner at the bottom by setting x =0,y=64(96-32)*/ 00048 oled.DrawImage(image2,0,64); 00049 00050 Thread::wait(2000); 00051 } 00052 } 00053
Generated on Fri Jul 15 2022 22:03:04 by
1.7.2
