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:
3:e8bbba5c43ba
Parent:
2:ef14c6dd6b93
Child:
4:9c0b59439725
--- a/hexidraw.h	Fri Aug 19 22:12:11 2016 +0000
+++ b/hexidraw.h	Fri Aug 19 22:24:54 2016 +0000
@@ -21,6 +21,8 @@
     #define OLED_BMP_HEADER_BYTE_SIZE (6)
     
     #define OLED_SPI_CHUNK (511)
+    
+    #define OLED_SKIP_IMAGE_HEADER( imgPtr ) ( (const uint8_t*)(imgPtr) + OLED_BMP_HEADER_BYTE_SIZE )
         
     /* borrowed from the Adafruit library at:
         https://developer.mbed.org/teams/ELLA-Robotics-Inc/code/Adafruit_GFX_1351/ 
@@ -41,7 +43,7 @@
             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);
+            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);
         private:
             SPI _spi;
             DigitalOut _cs, _dc, _reset;