Library for drawing on the Hexiwear's OLED - more features being actively worked on

Dependents:   Hexidraw_Demo Hexiwear-FinalProject_v2

Discussion: https://developer.mbed.org/forum/team-4615-Hexiwear-community/topic/26595/

Hexidraw is a library for drawing on the Hexiwear's OLED. Be aware that it is not very optimized, so drawing may be slow, especially when drawing on large areas of the screen.

Please see the wiki for API documentation.

Features:

  • Screen fill with a color
  • Drawing filled rectangles
  • Drawing circles with a set radius and line width
  • Setting individual pixels
  • Turning on and off the OLED's sleep mode
  • Drawing images

Example project: https://developer.mbed.org/users/keithm01/code/Hexidraw_Demo/

Committer:
keithm01
Date:
Fri Aug 19 01:17:28 2016 +0000
Revision:
0:2d3fcb6dabd4
Child:
1:82ccc138bbe6
initial;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
keithm01 0:2d3fcb6dabd4 1
keithm01 0:2d3fcb6dabd4 2 #ifndef _HEXIDRAW_H_
keithm01 0:2d3fcb6dabd4 3 #define _HEXIDRAW_H_
keithm01 0:2d3fcb6dabd4 4
keithm01 0:2d3fcb6dabd4 5 #include <mbed.h>
keithm01 0:2d3fcb6dabd4 6 #include <stdarg.h>
keithm01 0:2d3fcb6dabd4 7
keithm01 0:2d3fcb6dabd4 8 #include "oled_info.h"
keithm01 0:2d3fcb6dabd4 9
keithm01 0:2d3fcb6dabd4 10 #define BLACK 0x0000
keithm01 0:2d3fcb6dabd4 11 #define WHITE 0xffff
keithm01 0:2d3fcb6dabd4 12
keithm01 0:2d3fcb6dabd4 13 /* borrowed from the Adafruit library at:
keithm01 0:2d3fcb6dabd4 14 https://developer.mbed.org/teams/ELLA-Robotics-Inc/code/Adafruit_GFX_1351/
keithm01 0:2d3fcb6dabd4 15 Since I don't know enough to make my own function :) */
keithm01 0:2d3fcb6dabd4 16 uint16_t Color565(uint8_t r, uint8_t g, uint8_t b) ;
keithm01 0:2d3fcb6dabd4 17
keithm01 0:2d3fcb6dabd4 18 class OLED {
keithm01 0:2d3fcb6dabd4 19 public:
keithm01 0:2d3fcb6dabd4 20 OLED();
keithm01 0:2d3fcb6dabd4 21 void writeCommand(uint8_t v);
keithm01 0:2d3fcb6dabd4 22 void writeData(uint8_t v);
keithm01 0:2d3fcb6dabd4 23 void begin();
keithm01 0:2d3fcb6dabd4 24 void sleep();
keithm01 0:2d3fcb6dabd4 25 void wake();
keithm01 0:2d3fcb6dabd4 26 void pixel(int16_t x, int16_t y, uint16_t color);
keithm01 0:2d3fcb6dabd4 27 void cursor(int x, int y);
keithm01 0:2d3fcb6dabd4 28 void rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t fillcolor);
keithm01 0:2d3fcb6dabd4 29 private:
keithm01 0:2d3fcb6dabd4 30 SPI _spi;
keithm01 0:2d3fcb6dabd4 31 DigitalOut _cs, _dc, _reset;
keithm01 0:2d3fcb6dabd4 32 };
keithm01 0:2d3fcb6dabd4 33
keithm01 0:2d3fcb6dabd4 34 #endif