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/

Revision:
2:ef14c6dd6b93
Parent:
1:82ccc138bbe6
Child:
3:e8bbba5c43ba
--- a/hexidraw.h	Fri Aug 19 16:28:09 2016 +0000
+++ b/hexidraw.h	Fri Aug 19 22:12:11 2016 +0000
@@ -10,6 +10,18 @@
     #define BLACK 0x0000
     #define WHITE 0xffff
     
+    #define OLED_WIDTH 96
+    #define OLED_HEIGHT 96
+    
+    #define OLED_BYTES_PER_PIXEL ( 2 )
+    
+    #define OLED_COL_OFFSET 16
+    
+    #define OLED_IMAGE_SIZE ( OLED_WIDTH * OLED_HEIGHT * OLED_BYTES_PER_PIXEL )
+    #define OLED_BMP_HEADER_BYTE_SIZE (6)
+    
+    #define OLED_SPI_CHUNK (511)
+        
     /* borrowed from the Adafruit library at:
         https://developer.mbed.org/teams/ELLA-Robotics-Inc/code/Adafruit_GFX_1351/ 
        Since I don't know enough to make my own function :) */
@@ -28,6 +40,8 @@
             void rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t fillcolor);
             void dim();
             void clear(uint16_t color);
+            void circle(uint16_t x, uint16_t y, uint16_t radius, uint16_t color, uint16_t width = 1);
+            void image (uint16_t x, uint16_t y, const uint8_t* image, uint32_t image_data_size = OLED_IMAGE_SIZE);
         private:
             SPI _spi;
             DigitalOut _cs, _dc, _reset;