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 01:18:32 2016 +0000
Revision:
0:3975ec26d269
Child:
1:e5806bc5d2e9
initial;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
keithm01 0:3975ec26d269 1 #include "mbed.h"
keithm01 0:3975ec26d269 2
keithm01 0:3975ec26d269 3 #include "hexidraw.h"
keithm01 0:3975ec26d269 4
keithm01 0:3975ec26d269 5 //DigitalOut led_red(PTC8);
keithm01 0:3975ec26d269 6 //DigitalOut led_green(PTD0);
keithm01 0:3975ec26d269 7 DigitalOut led_blue(PTC9);
keithm01 0:3975ec26d269 8
keithm01 0:3975ec26d269 9 OLED oled;
keithm01 0:3975ec26d269 10
keithm01 0:3975ec26d269 11 // main() runs in its own thread in the OS
keithm01 0:3975ec26d269 12 // (note the calls to Thread::wait below for delays)
keithm01 0:3975ec26d269 13 int main() {
keithm01 0:3975ec26d269 14 oled.begin();
keithm01 0:3975ec26d269 15 oled.wake();
keithm01 0:3975ec26d269 16
keithm01 0:3975ec26d269 17 oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, BLACK);
keithm01 0:3975ec26d269 18 oled.pixel(1, 1, Color565(0, 255, 0));
keithm01 0:3975ec26d269 19 uint16_t c1 = Color565(255, 0, 0);
keithm01 0:3975ec26d269 20 uint16_t c2 = Color565(0, 255, 0);
keithm01 0:3975ec26d269 21 uint16_t c3 = Color565(0, 0, 255);
keithm01 0:3975ec26d269 22 uint8_t i = 0;
keithm01 0:3975ec26d269 23 while (true) {
keithm01 0:3975ec26d269 24 if(i == 0)
keithm01 0:3975ec26d269 25 oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c1);
keithm01 0:3975ec26d269 26 if(i == 1)
keithm01 0:3975ec26d269 27 oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c2);
keithm01 0:3975ec26d269 28 if(i == 2)
keithm01 0:3975ec26d269 29 oled.rect(0, 0, OLED_WIDTH, OLED_HEIGHT, c3);
keithm01 0:3975ec26d269 30 led_blue = !led_blue;
keithm01 0:3975ec26d269 31 Thread::wait(500);
keithm01 0:3975ec26d269 32 ++i;
keithm01 0:3975ec26d269 33 if(i > 2)
keithm01 0:3975ec26d269 34 i = 0;
keithm01 0:3975ec26d269 35 }
keithm01 0:3975ec26d269 36 }
keithm01 0:3975ec26d269 37