to remember what's important
Dependencies: Hexi_OLED_SSD1351
Fork of Hexi_OLED_Image_Example by
Revision 2:2f0f1b37dae3, committed 2016-08-26
- Comitter:
- khuang
- Date:
- Fri Aug 26 23:06:14 2016 +0000
- Parent:
- 1:ecdf33275ec0
- Child:
- 3:84f8d56a3ded
- Commit message:
- Image Example
Changed in this revision
--- a/Hexi_OLED_SSD1351.lib Fri Aug 19 00:14:06 2016 +0000 +++ b/Hexi_OLED_SSD1351.lib Fri Aug 26 23:06:14 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/Hexiwear/code/Hexi_OLED_SSD1351/#3b5be0ee5f0c +https://developer.mbed.org/teams/Hexiwear/code/Hexi_OLED_SSD1351/#9961c525e249
--- a/README.md Fri Aug 19 00:14:06 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -# Getting started with Blinky on mbed OS - -This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform. - -Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). - -## Get the example application! - -From the command line, import the example: - -``` -mbed import mbed-os-example-blinky -cd mbed-os-example-blinky -``` - -### Now compile - -Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: - -``` -mbed compile -m K64F -t ARM -``` - -Your PC may take a few minutes to compile your code. At the end you should get the following result: - -``` -[snip] -+----------------------------+-------+-------+------+ -| Module | .text | .data | .bss | -+----------------------------+-------+-------+------+ -| Misc | 13939 | 24 | 1372 | -| core/hal | 16993 | 96 | 296 | -| core/rtos | 7384 | 92 | 4204 | -| features/FEATURE_IPV4 | 80 | 0 | 176 | -| frameworks/greentea-client | 1830 | 60 | 44 | -| frameworks/utest | 2392 | 512 | 292 | -| Subtotals | 42618 | 784 | 6384 | -+----------------------------+-------+-------+------+ -Allocated Heap: unknown -Allocated Stack: unknown -Total Static RAM memory (data + bss): 7168 bytes -Total RAM memory (data + bss + heap + stack): 7168 bytes -Total Flash memory (text + data + misc): 43402 bytes -Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin -``` - -### Program your board - -1. Connect your mbed device to the computer over USB. -1. Copy the binary file to the mbed device . -1. Press the reset button to start the program. - -You should see the LED of your platform turning on and off. - -Congratulations if you managed to complete this test! - -## Export the project to Keil MDK and debug your application - -From the command line, run the following command: - -``` -mbed export -m K64F -i uvision -``` - -You should see the following output: - -``` -Successful exports: - * K64F::uvision .\projectfiles\uvision_K64F\Unnamed_Project -``` - -To debug the application: - -1. Start uVision. -1. Import the uVision project generated earlier. -1. Compile your application and generate an `.axf` file. -1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). -1. Set breakpoints and start a debug session. - - - -## Troubleshooting - -1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` - - ``` - mbed --version - ``` - - If not, you can update it easily: - - ``` - pip install mbed-cli --upgrade - ``` - -2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size.
--- a/images.c Fri Aug 19 00:14:06 2016 +0000
+++ b/images.c Fri Aug 26 23:06:14 2016 +0000
@@ -1,12 +1,49 @@
- #include "images.h"
+ /* Hexiwear NXP Bitmap Images
+ * This file contains the bitmaps for the full screen (96 by 96 pixels) NXP logo
+ * and a smaller 96 by 32 pixels NXP logo.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of NXP, nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * visit: http://www.mikroe.com and http://www.nxp.com
+ *
+ * get support at: http://www.mikroe.com/forum and https://community.nxp.com
+ *
+ * Project HEXIWEAR, 2015
+ */
+
+#include "images.h"
+
/*
-Bitmaps need to be formatted as 16bppRgb565, flipped vertically
-and a 6 byte header needs to be appended at the start of the array.
-Use the following tool to create arrays for images.
-https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
-It takes an image and outputs the array. It handles the flipping and the 6 byte header.
-Image needs to be converted outside the tool to fit the screen (96px by 96px).
+* Bitmaps need to be formatted as 16bppRgb565, flipped vertically
+* and a 6 byte header needs to be appended at the start of the array.
+* Use the following tool to create arrays for images.
+* https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
+* It takes an image and outputs the array. It handles the flipping and the 6 byte header.
+* Image needs to be converted outside the tool to fit the screen (96px by 96px).
*/
const uint8_t NXP_banner_bmp[6150] = {
--- a/images.h Fri Aug 19 00:14:06 2016 +0000 +++ b/images.h Fri Aug 26 23:06:14 2016 +0000 @@ -1,5 +1,41 @@ + /* Hexiwear NXP Bitmap Images + * This file contains the bitmaps for the full screen (96 by 96 pixels) NXP logo + * and a smaller 96 by 32 pixels NXP logo. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * Neither the name of NXP, nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * visit: http://www.mikroe.com and http://www.nxp.com + * + * get support at: http://www.mikroe.com/forum and https://community.nxp.com + * + * Project HEXIWEAR, 2015 + */ + + #include "stdint.h" - extern const uint8_t NXP_whole_bmp[]; extern const uint8_t NXP_banner_bmp[6150];
--- a/main.cpp Fri Aug 19 00:14:06 2016 +0000
+++ b/main.cpp Fri Aug 26 23:06:14 2016 +0000
@@ -2,47 +2,48 @@
#include "Hexi_OLED_SSD1351.h"
#include "images.h"
#include "OLED_types.h"
-#include "OLED_fonts.h"
/*
-Bitmaps need to be formatted as 16bppRgb565, flipped vertically
-and a 6 byte header needs to be appended at the start of the array.
-Use the following tool to create arrays for images.
-https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
-It takes an image and outputs the array. It handles the flipping and the 6 byte header.
-Image needs to be converted outside the tool to fit the screen (96px by 96px).
+* Bitmaps need to be formatted as 16bppRgb565, flipped vertically
+* and a 6 byte header needs to be appended at the start of the array.
+* Use the following tool to create arrays for images.
+* https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
+* It takes an image and outputs the array. It handles the flipping and the 6 byte header.
+* Image needs to be converted outside the tool to fit the screen
+* (Max Dimensions:96px by 96px).
*/
int main() {
- //Pointer for the image to be displayed
+ /* Pointer for the image to be displayed */
const uint8_t *image1;
const uint8_t *image2;
- //Setting pointer location of the 96 by 96 pixel bitmap
+ /* Setting pointer location of the 96 by 96 pixel bitmap */
image1 = NXP_whole_bmp;
- //Setting pointer location of the 96 by 32 pixel bitmap
+ /* Setting pointer location of the 96 by 32 pixel bitmap */
image2 = NXP_banner_bmp;
- //Instantiate the SSD1351 OLED Driver
+ /* Instantiate the SSD1351 OLED Driver */
SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC)
- //Turn on the backlight of the OLED Display
+ /* Turn on the backlight of the OLED Display */
oled.DimScreenON();
while (true) {
- //Fill the screen with white to overwrite previous image
+ /* Fill the screen with white to overwrite previous image */
oled.FillScreen(COLOR_WHITE);
- //Fill 96px by 96px Screen with 96px by 96px NXP Image starting at x=0,y=0
+
+ /* Fill 96px by 96px Screen with 96px by 96px NXP Image starting at x=0,y=0 */
oled.DrawImage(image1,0,0);
Thread::wait(2000);
- //Fill the screen with white to overwrite previous image
+ /* Fill the screen with white to overwrite previous image */
oled.FillScreen(COLOR_WHITE);
- //Draw 96px by 32px NXP Banner at the bottom by setting x =0,y=64(96-32)
+ /* Draw 96px by 32px NXP Banner at the bottom by setting x =0,y=64(96-32)*/
oled.DrawImage(image2,0,64);
Thread::wait(2000);
