WIP demo program for using my Hexidraw library

Dependencies:   Hexidraw

Demo app for using my Hexidraw library for drawing on the Hexiwear's OLED

Committer:
keithm01
Date:
Fri Aug 19 22:12:34 2016 +0000
Revision:
1:e5806bc5d2e9
Parent:
0:3975ec26d269
Added image drawing example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
keithm01 0:3975ec26d269 1 #include "mbed.h"
keithm01 0:3975ec26d269 2 #include "hexidraw.h"
keithm01 0:3975ec26d269 3
keithm01 1:e5806bc5d2e9 4 #include "images.h"
keithm01 1:e5806bc5d2e9 5
keithm01 0:3975ec26d269 6 DigitalOut led_blue(PTC9);
keithm01 0:3975ec26d269 7
keithm01 0:3975ec26d269 8 OLED oled;
keithm01 0:3975ec26d269 9
keithm01 0:3975ec26d269 10 int main() {
keithm01 0:3975ec26d269 11 oled.begin();
keithm01 0:3975ec26d269 12 oled.wake();
keithm01 1:e5806bc5d2e9 13 oled.clear(BLACK);
keithm01 0:3975ec26d269 14
keithm01 1:e5806bc5d2e9 15 //Draw a background image
keithm01 1:e5806bc5d2e9 16 oled.image(0,0,hexi_gradiant_bmp_bmp);
keithm01 1:e5806bc5d2e9 17
keithm01 1:e5806bc5d2e9 18 //Draw the olympic rings
keithm01 1:e5806bc5d2e9 19 uint16_t rad = 10;
keithm01 1:e5806bc5d2e9 20 uint8_t pad = 2;
keithm01 1:e5806bc5d2e9 21 uint8_t width = 3;
keithm01 1:e5806bc5d2e9 22 oled.circle(OLED_WIDTH/2, OLED_HEIGHT/2, rad, Color565(0,0,0), width);
keithm01 1:e5806bc5d2e9 23
keithm01 1:e5806bc5d2e9 24 oled.circle((OLED_WIDTH/2)-((rad*2)+pad), OLED_HEIGHT/2, rad, Color565(0,0,255), width);
keithm01 1:e5806bc5d2e9 25 oled.circle((OLED_WIDTH/2)+((rad*2)+pad), OLED_HEIGHT/2, rad, Color565(255,0,0), width);
keithm01 1:e5806bc5d2e9 26
keithm01 1:e5806bc5d2e9 27 oled.circle((OLED_WIDTH/2)-((rad*2)/2), OLED_HEIGHT/2+(rad+pad), rad, Color565(255,255,0), width);
keithm01 1:e5806bc5d2e9 28 oled.circle((OLED_WIDTH/2)+((rad*2)/2), OLED_HEIGHT/2+(rad+pad), rad, Color565(0,255,0), width);
keithm01 1:e5806bc5d2e9 29
keithm01 1:e5806bc5d2e9 30
keithm01 0:3975ec26d269 31 while (true) {
keithm01 0:3975ec26d269 32 led_blue = !led_blue;
keithm01 0:3975ec26d269 33 Thread::wait(500);
keithm01 0:3975ec26d269 34 }
keithm01 0:3975ec26d269 35 }
keithm01 0:3975ec26d269 36