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:
4:9c0b59439725
Parent:
3:e8bbba5c43ba
Child:
5:00876457cad4
--- a/hexidraw.h	Fri Aug 19 22:24:54 2016 +0000
+++ b/hexidraw.h	Sat Aug 20 16:34:55 2016 +0000
@@ -23,6 +23,8 @@
     #define OLED_SPI_CHUNK (511)
     
     #define OLED_SKIP_IMAGE_HEADER( imgPtr ) ( (const uint8_t*)(imgPtr) + OLED_BMP_HEADER_BYTE_SIZE )
+    
+    #define USE_BUFFER 1
         
     /* borrowed from the Adafruit library at:
         https://developer.mbed.org/teams/ELLA-Robotics-Inc/code/Adafruit_GFX_1351/ 
@@ -43,10 +45,15 @@
             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 + OLED_BMP_HEADER_BYTE_SIZE);
+            void image (uint16_t x, uint16_t y, const uint8_t* image);
+            void hline(uint16_t x, uint16_t y, uint16_t width, uint16_t color, uint16_t thickness = 1);
+            void vline(uint16_t x, uint16_t y, uint16_t height, uint16_t color, uint16_t thickness = 1);
+            void draw();
         private:
             SPI _spi;
             DigitalOut _cs, _dc, _reset;
+            uint16_t displayBuffer[OLED_WIDTH * OLED_HEIGHT];
+            void text(uint16_t x, uint16_t y, const uint8_t* text, const uint8_t* font, uint16_t color = WHITE);
         };
 
 #endif
\ No newline at end of file