Code for the Hexiwear sensor system. Requires an Air Quality Click, Carbon Monoxide Click, and Buzzer Click for full functionality. Currently only reads values and displays to the OLED while testing and alerting the user of present threats. Future goals are to incorporate button presses with separate screens to display the data as well as using the KW40 drivers to transmit the data. Still in early stages of development, many unnecessary files will be removed and cleaned up once final product is completed within the next month. Driver.cpp is the main driver for the program and was written for purposes of this project. All other headers and functions were found on mbed.org from other developers repositories or provided by NXP Semiconductors for purposes of this project.

Dependencies:   Hexi_KW40Z images

Files at this revision

API Documentation at this revision

Comitter:
Gfolker
Date:
Wed Mar 15 19:14:55 2017 +0000
Child:
1:8ab4a1e27785
Commit message:
v1.0 of Hexiwear Sensor system. Currently able to detect air quality and carbon monoxide and display to the screen with alerts on the PWM buzzer click module and RGB LED.

Changed in this revision

Hexi_KW40Z.lib Show annotated file Show diff for this revision Revisions of this file
Hexi_OLED_SSD1351.cpp Show annotated file Show diff for this revision Revisions of this file
Hexi_OLED_SSD1351.h Show annotated file Show diff for this revision Revisions of this file
OLED_info.h Show annotated file Show diff for this revision Revisions of this file
OLED_types.h Show annotated file Show diff for this revision Revisions of this file
OpenSans_Font.c Show annotated file Show diff for this revision Revisions of this file
OpenSans_Font.h Show annotated file Show diff for this revision Revisions of this file
driver.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
pwm_tone.cpp Show annotated file Show diff for this revision Revisions of this file
pwm_tone.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hexi_KW40Z.lib	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Hexiwear/code/Hexi_KW40Z/#3f5ed7abc5c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hexi_OLED_SSD1351.cpp	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,1518 @@
+/** OLED Display Driver for Hexiwear
+ *  This file contains OLED driver functionality for drawing images and text
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of NXP, nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * visit: http://www.mikroe.com and http://www.nxp.com
+ *
+ * get support at: http://www.mikroe.com/forum and https://community.nxp.com
+ *
+ * Project HEXIWEAR, 2015
+ */
+
+#include "OLED_types.h"
+#include "OLED_info.h"
+#include "mbed.h"
+#include "Hexi_OLED_SSD1351.h"
+#include "OpenSans_Font.h"
+   
+const init_cmd_t seq[] = {
+    OLED_CMD_SET_CMD_LOCK,  CMD_BYTE,
+    OLED_UNLOCK,            DATA_BYTE,
+    OLED_CMD_SET_CMD_LOCK,  CMD_BYTE,
+    OLED_ACC_TO_CMD_YES,    DATA_BYTE,
+    OLED_CMD_DISPLAYOFF,    CMD_BYTE,
+    OLED_CMD_SET_OSC_FREQ_AND_CLOCKDIV, CMD_BYTE,
+    0xF1,                   DATA_BYTE,
+    OLED_CMD_SET_MUX_RATIO, CMD_BYTE,
+    0x5F,                   DATA_BYTE,
+    OLED_CMD_SET_REMAP,     CMD_BYTE,
+    OLED_REMAP_SETTINGS,    DATA_BYTE,
+    OLED_CMD_SET_COLUMN,    CMD_BYTE,
+    0x00,                   DATA_BYTE,
+    0x5F,                   DATA_BYTE,
+    OLED_CMD_SET_ROW,       CMD_BYTE,
+    0x00,                   DATA_BYTE,
+    0x5F,                   DATA_BYTE,
+    OLED_CMD_STARTLINE,     CMD_BYTE,
+    0x80,                   DATA_BYTE,
+    OLED_CMD_DISPLAYOFFSET, CMD_BYTE,
+    0x60,                   DATA_BYTE,
+    OLED_CMD_PRECHARGE,     CMD_BYTE,
+    0x32,                   CMD_BYTE,
+    OLED_CMD_VCOMH,         CMD_BYTE,
+    0x05,                   CMD_BYTE,
+    OLED_CMD_NORMALDISPLAY, CMD_BYTE,
+    OLED_CMD_CONTRASTABC,   CMD_BYTE,
+    0x8A,                   DATA_BYTE,
+    0x51,                   DATA_BYTE,
+    0x8A,                   DATA_BYTE,
+    OLED_CMD_CONTRASTMASTER, CMD_BYTE,
+    0xCF,                   DATA_BYTE,
+    OLED_CMD_SETVSL,        CMD_BYTE,
+    0xA0,                   DATA_BYTE,
+    0xB5,                   DATA_BYTE,
+    0x55,                   DATA_BYTE,
+    OLED_CMD_PRECHARGE2,    CMD_BYTE,
+    0x01,                   DATA_BYTE,
+    OLED_CMD_DISPLAYON,     CMD_BYTE
+    };
+
+
+    
+SSD1351::SSD1351(PinName mosiPin,PinName sclkPin,PinName pwrPin, PinName csPin,PinName rstPin, PinName dcPin): spi(mosiPin,NC,sclkPin) , power(pwrPin), cs(csPin),rst(rstPin),dc(dcPin) 
+{
+
+    spi.frequency(8000000);
+
+    
+    dc =0;
+    PowerOFF();
+    wait_ms(1);
+    rst = 0 ; 
+    wait_ms(1);
+    rst = 1 ;
+    wait_ms(1);
+    PowerON();
+    
+    currentChar_width  = 0,
+    currentChar_height = 0;
+    colorMask = COLOR_WHITE;
+    
+    oled_text_properties.alignParam = OLED_TEXT_ALIGN_CENTER;
+    oled_text_properties.background = NULL;
+    oled_text_properties.font       = OpenSans_10x15_Regular;
+    oled_text_properties.fontColor  = COLOR_WHITE;
+    SetTextProperties(&oled_text_properties);
+        
+    oled_dynamic_area.areaBuffer = NULL;
+    oled_dynamic_area.height = 0;
+    oled_dynamic_area.width = 0;
+    oled_dynamic_area.xCrd = 0;
+    oled_dynamic_area.yCrd = 0;
+   
+   
+    for (int i=0;i<39;i++) 
+    {
+       SendCmd(seq[i].cmd, seq[i].type);
+    }
+
+
+
+} 
+
+
+SSD1351::~SSD1351(void)
+{
+  //TO_DO
+  //Run Free and zero pointers. 
+  
+}
+
+
+
+ 
+void SSD1351::SendCmd(uint32_t cmd,
+                   uint8_t isFirst)
+{
+  
+  
+  
+  uint8_t
+     txSize = 1,
+     txBuf[4];
+
+  memcpy((void*)txBuf, (void*)&cmd, txSize );
+
+  if (isFirst )
+  {
+    dc = 0;   
+  }
+  else
+  {
+    dc = 1;
+  }
+  
+    cs = 0;
+    spi.write(*txBuf);
+    cs  = 1; 
+   
+}
+
+
+
+void SSD1351::SendData ( const uint8_t* dataToSend, 
+                           uint32_t dataSize)
+                            
+{
+    
+
+  uint16_t* arrayPtr = (uint16_t*)dataToSend;
+
+  for( uint32_t i = 0; i < dataSize/2; i++ )
+  {
+      arrayPtr[i] &= colorMask;
+  }
+  
+
+  SendCmd( OLED_CMD_WRITERAM, CMD_BYTE );
+  
+  /* sending data -> set DC pin */
+  dc = 1;
+  cs = 0 ;
+
+  const uint8_t*
+  /* traversing pointer */ 
+  bufPtr = dataToSend;
+
+
+  for ( uint32_t i = 0; i < dataSize; i++)
+  {
+      spi.write(*bufPtr);
+      bufPtr += 1;
+  }
+  
+  cs = 1;
+ 
+}
+
+
+oled_status_t SSD1351::DrawBox (
+                            int8_t xCrd,
+                            int8_t yCrd,
+                            uint8_t width,
+                            uint8_t height,
+                            uint16_t color
+                          )
+{
+  
+  oled_status_t status;  
+  oled_dynamic_area_t boxArea;
+
+  boxArea.xCrd   = xCrd;
+  boxArea.yCrd   = yCrd;
+  boxArea.width  = width;
+  boxArea.height = height;
+
+  uint32_t
+    boxSize = width*height;
+
+  SetDynamicArea( &boxArea );
+
+  /* helper pointer */
+  uint8_t*
+    boxBuf = (uint8_t*)oled_dynamic_area.areaBuffer;
+
+  if ( NULL == boxBuf )
+  {
+  
+    return OLED_STATUS_ERROR;
+  }
+
+  /* check the bounds */ 
+  if AreCoordsNotValid( xCrd, yCrd, width, height )
+  {
+    status = OLED_STATUS_INIT_ERROR;
+  }
+
+  else
+  {
+    /* fill the buffer with color */
+
+    for ( uint16_t i = 0; i < boxSize; i++ )
+    {
+      boxBuf[ 2*i ]     = color >> 8;
+      boxBuf[ 2*i + 1 ] = color;
+    }
+
+    /* set the locations */
+
+    /* adjust for the offset */
+    OLED_AdjustColumnOffset(xCrd);
+    OLED_AdjustRowOffset(yCrd);
+
+    SendCmd( OLED_CMD_SET_COLUMN, CMD_BYTE);   
+    SendCmd( xCrd, DATA_BYTE );  
+    SendCmd( xCrd + (width-1), DATA_BYTE );
+    SendCmd( OLED_CMD_SET_ROW, CMD_BYTE );
+    SendCmd( yCrd, DATA_BYTE );
+    SendCmd( yCrd + (height-1), DATA_BYTE );
+ 
+    /* fill the GRAM */
+    SendData( (uint8_t*)boxBuf, boxSize*OLED_BYTES_PER_PIXEL );
+    DestroyDynamicArea();
+   
+  }
+
+  return status;
+}
+
+/**
+ * fill the entire screen
+ * @param  color color to fill with
+ * @return status flag
+ */
+void SSD1351::FillScreen( uint16_t color )
+{
+  /* fill the screen buffer with color */
+  for ( uint16_t i = 0; i < ( OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT ); i++ )
+  {
+    screenBuf[ 2*i ]     = color >> 8;
+    screenBuf[ 2*i + 1 ] = color;
+  }
+
+  /* set the locations */
+  SetBorders( 0, 0, OLED_SCREEN_WIDTH, OLED_SCREEN_HEIGHT );
+
+  /* fill GRAM */
+  SendData( (uint8_t*)screenBuf, OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT * OLED_BYTES_PER_PIXEL  );
+
+}
+
+
+
+oled_status_t SSD1351::DrawPixel (
+                               int8_t xCrd,
+                               int8_t yCrd,
+                              uint16_t color
+                            )
+{
+  /* check the bounds */
+  if AreCoordsNotValid( xCrd, yCrd, 1, 1 )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  else
+  {
+    /* set directions */
+    SetBorders( xCrd, yCrd, OLED_SCREEN_WIDTH, OLED_SCREEN_HEIGHT);
+
+    uint16_t
+      /* swap bytes */
+      dot = color;
+
+    OLED_SwapMe(dot);
+
+    /* fill the GRAM */
+    SendData( (uint8_t*)&dot, 2 );
+    
+    return OLED_STATUS_SUCCESS;
+  }
+}
+
+
+oled_status_t SSD1351::DrawScreen (
+                                   const uint8_t* image,
+                                          int8_t xCrd,
+                                          int8_t yCrd,
+                                          uint8_t width,
+                                          uint8_t height,
+                                oled_transition_t transition
+                              )
+{
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  if AreCoordsNotValid( xCrd, yCrd, width, height )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  switch ( transition )
+  {
+    case OLED_TRANSITION_NONE:        {
+                                        /* set the locations */
+                                        SetBorders( xCrd, yCrd, width, height);
+
+                                        /* fill the GRAM */
+                                        SendData( (const uint8_t*)image, width * height * OLED_BYTES_PER_PIXEL );                                        
+                                        break;
+                                      }
+
+    case OLED_TRANSITION_TOP_DOWN:    {
+                                        TopDown( image, xCrd, yCrd, width, height );
+                                        break;
+                                      }
+
+    case OLED_TRANSITION_DOWN_TOP:    {
+                                        DownTop( image, xCrd, yCrd, width, height );
+                                        break;
+                                      }
+
+    case OLED_TRANSITION_LEFT_RIGHT:  {
+                                        LeftRight( image, xCrd, yCrd, width, height );
+                                        break;
+                                      }
+
+    case OLED_TRANSITION_RIGHT_LEFT:  {
+                                        RightLeft( image, xCrd, yCrd, width, height );
+                                        break;
+                                      }
+
+    default: {}
+  }
+
+  return status;
+}
+
+
+oled_status_t SSD1351::SetFont(
+                            const uint8_t* newFont,
+                                  uint16_t newColor
+                          )
+{
+  /* save the new values in intern variables */
+
+  selectedFont           = newFont;
+  selectedFont_firstChar = newFont[2] | ( (uint16_t)newFont[3] << 8 );
+  selectedFont_lastChar  = newFont[4] | ( (uint16_t)newFont[5] << 8 );
+  selectedFont_height    = newFont[6];
+  selectedFont_color     = newColor;
+
+  OLED_SwapMe( selectedFont_color );
+
+  return OLED_STATUS_SUCCESS;
+}
+
+
+void SSD1351::SetDynamicArea(oled_dynamic_area_t *dynamic_area)
+{
+
+  if( NULL == oled_dynamic_area.areaBuffer )
+  {
+      oled_dynamic_area.areaBuffer = (oled_pixel_t)AllocateDynamicArea( dynamic_area->width * dynamic_area->height );
+  }
+  else if(
+          ( dynamic_area->height != oled_dynamic_area.height ) ||
+          ( dynamic_area->width != oled_dynamic_area.width )
+         )
+  {
+    DestroyDynamicArea();
+    oled_dynamic_area.areaBuffer = (oled_pixel_t)AllocateDynamicArea( dynamic_area->width * dynamic_area->height );
+  }
+
+  oled_dynamic_area.xCrd   = dynamic_area->xCrd;
+  oled_dynamic_area.yCrd   = dynamic_area->yCrd;
+  oled_dynamic_area.width  = dynamic_area->width;
+  oled_dynamic_area.height = dynamic_area->height;
+}
+
+
+void SSD1351::DestroyDynamicArea()
+{
+    if ( NULL != oled_dynamic_area.areaBuffer )
+    {
+        DestroyDynamicArea( oled_dynamic_area.areaBuffer );
+        oled_dynamic_area.areaBuffer = NULL;
+    }
+}
+
+
+void SSD1351::SetTextProperties(oled_text_properties_t *textProperties)
+{
+  oled_text_properties.font       = textProperties->font;
+  oled_text_properties.fontColor  = textProperties->fontColor;
+  oled_text_properties.alignParam = textProperties->alignParam;
+  oled_text_properties.background = textProperties->background;
+
+  SetFont( oled_text_properties.font, oled_text_properties.fontColor );
+}
+
+void SSD1351::GetTextProperties(oled_text_properties_t *textProperties)
+{
+  textProperties->font        = oled_text_properties.font;      
+  textProperties->fontColor   = oled_text_properties.fontColor;  
+  textProperties->alignParam  = oled_text_properties.alignParam;
+  textProperties->background  = oled_text_properties.background;
+}
+
+uint8_t SSD1351::GetTextWidth(const uint8_t* text)
+{
+    uint8_t chrCnt = 0;
+    uint8_t text_width  = 0;
+
+    while ( 0 != text[chrCnt] )
+    {
+        text_width += *( selectedFont + 8 + (uint16_t)( ( text[chrCnt++] - selectedFont_firstChar ) << 2 ) );
+        /* make 1px space between chars */
+        text_width++;
+    }
+    /* remove the final space */
+    text_width--;
+
+    return text_width;
+}
+
+
+
+uint8_t SSD1351::CharCount(uint8_t width, const uint8_t* font, const uint8_t* text, uint8_t length)
+{
+    uint8_t chrCnt = 0;
+    uint8_t text_width  = 0;
+    uint16_t firstChar;
+
+    firstChar = font[2] | ( (uint16_t)font[3] << 8 );
+
+    while ( chrCnt < length )
+    {
+        text_width += *( font + 8 + (uint16_t)( ( text[chrCnt++] - firstChar ) << 2 ) );
+        if(text_width > width)
+        {
+            chrCnt--;
+            break;
+        }
+        /* make 1px space between chars */
+        text_width++;
+    }
+
+    return chrCnt;
+}
+
+
+
+
+oled_status_t SSD1351::AddText( const uint8_t* text,int8_t xCrd, int8_t yCrd )
+{
+    uint16_t
+        chrCnt = 0;
+        oled_pixel_t
+        chrBuf = NULL;
+
+    uint8_t
+        currentChar_x = 0,
+        currentChar_y = 0;
+
+    uint8_t
+        text_height = 0,
+        text_width  = 0;
+
+    text_width = GetTextWidth(text);
+
+    /*
+     * set default values, if necessary
+     */
+
+    text_height = selectedFont_height;
+    oled_dynamic_area_t textArea;
+
+    textArea.width  = text_width;
+    textArea.height = text_height;
+    textArea.xCrd = xCrd;
+    textArea.yCrd = yCrd; 
+    SetDynamicArea(&textArea);
+
+    currentChar_y = ( oled_dynamic_area.height - text_height ) >> 1;
+
+    switch ( oled_text_properties.alignParam & OLED_TEXT_HALIGN_MASK )
+    {
+        case OLED_TEXT_ALIGN_LEFT:
+        {
+            currentChar_x = 0;
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_RIGHT:
+        {
+            currentChar_x = ( oled_dynamic_area.width - text_width );
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_CENTER:
+        {
+            currentChar_x += ( oled_dynamic_area.width - text_width ) >> 1 ;
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_NONE:
+        {
+            break;
+        }
+
+        default: {}
+    }
+
+    if ( CreateTextBackground() != OLED_STATUS_SUCCESS )
+    {
+        return OLED_STATUS_ERROR;
+    }
+
+    /*
+    * write the characters into designated space, one by one
+    */
+
+    chrCnt = 0;
+    while ( 0 != text[chrCnt] )
+    {
+        WriteCharToBuf( text[chrCnt++], &chrBuf );
+
+        if ( NULL == chrBuf )
+        {
+          return OLED_STATUS_INIT_ERROR;
+        }
+
+        else
+        {
+          if  (
+                        ( ( currentChar_x + currentChar_width )  > oled_dynamic_area.width )
+                    ||  ( ( currentChar_y + currentChar_height ) > oled_dynamic_area.height )
+              )
+          {
+            DestroyDynamicArea( chrBuf );
+            chrBuf = NULL;
+            return OLED_STATUS_ERROR;
+          }
+
+          /* copy data */
+          oled_pixel_t
+              copyAddr = oled_dynamic_area.areaBuffer + ( currentChar_y * oled_dynamic_area.width + currentChar_x );
+              
+          AddCharToTextArea( chrBuf, currentChar_width, currentChar_height, copyAddr, oled_dynamic_area.width );
+
+          currentChar_x += ( currentChar_width+1 );
+          currentChar_y += 0;
+
+          DestroyDynamicArea( chrBuf );
+          chrBuf = NULL;
+        }
+    }
+
+    UpdateBuffer(
+                                        oled_dynamic_area.xCrd,
+                                        oled_dynamic_area.yCrd,
+                                        oled_dynamic_area.width,
+                                        oled_dynamic_area.height,
+                                        (const uint8_t*)oled_dynamic_area.areaBuffer
+                                    );
+
+    return OLED_STATUS_SUCCESS;
+}
+
+
+oled_status_t SSD1351::AddText( const uint8_t* text)
+{
+    uint16_t
+        chrCnt = 0;
+        oled_pixel_t
+        chrBuf = NULL;
+
+    uint8_t
+        currentChar_x = 0,
+        currentChar_y = 0;
+
+    uint8_t
+        text_height = 0,
+        text_width  = 0;
+
+    text_width = GetTextWidth(text);
+
+    /**
+     * set default values, if necessary
+     */
+
+    text_height = selectedFont_height;
+  
+
+   if  (( oled_dynamic_area.width  < text_width )||( oled_dynamic_area.height < text_height ))
+   {
+        oled_dynamic_area_t textArea;
+        textArea.width  = text_width;
+        textArea.height = text_height;
+        SetDynamicArea(&textArea);
+   }
+  
+    currentChar_y = ( oled_dynamic_area.height - text_height ) >> 1;
+
+    switch ( oled_text_properties.alignParam & OLED_TEXT_HALIGN_MASK )
+    {
+        case OLED_TEXT_ALIGN_LEFT:
+        {
+            currentChar_x = 0;
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_RIGHT:
+        {
+            currentChar_x = ( oled_dynamic_area.width - text_width );
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_CENTER:
+        {
+            currentChar_x += ( oled_dynamic_area.width - text_width ) >> 1 ;
+            break;
+        }
+
+        case OLED_TEXT_ALIGN_NONE:
+        {
+            break;
+        }
+
+        default: {}
+    }
+
+    if ( CreateTextBackground() != OLED_STATUS_SUCCESS )
+    {
+        return OLED_STATUS_ERROR;
+    }
+
+    /**
+    * write the characters into designated space, one by one
+    */
+
+    chrCnt = 0;
+    while ( 0 != text[chrCnt] )
+    {
+        WriteCharToBuf( text[chrCnt++], &chrBuf );
+
+        if ( NULL == chrBuf )
+        {
+          return OLED_STATUS_INIT_ERROR;
+        }
+
+        else
+        {
+          if  (
+                        ( ( currentChar_x + currentChar_width )  > oled_dynamic_area.width )
+                    ||  ( ( currentChar_y + currentChar_height ) > oled_dynamic_area.height )
+              )
+          {
+            DestroyDynamicArea( chrBuf );
+            chrBuf = NULL;
+            return OLED_STATUS_ERROR;
+          }
+
+          /* copy data */ 
+          oled_pixel_t
+              copyAddr = oled_dynamic_area.areaBuffer + ( currentChar_y * oled_dynamic_area.width + currentChar_x );
+              
+          AddCharToTextArea( chrBuf, currentChar_width, currentChar_height, copyAddr, oled_dynamic_area.width );
+
+          currentChar_x += ( currentChar_width+1 );
+          currentChar_y += 0;
+
+          DestroyDynamicArea( chrBuf );
+          chrBuf = NULL;
+        }
+    }
+
+    UpdateBuffer(
+                                        oled_dynamic_area.xCrd,
+                                        oled_dynamic_area.yCrd,
+                                        oled_dynamic_area.width,
+                                        oled_dynamic_area.height,
+                                        (const uint8_t*)oled_dynamic_area.areaBuffer
+                                    );
+
+    return OLED_STATUS_SUCCESS;
+}
+
+
+
+oled_status_t SSD1351::DrawText( const uint8_t* text)
+{
+
+  if ( NULL == text )
+  {
+    return OLED_STATUS_ERROR;
+  }
+
+  AddText(text);
+  /* set the locations */
+  SetBorders( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height );
+  /* fill the GRAM */
+  SendData( (const uint8_t*)oled_dynamic_area.areaBuffer, oled_dynamic_area.width * oled_dynamic_area.height * OLED_BYTES_PER_PIXEL );
+
+  //free( currentTextAreaImage );
+  return OLED_STATUS_SUCCESS;
+}
+
+
+void SSD1351::GetImageDimensions(uint8_t *width, uint8_t *height, const uint8_t* image)
+{
+  *height = image[2] + (image[3] << 8);
+  *width  = image[4] + (image[5] << 8);
+}
+
+
+oled_status_t SSD1351::AddImage ( const uint8_t* image )
+{
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  /* check the bounds */
+  if AreCoordsNotValid( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height )
+  {
+    status = OLED_STATUS_INIT_ERROR;
+  }
+
+  else
+  {
+    Swap( (oled_pixel_t)oled_dynamic_area.areaBuffer, BMP_SkipHeader(image), oled_dynamic_area.width*oled_dynamic_area.height );
+
+    /* update the main screen buffer */
+    UpdateBuffer( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height, (const uint8_t *)oled_dynamic_area.areaBuffer );
+  }
+
+  return status;
+}
+
+
+oled_status_t SSD1351::AddImage ( const uint8_t* image, int8_t xCrd, int8_t yCrd )
+{
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  oled_dynamic_area_t  image_dynamicArea;
+
+  image_dynamicArea.xCrd = xCrd;
+  image_dynamicArea.yCrd = yCrd;
+
+  GetImageDimensions(&image_dynamicArea.width, &image_dynamicArea.height, image);
+  SetDynamicArea(&image_dynamicArea);
+
+  /* check the bounds */
+  if AreCoordsNotValid( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height )
+  {
+    status = OLED_STATUS_INIT_ERROR;
+  }
+
+  else
+  {
+    Swap( (oled_pixel_t)oled_dynamic_area.areaBuffer, BMP_SkipHeader(image), oled_dynamic_area.width*oled_dynamic_area.height );
+
+    /* update the main screen buffer */
+    UpdateBuffer( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height, (const uint8_t *)oled_dynamic_area.areaBuffer );
+  }
+
+  return status;
+}
+
+
+
+oled_status_t SSD1351::DrawImage ( const uint8_t* image )
+{
+  
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  status = AddImage( image );
+
+  /* set the locations */
+  SetBorders( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height );
+
+  /* fill the GRAM */
+  SendData( (const uint8_t*)oled_dynamic_area.areaBuffer, oled_dynamic_area.width * oled_dynamic_area.height * OLED_BYTES_PER_PIXEL );
+
+
+  return status;
+}
+
+oled_status_t SSD1351::DrawImage ( const uint8_t* image, int8_t xCrd, int8_t yCrd  )
+{
+  
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  status = AddImage( image,xCrd,yCrd);
+
+  /* set the locations */
+  SetBorders( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height );
+
+  /* fill the GRAM */
+  SendData( (const uint8_t*)oled_dynamic_area.areaBuffer, oled_dynamic_area.width * oled_dynamic_area.height * OLED_BYTES_PER_PIXEL );
+
+
+  return status;
+}
+
+
+
+void SSD1351::DimScreenON()
+{
+    for ( int i = 0; i < 16; i++ )
+    {
+        SendCmd( OLED_CMD_CONTRASTMASTER, CMD_BYTE );
+        SendCmd( 0xC0 | (0xF-i), DATA_BYTE );
+        wait_ms(20);
+        // OSA_TimeDelay( 20 );
+    }
+}
+
+
+void SSD1351::DimScreenOFF()
+{
+  SendCmd( OLED_CMD_CONTRASTMASTER, CMD_BYTE );
+  SendCmd( 0xC0 | 0xF, DATA_BYTE );
+}
+
+
+
+void SSD1351::Swap(
+                    oled_pixel_t imgDst,
+                  const uint8_t* imgSrc,
+                        uint16_t imgSize
+                )
+{
+  for ( int var = 0; var < imgSize; var++ )
+  {
+    *imgDst = *imgSrc << 8;
+    imgSrc++;
+    *imgDst |= *imgSrc;
+    imgDst++;
+    imgSrc++;
+  }
+}
+
+
+void SSD1351::PowerON()
+{
+  power = 1;
+}
+
+void SSD1351::PowerOFF()
+{
+  power = 0;
+}
+
+
+
+ /* Formerly Known as GuiDriver_UpdateScreen */
+void SSD1351::UpdateBuffer (
+                                int8_t xCrd,
+                                int8_t yCrd,
+                                uint8_t width,
+                                uint8_t height,
+                                const uint8_t* image
+                              )
+{
+  /* copy data */
+  oled_pixel_t
+    copyAddr = (oled_pixel_t)screenBuf + ( yCrd*OLED_SCREEN_WIDTH + xCrd );
+
+  for ( uint8_t i = 0; i < height; i++ )
+  {
+    memcpy( (void*)copyAddr, (void*)image, width*OLED_BYTES_PER_PIXEL );
+    copyAddr += OLED_SCREEN_WIDTH;
+    image    += width*OLED_BYTES_PER_PIXEL;
+  }
+} 
+
+
+oled_status_t SSD1351::Label ( const uint8_t* text,int8_t xCrd, int8_t yCrd )
+{
+
+  if ( NULL == text )
+  {
+    return OLED_STATUS_ERROR;
+  }
+
+  AddText(text,xCrd,yCrd);
+
+  /* set the locations */
+  SetBorders( oled_dynamic_area.xCrd, oled_dynamic_area.yCrd, oled_dynamic_area.width, oled_dynamic_area.height );
+
+  /* fill the GRAM */
+  SendData( (const uint8_t*)oled_dynamic_area.areaBuffer, oled_dynamic_area.width * oled_dynamic_area.height * OLED_BYTES_PER_PIXEL );
+
+  //free( currentTextAreaImage );
+  return OLED_STATUS_SUCCESS;
+}
+
+
+oled_status_t SSD1351::TextBox(const uint8_t* text, int8_t xCrd, int8_t yCrd,uint8_t width,uint8_t height)
+{
+
+  if ( NULL == text )
+  {
+    return OLED_STATUS_ERROR;
+  }
+
+  oled_dynamic_area_t textArea;
+  textArea.width  = width;
+  textArea.height = height;
+  textArea.xCrd = xCrd;
+  textArea.yCrd = yCrd; 
+
+  SetDynamicArea(&textArea);
+  DrawText(text);
+
+  return OLED_STATUS_SUCCESS;
+
+}
+
+
+/* Internal Functions */
+
+/**
+ * [transpose description]
+ * @param transImage  Transposed Image    
+ * @param image       Source Image  
+ * @param width       Width to Transpose
+ * @param height      Height to Transpose 
+ */
+void SSD1351::Transpose(
+                             oled_pixel_t transImage,
+                       const oled_pixel_t image,
+                                  uint8_t width,
+                                  uint8_t height
+                     )
+{
+  for ( uint8_t i = 0; i < height; i++ )
+  {
+    for ( uint8_t j = 0; j < width ; j++ )
+    {
+      transImage[ j*height + i ] = image[ i*width + j ];
+    }
+  }
+}
+
+
+
+/**
+ * TopDown Transition Effect for Image
+ * @param  image  image to be transitioned
+ * @param  xCrd   x coordinate of image
+ * @param  yCrd   y coordinate of image
+ * @param  width  width of image
+ * @param  height height of image
+ * @return        status flag
+ */
+oled_status_t SSD1351::TopDown(
+                                const uint8_t* image,
+                                       int8_t xCrd,
+                                       int8_t yCrd,
+                                       uint8_t width,
+                                       uint8_t height
+                            )
+{
+  uint16_t
+    transStep = OLED_TRANSITION_STEP;
+
+  uint16_t
+    partImgSize = width*transStep;
+
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  uint8_t*
+    partImgPtr = (uint8_t*)image + ( height - transStep ) * ( width * OLED_BYTES_PER_PIXEL );
+
+  /**
+   * set locations
+   */
+
+  while (1)
+  {
+    SetBorders( xCrd, yCrd, width, height );
+
+    if ( partImgSize > width*height )
+    {
+        SendData( (const uint8_t*)image, width*height*OLED_BYTES_PER_PIXEL );
+        break;
+    }
+    else
+    {
+        SendData( (const uint8_t*)partImgPtr, partImgSize * OLED_BYTES_PER_PIXEL );
+    }
+
+
+    /**
+     * update variables
+     */
+
+    partImgPtr  -= ( width * transStep ) * OLED_BYTES_PER_PIXEL;
+    partImgSize += ( width * transStep );
+    transStep++;
+  }
+
+  return status;
+}
+
+/**
+ * DownTop Transition Effect for Image
+ * @param  image  image to be transitioned
+ * @param  xCrd   x coordinate of image
+ * @param  yCrd   y coordinate of image
+ * @param  width  width of image
+ * @param  height height of image
+ * @return        status flag
+ */
+
+oled_status_t SSD1351::DownTop(
+                                const uint8_t* image,
+                                      int8_t xCrd,
+                                      int8_t yCrd,
+                                      uint8_t width,
+                                      uint8_t height
+                            )
+{
+  uint16_t
+    transStep = OLED_TRANSITION_STEP;
+
+  uint16_t
+    partImgSize = width*transStep;
+
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  uint8_t*
+    partImgPtr = (uint8_t*)image;
+
+  uint8_t
+    yCrd_moving = ( yCrd + height ) - 1;
+
+  /**
+   * set locations
+   */
+
+  while (1)
+  {
+    if  (
+             ( partImgSize > OLED_SCREEN_SIZE )
+          ||        ( yCrd_moving < yCrd )
+        )
+    {
+      /* draw full image */
+      SetBorders( xCrd, yCrd, width, height );
+      SendData( (const uint8_t*)image, width * height * OLED_BYTES_PER_PIXEL );
+      break;
+    }
+
+    else
+    {
+      SetBorders( xCrd, yCrd_moving, width, ( yCrd + height ) - yCrd_moving );
+      SendData( (const uint8_t*)partImgPtr, partImgSize * OLED_BYTES_PER_PIXEL );
+    }
+
+    /**
+     * update variables
+     */
+
+    yCrd_moving -= transStep;
+    partImgSize += ( width * transStep );
+    transStep++;
+  }
+
+  return status;
+}
+
+
+/**
+ * LeftRight Transition Effect for Image
+ * @param  image  image to be transitioned
+ * @param  xCrd   x coordinate of image
+ * @param  yCrd   y coordinate of image
+ * @param  width  width of image
+ * @param  height height of image
+ * @return        status flag
+ */
+
+oled_status_t SSD1351::LeftRight(
+                                 const uint8_t* image,
+                                        int8_t xCrd,
+                                        int8_t yCrd,
+                                        uint8_t width,
+                                        uint8_t height
+                              )
+{
+  oled_status_t
+    status = OLED_STATUS_SUCCESS;
+
+  oled_dynamic_area_t
+      transImageArea =
+      {
+          .xCrd = 0,
+          .yCrd = 0,
+
+          .width = 96,
+          .height= 96
+      };
+
+  SetDynamicArea( &transImageArea );
+
+  /* helper pointer */
+  oled_pixel_t
+    transImage = (oled_pixel_t)oled_dynamic_area.areaBuffer;
+
+  if ( NULL == transImage )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  Transpose( transImage,(oled_pixel_t)image, width, height );
+
+  SendCmd( OLED_CMD_SET_REMAP, CMD_BYTE );
+  SendCmd( OLED_REMAP_SETTINGS | REMAP_VERTICAL_INCREMENT, DATA_BYTE );
+ 
+  uint16_t
+    transStep = OLED_TRANSITION_STEP;
+
+  uint16_t
+    partImgSize = height*transStep;
+
+  uint8_t*
+    partImgPtr = (uint8_t*)transImage + ( width - transStep ) * ( height * OLED_BYTES_PER_PIXEL );
+
+  /**
+   * set locations
+   */
+
+  while (1)
+  {
+    SetBorders( xCrd, yCrd, width, height );
+
+    if ( partImgSize > width*height )
+    {
+      SendData((const uint8_t*)transImage, width * height * OLED_BYTES_PER_PIXEL );
+      break;
+    }
+    else
+    {
+      SendData( (const uint8_t*)partImgPtr, partImgSize * OLED_BYTES_PER_PIXEL );
+    }
+
+
+    partImgPtr  -= ( transStep * height ) * OLED_BYTES_PER_PIXEL;
+    partImgSize += ( transStep * height );
+    transStep++;
+    
+  }
+   
+    SendCmd( OLED_CMD_SET_REMAP, CMD_BYTE );
+    SendCmd( OLED_REMAP_SETTINGS, DATA_BYTE );
+    DestroyDynamicArea();
+    return status;
+}
+
+
+/**
+ * RightLeft Transition Effect for Image
+ * @param  image  image to be transitioned
+ * @param  xCrd   x coordinate of image
+ * @param  yCrd   y coordinate of image
+ * @param  width  width of image
+ * @param  height height of image
+ * @return        status flag
+ */
+oled_status_t SSD1351::RightLeft(
+                                 const uint8_t* image,
+                                        int8_t xCrd,
+                                        int8_t yCrd,
+                                        uint8_t width,
+                                        uint8_t height
+                              )
+{
+  oled_dynamic_area_t
+      transImageArea =
+      {
+          .xCrd = 0,
+          .yCrd = 0,
+
+          .width = 96,
+          .height= 96
+      };
+
+  SetDynamicArea( &transImageArea );
+
+  /* helper pointer */
+  oled_pixel_t
+    transImage = oled_dynamic_area.areaBuffer;
+
+  if ( NULL == transImage )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  Transpose(transImage, (oled_pixel_t)image, width, height );
+
+  SendCmd( OLED_CMD_SET_REMAP, CMD_BYTE );
+  SendCmd( OLED_REMAP_SETTINGS | REMAP_VERTICAL_INCREMENT, DATA_BYTE );
+
+
+  uint16_t
+    transStep = OLED_TRANSITION_STEP;
+
+  uint16_t
+    partImgSize = height * transStep;
+
+  uint8_t*
+    partImgPtr = (uint8_t*)transImage;
+
+  uint8_t
+    xCrd_moving = ( xCrd + width ) - 1;
+
+  /** set locations */
+
+  while (1)
+  {
+    if  (( partImgSize > width*height )|| ( xCrd_moving < xCrd ))       
+    {
+       SetBorders( xCrd, yCrd, width, height );
+       SendData( (const uint8_t*)transImage, height * width * OLED_BYTES_PER_PIXEL );
+       break;
+    }
+    else
+    {
+       SetBorders( xCrd_moving, yCrd, ( xCrd + width ) - xCrd_moving, height );
+       SendData( (const uint8_t*)partImgPtr, partImgSize * OLED_BYTES_PER_PIXEL );
+    }
+
+    /** update variables*/
+
+    xCrd_moving -= transStep;
+    partImgSize += ( height * transStep );
+    transStep++;
+  }
+
+  SendCmd( OLED_CMD_SET_REMAP, CMD_BYTE );
+  SendCmd( OLED_REMAP_SETTINGS, DATA_BYTE );
+
+  DestroyDynamicArea();
+
+  return OLED_STATUS_SUCCESS;
+}
+
+
+/**
+ * [setDirection description]
+ * @param  self [description]
+ * @param  xCrd [description]
+ * @param  yCrd [description]
+ * @return      [description]
+ */
+void SSD1351::SetBorders(
+                        int8_t xCrd,
+                        int8_t yCrd,
+                        uint8_t width,
+                        uint8_t height
+                      )
+{
+  
+  /* adjust for the offset*/
+  OLED_AdjustColumnOffset(xCrd);
+  OLED_AdjustRowOffset(yCrd);
+
+  SendCmd( OLED_CMD_SET_COLUMN, CMD_BYTE );
+  SendCmd( xCrd, DATA_BYTE );
+  SendCmd( xCrd + (width-1), DATA_BYTE );
+  SendCmd( OLED_CMD_SET_ROW, CMD_BYTE );
+  SendCmd( yCrd, DATA_BYTE );
+  SendCmd( yCrd + (height-1), DATA_BYTE );
+  
+}
+
+/**
+ * create the buffer for a partial image
+ * @param  imgBuf [description]
+ * @param  width  [description]
+ * @param  height [description]
+ * @return        [description]
+ */
+oled_status_t SSD1351::CreateTextBackground()
+{
+  uint8_t
+    xCrd   = oled_dynamic_area.xCrd,
+    yCrd   = oled_dynamic_area.yCrd,
+    width  = oled_dynamic_area.width,
+    height = oled_dynamic_area.height;
+
+  oled_pixel_t
+    imgBuf = oled_dynamic_area.areaBuffer,
+    copyAddr;
+
+  const uint8_t*
+    background = oled_text_properties.background;
+
+  /* copy data */
+
+  if  (
+            ( NULL == imgBuf )
+        ||  ( ( xCrd + width )  > OLED_SCREEN_WIDTH )
+        ||  ( ( yCrd + height ) > OLED_SCREEN_HEIGHT )
+      )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  if ( NULL == background )
+  {
+    for ( uint8_t i = 0; i < height; i++ )
+    {
+      memset( (void*)imgBuf, 0, width*OLED_BYTES_PER_PIXEL );
+      imgBuf   += width;
+    }
+  }
+
+  else
+  {
+    copyAddr = (oled_pixel_t)( BMP_SkipHeader( background ) ) + ( yCrd*OLED_SCREEN_WIDTH + xCrd );
+    for ( uint8_t i = 0; i < height; i++ )
+    {
+      Swap( (oled_pixel_t)imgBuf, (const uint8_t*)copyAddr, width );
+      imgBuf   += width;
+      copyAddr += OLED_SCREEN_WIDTH;
+    }
+  }
+
+  return OLED_STATUS_SUCCESS;
+}
+
+
+/**
+ * Write the character to Buffer
+ * @param charToWrite character to be written
+ * @param chrBuf      given pointer for buffer for the character
+ */
+void SSD1351::WriteCharToBuf(
+                            uint16_t charToWrite,
+                            oled_pixel_t* chrBuf
+                          )
+{
+  uint8_t
+    foo = 0,
+    mask;
+
+  const uint8_t*
+    pChTable = selectedFont + 8 + (uint16_t)( ( charToWrite - selectedFont_firstChar ) << 2 );
+
+  currentChar_width  = *pChTable,
+  currentChar_height = selectedFont_height;
+
+  uint32_t
+    offset =      (uint32_t)pChTable[1]
+              | ( (uint32_t)pChTable[2] << 8 )
+              | ( (uint32_t)pChTable[3] << 16 );
+
+  const uint8_t*
+    pChBitMap = selectedFont + offset;
+
+  /* allocate space for char image */
+  *chrBuf = (oled_pixel_t)AllocateDynamicArea( currentChar_height * currentChar_width );
+
+  if ( NULL == *chrBuf )
+  {
+    return;
+  }
+
+  for ( uint8_t yCnt = 0; yCnt < currentChar_height; yCnt++ )
+  {
+    mask = 0;
+
+    for ( uint8_t xCnt = 0; xCnt < currentChar_width; xCnt++ )
+    {
+      if ( 0 == mask )
+      {
+        mask = 1;
+        foo  = *pChBitMap++;
+      }
+
+      if ( 0 != ( foo & mask ) )
+      {
+        *( *chrBuf + yCnt*currentChar_width + xCnt ) = selectedFont_color;
+      }
+
+       else
+       {
+           *( *chrBuf + yCnt*currentChar_width + xCnt ) = 0;
+       }
+
+      mask <<= 1;
+    }
+  }
+}
+
+
+/**
+ * Add subimage/character to the active image buffer
+ * @param  xOffset offset for the x-coordinate
+ * @param  yOffset offset for the y-coordinate
+ * @param  width   desired width
+ * @param  height  desired height
+ * @return         status flag
+ */
+oled_status_t SSD1351::AddCharToTextArea(
+                                        oled_pixel_t chrPtr,
+                                             uint8_t chrWidth,
+                                             uint8_t chrHeight,
+                                        oled_pixel_t copyAddr,
+                                             uint8_t imgWidth
+                                      )
+{
+  if ( NULL == copyAddr )
+  {
+    return OLED_STATUS_INIT_ERROR;
+  }
+
+  for ( uint8_t i = 0; i < chrHeight; i++ )
+  {
+    for ( uint8_t j = 0; j < chrWidth; j++ )
+    {
+      if ( 0 != chrPtr[j] )
+      {
+          copyAddr[j] = chrPtr[j];
+      }
+    }
+    copyAddr += imgWidth;
+    chrPtr   += chrWidth;
+  }
+  return OLED_STATUS_SUCCESS;
+}
+
+
+/**
+ * Allocate memory for the desired image/character
+ * @param area desired area dimensions
+ */
+void* SSD1351::AllocateDynamicArea( uint32_t area )
+{
+  void*
+      ptr = malloc( area * OLED_BYTES_PER_PIXEL );
+
+  if ( NULL == ptr )
+  {
+      return NULL;
+  }
+
+  return ptr;
+}
+
+
+/**
+ * Deallocate current area
+ * @param area pointer to current area
+ */
+oled_status_t SSD1351::DestroyDynamicArea( void* ptr )
+{
+  if ( NULL == ptr )
+  {
+      return OLED_STATUS_INIT_ERROR;
+  }
+
+   free(ptr); 
+
+   return OLED_STATUS_SUCCESS; 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hexi_OLED_SSD1351.h	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,388 @@
+/** OLED Display Driver for Hexiwear 
+ *  This file contains OLED driver functionality for drawing images and text
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of NXP, nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * visit: http://www.mikroe.com and http://www.nxp.com
+ *
+ * get support at: http://www.mikroe.com/forum and https://community.nxp.com
+ *
+ * Project HEXIWEAR, 2015
+ */
+
+#ifndef HG_HEXI_OLED_SSD1351
+#define HG_HEXI_OLED_SSD1351
+
+#include "mbed.h"
+#include "OLED_types.h" 
+#include "OLED_info.h"
+
+
+/** OLED Display Driver for Hexiwear
+*/
+class SSD1351{
+
+public:
+
+ /**
+  * Create a Hexiwear OLED Driver connected to the specified pins
+  *
+  * @param mosiPin SPI Master Out, Slave In Pin
+  * @param sclkPin SPI CLock Pin
+  * @param pwrPin  OLED Power Pin
+  * @param csPin   OLED Chip Select Pin
+  * @param rstPin  OLED Reset Pin
+  * @param dcPin   OLED DC Pin
+  *
+  * @note Default TextProperties
+  *
+  *       .font       = OpenSans_10x15_Regular,    
+  *       .fontColor  = COLOR_WHITE,
+  *       .alignParam = OLED_TEXT_ALIGN_CENTER, 
+  *       .background = NULL
+  *
+  */
+  SSD1351(PinName mosiPin,PinName sclkPin,PinName pwrPin, PinName csPin,PinName rstPin, PinName dcPin);
+
+  /**
+  * Destroy the Hexiwear instance
+  */   
+  ~SSD1351(); 
+
+  /**
+   * Send the command to OLED
+   * @param  cmd     OLED command from the datasheet
+   * @param  isFirst designate if this is the first byte in the command
+   */
+  void SendCmd(uint32_t cmd,
+                     uint8_t isFirst);
+
+
+  /**
+   * Send data to OLED
+   * @param  dataToSend data to send to OLED
+   * @param  dataSize   data-size
+   */
+  void SendData ( const uint8_t* dataToSend, 
+                             uint32_t dataSize);
+
+  /**
+   * draw box on OLED
+   * @param  xCrd   x-coordinate for box's uper left corner
+   * @param  yCrd   y-coordinate for box's uper left corner
+   * @param  width  box's width
+   * @param  height box's height
+   * @param  color  color of the box
+   * @return        status flag
+   */
+  oled_status_t DrawBox (
+                              int8_t xCrd,
+                              int8_t yCrd,
+                              uint8_t width,
+                              uint8_t height,
+                              uint16_t color
+                            );
+
+  /**
+   * Fill the entire screen with specified color
+   * @param  color color to fill with
+   */
+  void FillScreen( uint16_t color );
+
+
+
+  /**
+   * Draw a single pixel
+   * @param  xCrd  pixel's x coordinate
+   * @param  yCrd  pixel's y coordinate
+   * @param  color pixel's color
+   * @return       status flag
+   */
+  oled_status_t DrawPixel (
+                                 int8_t xCrd,
+                                 int8_t yCrd,
+                                uint16_t color
+                              );
+
+
+  /**
+   * Draw the whole screen
+   * @param  image      image to draw
+   * @param  xCrd       image x-coordinate
+   * @param  yCrd       image y-coordinate
+   * @param  width      image width
+   * @param  height     image height
+   * @param  transition transition style for the new image arrival
+   * @return            status flag
+   */
+  oled_status_t DrawScreen (
+                                     const uint8_t* image,
+                                            int8_t xCrd,
+                                            int8_t yCrd,
+                                            uint8_t width,
+                                            uint8_t height,
+                                  oled_transition_t transition
+                                );
+
+
+  /**
+   * Set the font to use
+   * @param newFont  desired font
+   * @param newColor desired color
+   * @return         status flag
+   */
+  oled_status_t SetFont(
+                              const uint8_t* newFont,
+                                    uint16_t newColor
+                            );
+
+
+  /**
+   * Set OLED dynamic area
+   * @param dynamic_area data-structure with desired values
+   */
+  void SetDynamicArea(oled_dynamic_area_t *dynamic_area);
+
+  /**
+   * Destroy current OLED dynamic area
+   */
+  void DestroyDynamicArea();
+
+
+  /**
+   * Set OLED class text properties from parameter 
+   * @param textProperties data-structure with desired properties
+   */
+  void SetTextProperties(oled_text_properties_t *textProperties);
+
+  /**
+   * Copy OLED class text properties to parameter
+   * @param textProperties destination data-structure
+   */
+  void GetTextProperties(oled_text_properties_t *textProperties);
+
+  /**
+   * Return the width in [px] required for the given string to be displayed
+   * @param  text desired string
+   * @return      required text width in [px]
+   */
+  uint8_t GetTextWidth(const uint8_t* text);
+
+
+  /**
+   * Count the characters
+   * @param  width  text width
+   * @param  font   text font
+   * @param  text   given text string
+   * @param  length text length
+   * @return        character count
+   */
+  uint8_t CharCount(uint8_t width, const uint8_t* font, const uint8_t* text, uint8_t length);
+
+  /**
+   * Add text to the main screen buffer at position x,y. 
+   * @param text    text to add
+   * @param xCrd    x-coordinate for the given text
+   * @param yCrd    y-coordinate for the given text
+   * @return        status flag
+   */
+  oled_status_t AddText( const uint8_t* text,int8_t xCrd, int8_t yCrd );
+    /**
+   * Add text to the main screen buffer. Used with SetDynamicArea() Function.
+   * @param  text text to add
+   * @return      status flag
+   */
+  oled_status_t AddText( const uint8_t* text);
+ 
+  /**
+   * Write text on OLED at position set in Dynamic Area Field. Used with SetDynamicArea() Function.
+   * @param text desired text
+   * 
+   */
+  oled_status_t DrawText ( const uint8_t* text);
+
+  /**
+   * Return the dimensions of image 
+   * @param width  given image's width
+   * @param height given image's height
+   * @param image  desired image
+   */
+  void GetImageDimensions(uint8_t *width, uint8_t *height, const uint8_t* image);
+
+  /**
+   * Add image to the main screen buffer.Used with SetDynamicArea() Function.
+   * @param  image      desired image
+   * @return            status flag
+   */
+  oled_status_t AddImage ( const uint8_t* image );
+
+    /**
+   * Add image to the main screen buffer at position x,y 
+   * @param  image      desired image
+   * @param  xCrd       image x-coordinate
+   * @param  yCrd       image y-coordinate
+   * @return            status flag
+   */
+  oled_status_t AddImage ( const uint8_t* image, int8_t xCrd, int8_t yCrd );
+
+  /**
+   * Send image to OLED GRAM.Used with SetDynamicArea() Function for positioning image. 
+   * @param  image      desired image
+   * @return            status flag
+   */
+  oled_status_t DrawImage ( const uint8_t* image );
+    /**
+   * Send image to OLED GRAM at position x,y.
+   * @param  image      desired image
+   * @param  xCrd       image x-coordinate
+   * @param  yCrd       image y-coordinate
+   * @return            status flag
+   */
+  oled_status_t DrawImage ( const uint8_t* image, int8_t xCrd, int8_t yCrd );
+
+  /**
+   * Dim OLED screen on
+   */
+  void DimScreenON();
+
+  /**
+   * Return OLED back to full contrast
+   */
+  void DimScreenOFF();
+
+  /**
+   * Swap image's bytes per pixel to obtain the correct color format
+   * @param imgDst  desired image
+   * @param imgSrc  original image
+   * @param imgSize image's size
+   */
+  void Swap(
+                      oled_pixel_t imgDst,
+                    const uint8_t* imgSrc,
+                          uint16_t imgSize
+                  );
+    
+
+  /**
+   * Turn on Power for OLED Display
+   */              
+  void PowerON();
+
+  /**
+   * Turn off Power for OLED Display
+   */ 
+  void PowerOFF(); 
+
+  /**
+   * update the main screen buffer
+   * with the given image
+
+   * @param  xCrd       image x-coordinate
+   * @param  yCrd       image y-coordinate
+   * @param  width      image width
+   * @param  height     image height
+   * @param  image      image for buffer
+   */
+  void UpdateBuffer (
+                                int8_t xCrd,
+                                int8_t yCrd,
+                                uint8_t width,
+                                uint8_t height,
+                                const uint8_t* image
+                              );
+
+
+    /**
+   * Write text on OLED at position x,y. Recommended for Static Text. 
+   * @param text    desired text
+   * @param xCrd    x-coordinate for the given text
+   * @param yCrd    y-coordinate for the given text
+   */
+
+  oled_status_t Label(const uint8_t* text,
+                            int8_t xCrd, 
+                            int8_t yCrd );
+
+  /**
+  * Create a text box of width,height at position x,y. Recommended for Dynamic Text.
+  * Text is aligned in textbox accordingly to the align parameter set by SetTextProperties(). 
+  * @param text    desired text
+  * @param xCrd    x-coordinate for the textbox
+  * @param yCrd    y-coordinate for the textbox
+  * @param width   width of the textbox
+  * @param height  height of the textbox 
+  */
+  
+  oled_status_t TextBox(const uint8_t* text,
+                              int8_t xCrd, 
+                              int8_t yCrd,
+                              uint8_t width,
+                              uint8_t height);
+
+
+private:
+
+  SPI spi;
+  DigitalOut power;
+  DigitalOut cs;
+  DigitalOut rst; 
+  DigitalOut dc;
+
+ 
+  const uint8_t* selectedFont;
+
+  uint8_t
+    currentChar_width,
+    currentChar_height,
+    screenBuf[OLED_GRAM_SIZE];
+
+  uint16_t
+    selectedFont_color,
+    selectedFont_firstChar, /* first character in the font table */
+    selectedFont_lastChar,  /* last character in the font table */
+    selectedFont_height,
+    colorMask;
+
+  oled_dynamic_area_t oled_dynamic_area;
+  oled_text_properties_t oled_text_properties;
+
+  
+  /* Internal Functions */
+  void Transpose( oled_pixel_t transImage, const oled_pixel_t image, uint8_t width, uint8_t height );
+  oled_status_t TopDown   ( const uint8_t* image, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height );
+  oled_status_t DownTop   ( const uint8_t* image, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height );
+  oled_status_t LeftRight ( const uint8_t* image, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height );
+  oled_status_t RightLeft ( const uint8_t* image, int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height );
+  void SetBorders( int8_t xCrd, int8_t yCrd, uint8_t width, uint8_t height );
+  oled_status_t CreateTextBackground();
+  void WriteCharToBuf( uint16_t charToWrite, oled_pixel_t* chrBuf );
+  oled_status_t AddCharToTextArea( oled_pixel_t chrPtr, uint8_t chrWidth, uint8_t chrHeight, oled_pixel_t copyAddr, uint8_t imgWidth );
+  void* AllocateDynamicArea( uint32_t area );
+  oled_status_t DestroyDynamicArea(void * ptr);
+
+};
+
+#endif           
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OLED_info.h	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,288 @@
+/** OLED Screen Info  
+ *  This file contains OLED screen SSD1351-related defines and macros. 
+ * 
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of NXP, nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * visit: http://www.mikroe.com and http://www.nxp.com
+ *
+ * get support at: http://www.mikroe.com/forum and https://community.nxp.com
+ *
+ * Project HEXIWEAR, 2015
+ */
+ 
+#ifndef HG_OLED_INFO
+#define HG_OLED_INFO
+
+// command byte number
+#define CMD_BYTE (1)
+#define DATA_BYTE (0)
+
+#define OLED_COLUMN_OFFSET (16)
+#define OLED_ROW_OFFSET    (0)
+
+#define OLED_SCREEN_WIDTH  (96)
+#define OLED_SCREEN_HEIGHT (96)
+
+#define OLED_SCREEN_WIDTH_END  ( (OLED_SCREEN_WIDTH-1)  + OLED_COLUMN_OFFSET )
+#define OLED_SCREEN_HEIGHT_END ( (OLED_SCREEN_HEIGHT-1) + OLED_ROW_OFFSET )
+
+#define OLED_BYTES_PER_PIXEL ( 2 )
+
+#define OLED_TRANSITION_STEP    ( 1 )
+#define OLED_ACTION_DCON  ( 0xFE )
+#define OLED_ACTION_DCOFF ( 0xFF )
+
+#define OLED_CHAR_WIDTH_AUTO  ( 0xFF )
+#define OLED_CHAR_WIDTH_MAX   ( 0xFE )
+#define OLED_CHAR_WIDTH_NUM   ( 0xFD )
+#define OLED_CHAR_WIDTH_KEEP  ( 0xFC )
+#define OLED_CHAR_HEIGHT_AUTO ( 0xFB )
+#define OLED_CHAR_HEIGHT_KEEP ( 0xFA )
+
+#define OLED_SCREEN_SIZE ( OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT )
+#define OLED_GRAM_SIZE ( OLED_SCREEN_WIDTH * OLED_SCREEN_HEIGHT * OLED_BYTES_PER_PIXEL )
+
+#define OLED_TEXT_HALIGN_SHIFT ( 0 )
+#define OLED_TEXT_HALIGN_MASK  ( 0x03 << OLED_TEXT_HALIGN_SHIFT )
+
+#define OLED_TEXT_VALIGN_SHIFT ( 4 )
+#define OLED_TEXT_VALIGN_MASK  ( 0x03 << OLED_TEXT_VALIGN_SHIFT )
+
+#define BMP_HEADER_BYTE_SIZE (6)
+
+
+
+/**
+ * remap settings
+ */
+
+#define REMAP_HORIZONTAL_INCREMENT ( 0 )
+#define REMAP_VERTICAL_INCREMENT   ( 1 << 0 )
+
+#define REMAP_COLUMNS_LEFT_TO_RIGHT ( 0 )
+#define REMAP_COLUMNS_RIGHT_TO_LEFT ( 1 << 1 )
+
+#define REMAP_ORDER_ABC ( 0 )
+#define REMAP_ORDER_CBA ( 1 << 2 )
+
+#define REMAP_SCAN_UP_TO_DOWN ( 0 )
+#define REMAP_SCAN_DOWN_TO_UP ( 1 << 4 )
+
+#define REMAP_COM_SPLIT_ODD_EVEN_DIS ( 0 )
+#define REMAP_COM_SPLIT_ODD_EVEN_EN  ( 1 << 5 )
+
+#define REMAP_COLOR_RGB565 ( 1 << 6 )
+
+#define OLED_REMAP_SETTINGS ( REMAP_ORDER_ABC | REMAP_COM_SPLIT_ODD_EVEN_EN | REMAP_COLOR_RGB565 | REMAP_COLUMNS_LEFT_TO_RIGHT | REMAP_SCAN_UP_TO_DOWN | REMAP_HORIZONTAL_INCREMENT )
+
+/**
+ * macros
+ */
+
+#define OLED_SwapMe(x) x = ( ( x & 0xFF00 ) >> 8 ) | ( ( x & 0x00FF ) << 8 )
+#define OLED_AdjustRowOffset(y)    y += OLED_ROW_OFFSET
+#define OLED_AdjustColumnOffset(x) x += OLED_COLUMN_OFFSET
+
+#define BMP_SkipHeader( imgPtr ) ( (const uint8_t*)(imgPtr) + BMP_HEADER_BYTE_SIZE )
+
+
+#define CheckLimits( x, y, w, h ) ( ( ( x + w - 1 ) > OLED_SCREEN_WIDTH ) || ( x < 0 ) || ( ( y + h - 1 ) > OLED_SCREEN_HEIGHT ) || ( y < 0 ) )
+#define AreCoordsValid( x, y, w, h )    ( 0 == CheckLimits( x, y, w ,h ) )
+#define AreCoordsNotValid( x, y, w, h ) ( 0 != CheckLimits( x, y, w, h ) )
+
+
+/**
+ * set start/end column/row
+ * the 2nd and 3rd byte represent the start and the end address, respectively
+ */
+#define OLED_CMD_SET_COLUMN ( 0x15 )
+#define OLED_CMD_SET_ROW    ( 0x75 )
+
+/**
+ * scanning direction
+ */
+
+#define OLED_DIRECTION_HORIZONTAL (0)
+#define OLED_DIRECTION_VERTICAL   (1)
+
+/**
+ * SPI-related
+ */
+
+#define OLED_SPI_CHUNK (511)
+
+/**
+ * set display
+ */
+#define OLED_CMD_SET_DISPLAY_MODE_ALL_OFF (0xA4)
+#define OLED_CMD_SET_DISPLAY_MODE_ALL_ON  (0xA5)
+#define OLED_CMD_SET_DISPLAY_MODE_NORMAL  (0xA6)
+#define OLED_CMD_SET_DISPLAY_MODE_INVERSE (0xA7)
+
+/**
+ * set lock command
+ * the locked OLED driver MCU interface prohibits all commands
+ * and memory access, except the 0xFD command
+ */
+#define OLED_CMD_SET_CMD_LOCK ( 0xFD /* << 8 */ )
+// unlock OLED driver MCU interface for entering command (default upon reset)
+#define OLED_UNLOCK           (0x12)
+// lock OLED driver MCU interface for entering command
+#define OLED_LOCK             (0x16)
+// commands 0xA2, 0xB1, 0xB3, 0xBB, 0xBE, 0xC1 are inaccessible in both lock and unlock state (default upon reset)
+#define OLED_ACC_TO_CMD_NO    (0xB0)
+// commands 0xA2, 0xB1, 0xB3, 0xBB, 0xBE, 0xC1 are accessible in unlock state
+#define OLED_ACC_TO_CMD_YES   (0xB1)
+
+/**
+ * NOP
+ */
+#define OLED_CMD_NOP (0xD1) // also, 0xE3
+
+/**
+ * set MUX ratio
+ */
+#define OLED_CMD_SET_MUX_RATIO (0xCA)
+
+/**
+ * set re-map / color depth
+ */
+#define OLED_CMD_SET_REMAP ( 0xA0 )
+
+// set horisontal or vertical increment
+#define OLED_ADDR_INC_HOR (0x00)
+#define OLED_ADDR_INC_VER (0x01)
+
+// column address mapping
+#define OLED_COLUMN_ADDR_REMAP_0_TO_SEG0   (0x00)
+#define OLED_COLUMN_ADDR_REMAP_127_TO_SEG0 (0x02)
+
+// color sequence order
+#define OLED_COLOR_SEQ_A_B_C (0x00)
+#define OLED_COLOR_SEQ_C_B_A (0x04)
+
+// scanning order (MR == MUX ratio)
+#define OLED_SCAN_FROM_COM_0_TO_MR (0x00)
+#define OLED_SCAN_FROM_COM_MR_TO_0 (0x10)
+
+// COM splitting to odd and even
+#define OLED_COM_SPLIT_DISABLE (0x00)
+#define OLED_COM_SPLIT_ENABLE  (0x20)
+
+// screen color depth
+#define OLED_COLOR_DEPTH_256    (0x00)
+#define OLED_COLOR_DEPTH_65K    (0x40)
+#define OLED_COLOR_DEPTH_262K_1 (0x80)
+#define OLED_COLOR_DEPTH_262K_2 (0xC0)
+
+/**
+ * set reset (phase 1) / pre-charge (phase 2) period in [DCLK]
+ * this command is locked by command 0xFD by default
+ */
+#define OLED_CMD_SET_RESET_AND_PRECHARGE_PERIOD (0xB1)
+
+#define OLED_RESET_PERIOD_5  (0x02)
+#define OLED_RESET_PERIOD_7  (0x03)
+#define OLED_RESET_PERIOD_9  (0x04)
+#define OLED_RESET_PERIOD_11 (0x05)
+#define OLED_RESET_PERIOD_13 (0x06)
+#define OLED_RESET_PERIOD_15 (0x07)
+#define OLED_RESET_PERIOD_17 (0x08)
+#define OLED_RESET_PERIOD_19 (0x09)
+#define OLED_RESET_PERIOD_21 (0x0A)
+#define OLED_RESET_PERIOD_23 (0x0B)
+#define OLED_RESET_PERIOD_25 (0x0C)
+#define OLED_RESET_PERIOD_27 (0x0D)
+#define OLED_RESET_PERIOD_29 (0x0E)
+#define OLED_RESET_PERIOD_31 (0x0F)
+
+#define OLED_PRECHARGE_PERIOD_3  (0x03)
+#define OLED_PRECHARGE_PERIOD_4  (0x04)
+#define OLED_PRECHARGE_PERIOD_5  (0x05)
+#define OLED_PRECHARGE_PERIOD_6  (0x06)
+#define OLED_PRECHARGE_PERIOD_7  (0x07)
+#define OLED_PRECHARGE_PERIOD_8  (0x08)
+#define OLED_PRECHARGE_PERIOD_9  (0x09)
+#define OLED_PRECHARGE_PERIOD_10 (0x0A)
+#define OLED_PRECHARGE_PERIOD_11 (0x0B)
+#define OLED_PRECHARGE_PERIOD_12 (0x0C)
+#define OLED_PRECHARGE_PERIOD_13 (0x0D)
+#define OLED_PRECHARGE_PERIOD_14 (0x0E)
+#define OLED_PRECHARGE_PERIOD_15 (0x0F)
+
+/**
+ * set front clock divider (divset) / oscillator frequency
+ * this command is locked by command 0xFD by default
+ */
+#define OLED_CMD_SET_OSC_FREQ_AND_CLOCKDIV (0xB3)
+
+// clock divider
+#define OLED_CLOCKDIV_1    (0x00)
+#define OLED_CLOCKDIV_2    (0x01)
+#define OLED_CLOCKDIV_4    (0x02)
+#define OLED_CLOCKDIV_8    (0x03)
+#define OLED_CLOCKDIV_16   (0x04)
+#define OLED_CLOCKDIV_32   (0x05)
+#define OLED_CLOCKDIV_64   (0x06)
+#define OLED_CLOCKDIV_128  (0x07)
+#define OLED_CLOCKDIV_256  (0x08)
+#define OLED_CLOCKDIV_512  (0x09)
+#define OLED_CLOCKDIV_1024 (0x0A)
+
+// oscillator frequency, frequency increases as level increases
+#define OLED_OSC_FREQ (0xB0)
+
+#define OLED_CMD_STARTLINE (0xA1)
+
+#define OLED_CMD_WRITERAM       (0x5C)
+#define OLED_CMD_READRAM        (0x5D)
+#define OLED_CMD_DISPLAYOFFSET  (0xA2)
+#define OLED_CMD_DISPLAYALLOFF  (0xA4)
+#define OLED_CMD_DISPLAYALLON   (0xA5)
+#define OLED_CMD_NORMALDISPLAY  (0xA6)
+#define OLED_CMD_INVERTDISPLAY  (0xA7)
+#define OLED_CMD_FUNCTIONSELECT (0xAB)
+#define OLED_CMD_DISPLAYOFF     (0xAE)
+#define OLED_CMD_DISPLAYON      (0xAF)
+#define OLED_CMD_PRECHARGE      (0xB1)
+#define OLED_CMD_DISPLAYENHANCE (0xB2)
+#define OLED_CMD_SETVSL         (0xB4)
+#define OLED_CMD_SETGPIO        (0xB5)
+#define OLED_CMD_PRECHARGE2     (0xB6)
+#define OLED_CMD_SETGRAY        (0xB8)
+#define OLED_CMD_USELUT         (0xB9)
+#define OLED_CMD_PRECHARGELEVEL (0xBB)
+#define OLED_CMD_VCOMH          (0xBE)
+#define OLED_CMD_CONTRASTABC    (0xC1)
+#define OLED_CMD_CONTRASTMASTER (0xC7)
+#define OLED_CMD_MUXRATIO       (0xCA)
+#define OLED_CMD_COMMANDLOCK    (0xFD)
+#define OLED_CMD_HORIZSCROLL    (0x96)
+#define OLED_CMD_STOPSCROLL     (0x9E)
+#define OLED_CMD_STARTSCROLL    (0x9F)
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OLED_types.h	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,149 @@
+/** OLED Types 
+ *  This file contains OLED-related data structures.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of NXP, nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * visit: http://www.mikroe.com and http://www.nxp.com
+ *
+ * get support at: http://www.mikroe.com/forum and https://community.nxp.com
+ *
+ * Project HEXIWEAR, 2015
+ */
+ 
+ 
+/**
+ * OLED-related data structures
+ * Project HEXIWEAR, 2015
+ */
+
+#ifndef HG_OLED_TYPES
+#define HG_OLED_TYPES
+
+#include <stdint.h>
+
+typedef enum
+{
+  OLED_TRANSITION_NONE,
+  OLED_TRANSITION_TOP_DOWN,
+  OLED_TRANSITION_DOWN_TOP,
+  OLED_TRANSITION_LEFT_RIGHT,
+  OLED_TRANSITION_RIGHT_LEFT
+
+} oled_transition_t;
+
+typedef enum
+{
+  OLED_STATUS_SUCCESS,        // success
+  OLED_STATUS_ERROR,          // fail
+  OLED_STATUS_PROTOCOL_ERROR, // SPI failure
+  OLED_STATUS_INIT_ERROR,     // initialization error
+  OLED_STATUS_DEINIT_ERROR    // deinitialization error
+
+} oled_status_t;
+
+
+#if 0 
+typedef struct
+{
+  /**
+   * SPI relevant information
+   */
+  genericSpiHandle_t protocol;
+
+} handleOLED_t;
+#endif
+
+
+typedef uint16_t* oled_pixel_t;
+
+typedef struct
+{
+  uint32_t DCpin;
+  uint32_t CSpin;
+  uint32_t RSTpin;
+// uint32_t RWpin;
+  uint32_t ENpin;
+
+} settingsOLED_t;
+
+typedef enum
+{
+  OLED_TEXT_ALIGN_NONE = 0,
+
+  OLED_TEXT_ALIGN_LEFT   = 0x1,
+  OLED_TEXT_ALIGN_RIGHT  = 0x2,
+  OLED_TEXT_ALIGN_CENTER = 0x3,
+
+  OLED_TEXT_VALIGN_TOP    = 0x10,
+  OLED_TEXT_VALIGN_BOTTOM = 0x20,
+  OLED_TEXT_VALIGN_CENTER = 0x30
+
+} oled_text_align_t;
+
+typedef struct
+{
+         int8_t xCrd;
+         int8_t yCrd;
+         uint8_t width;
+         uint8_t height;
+    oled_pixel_t areaBuffer;
+
+} oled_dynamic_area_t;
+
+typedef struct
+{
+  const uint8_t* font;
+  uint16_t fontColor;
+  oled_text_align_t alignParam;
+  const uint8_t* background;
+
+} oled_text_properties_t;
+
+
+/** color chart */
+typedef enum
+{
+  COLOR_BLACK    = 0x0000,
+  COLOR_BLUE_1   = 0x06FF,
+  COLOR_BLUE     = 0x001F,
+  COLOR_RED      = 0xF800,
+  COLOR_GREEN    = 0x07E0,
+  COLOR_CYAN     = 0x07FF,
+  COLOR_MAGENTA  = 0xF81F,
+  COLOR_YELLOW   = 0xFFE0,
+  COLOR_GRAY     = 0x528A,
+  COLOR_WHITE    = 0xFFFF
+
+} Color_t;     
+
+typedef struct _init_cmd_tag
+{
+    uint32_t cmd;
+    uint8_t  type;
+} init_cmd_t;
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OpenSans_Font.c	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,422 @@
+/** OpenSans Font 
+ *  This file contains the Hexiwear optimized OpenSans font. 
+ *
+ *  For more information 
+ *  visit: https://github.com/google/fonts/tree/master/apache/opensans
+ * 
+ *  Font converted with MicroElektronika's Hexiwear Resource Collection Tool
+ *  visit: https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
+ */
+
+#include "OpenSans_Font.h"
+
+/*  Max Width of Character  = 12px
+ *  Max Height of Character = 18px */
+const uint8_t OpenSans_12x18_Regular[] = {
+   0x00,
+   0x00,
+   0x20,0x00,
+   0x7F,0x00,
+   0x12,
+   0x10,
+   0x02,0x88,0x01,0x00,
+   0x02,0x9A,0x01,0x00,
+   0x04,0xAC,0x01,0x00,
+   0x08,0xBE,0x01,0x00,
+   0x06,0xD0,0x01,0x00,
+   0x0A,0xE2,0x01,0x00, // % width
+   0x08,0x06,0x02,0x00,
+   0x02,0x18,0x02,0x00,
+   0x03,0x2A,0x02,0x00,
+   0x03,0x3C,0x02,0x00,
+   0x06,0x4E,0x02,0x00,
+   0x07,0x60,0x02,0x00,
+   0x02,0x72,0x02,0x00,
+   0x03,0x84,0x02,0x00,
+   0x02,0x96,0x02,0x00,
+   0x05,0xA8,0x02,0x00,
+   0x06,0xBA,0x02,0x00,
+   0x04,0xCC,0x02,0x00,
+   0x06,0xDE,0x02,0x00,
+   0x06,0xF0,0x02,0x00,
+   0x07,0x02,0x03,0x00,
+   0x06,0x14,0x03,0x00,
+   0x06,0x26,0x03,0x00,
+   0x06,0x38,0x03,0x00,
+   0x06,0x4A,0x03,0x00,
+   0x06,0x5C,0x03,0x00,
+   0x02,0x6E,0x03,0x00,
+   0x02,0x80,0x03,0x00,
+   0x06,0x92,0x03,0x00,
+   0x06,0xA4,0x03,0x00,
+   0x06,0xB6,0x03,0x00,
+   0x06,0xC8,0x03,0x00,
+   0x0B,0xDA,0x03,0x00,
+   0x08,0xFE,0x03,0x00,
+   0x07,0x10,0x04,0x00,
+   0x08,0x22,0x04,0x00,
+   0x08,0x34,0x04,0x00,
+   0x06,0x46,0x04,0x00,
+   0x07,0x58,0x04,0x00,
+   0x08,0x6A,0x04,0x00,
+   0x09,0x7C,0x04,0x00,
+   0x02,0xA0,0x04,0x00,
+   0x02,0xB2,0x04,0x00,
+   0x08,0xC4,0x04,0x00,
+   0x07,0xD6,0x04,0x00,
+   0x0B,0xE8,0x04,0x00,
+   0x09,0x0C,0x05,0x00,
+   0x09,0x30,0x05,0x00,
+   0x07,0x54,0x05,0x00,
+   0x09,0x66,0x05,0x00,
+   0x07,0x8A,0x05,0x00,
+   0x06,0x9C,0x05,0x00,
+   0x07,0xAE,0x05,0x00,
+   0x08,0xC0,0x05,0x00,
+   0x08,0xD2,0x05,0x00,
+   0x0C,0xE4,0x05,0x00,
+   0x08,0x08,0x06,0x00,
+   0x07,0x1A,0x06,0x00,
+   0x07,0x2C,0x06,0x00,
+   0x04,0x3E,0x06,0x00,
+   0x05,0x50,0x06,0x00,
+   0x03,0x62,0x06,0x00,
+   0x06,0x74,0x06,0x00,
+   0x06,0x86,0x06,0x00,
+   0x05,0x98,0x06,0x00,
+   0x06,0xAA,0x06,0x00,
+   0x07,0xBC,0x06,0x00,
+   0x06,0xCE,0x06,0x00,
+   0x07,0xE0,0x06,0x00,
+   0x06,0xF2,0x06,0x00,
+   0x05,0x04,0x07,0x00,
+   0x07,0x16,0x07,0x00,
+   0x07,0x28,0x07,0x00,
+   0x02,0x3A,0x07,0x00,
+   0x02,0x4C,0x07,0x00,
+   0x06,0x5E,0x07,0x00,
+   0x02,0x70,0x07,0x00,
+   0x0A,0x82,0x07,0x00,  //+1 width for m 
+   0x07,0xA6,0x07,0x00,
+   0x07,0xB8,0x07,0x00,
+   0x07,0xCA,0x07,0x00,
+   0x07,0xDC,0x07,0x00,
+   0x05,0xEE,0x07,0x00,
+   0x05,0x00,0x08,0x00,
+   0x05,0x12,0x08,0x00,
+   0x07,0x24,0x08,0x00,
+   0x07,0x36,0x08,0x00,
+   0x0A,0x48,0x08,0x00,
+   0x06,0x6C,0x08,0x00,
+   0x07,0x7E,0x08,0x00,
+   0x06,0x90,0x08,0x00,
+   0x05,0xA2,0x08,0x00,
+   0x04,0xB4,0x08,0x00,
+   0x05,0xC6,0x08,0x00,
+   0x07,0xD8,0x08,0x00,
+   0x03,0xEA,0x08,0x00,
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 32
+   0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 33
+   0x00,0x00,0x00,0x00,0x00,0x0A,0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 34
+   0x00,0x00,0x00,0x00,0x00,0x48,0x28,0xFE,0x24,0x24,0x7F,0x14,0x14,0x12,0x00,0x00,0x00,0x00, // Code for char num 35
+   0x00,0x00,0x00,0x00,0x08,0x3C,0x0A,0x0A,0x0E,0x18,0x28,0x28,0x28,0x1E,0x08,0x00,0x00,0x00, // Code for char num 36
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x00,0x8A,0x00,0x4A,0x00,0x4A,0x03,0xAA,0x02,0x96,0x02,0x90,0x02,0x88,0x02,0x08,0x03,0x00,0x00,0x00, 0x00,0x00, 0x00, 0x00, 0x00, // Code for char num 37 (%)
+   0x00,0x00,0x00,0x00,0x00,0x1C,0x24,0x24,0x14,0x0C,0x96,0xA2,0x42,0xBC,0x00,0x00,0x00,0x00, // Code for char num 38
+   0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 39
+   0x00,0x00,0x00,0x00,0x00,0x04,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x06,0x04,0x00,0x00, // Code for char num 40
+   0x00,0x00,0x00,0x00,0x00,0x02,0x06,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x06,0x02,0x00,0x00, // Code for char num 41
+   0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x14,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 42
+   0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, // Code for char num 43
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x00,0x00,0x00, // Code for char num 44
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 45
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 46
+   0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00, // Code for char num 47
+   0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1C,0x00,0x00,0x00,0x00, // Code for char num 48
+   0x00,0x00,0x00,0x00,0x00,0x08,0x0C,0x0A,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, // Code for char num 49
+   0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x20,0x20,0x10,0x08,0x04,0x02,0x3E,0x00,0x00,0x00,0x00, // Code for char num 50
+   0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x20,0x30,0x1C,0x20,0x20,0x20,0x1E,0x00,0x00,0x00,0x00, // Code for char num 51
+   0x00,0x00,0x00,0x00,0x00,0x30,0x28,0x28,0x24,0x22,0x22,0x7F,0x30,0x30,0x00,0x00,0x00,0x00, // Code for char num 52 (4)
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x02,0x02,0x1E,0x20,0x20,0x20,0x20,0x1E,0x00,0x00,0x00,0x00, // Code for char num 53
+   0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x02,0x1E,0x22,0x22,0x22,0x22,0x1C,0x00,0x00,0x00,0x00, // Code for char num 54
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00,0x00,0x00, // Code for char num 55
+   0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x22,0x36,0x1C,0x22,0x22,0x22,0x1C,0x00,0x00,0x00,0x00, // Code for char num 56
+   0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x22,0x22,0x22,0x3C,0x20,0x30,0x0E,0x00,0x00,0x00,0x00, // Code for char num 57
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 58
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x02,0x02,0x01,0x00,0x00,0x00, // Code for char num 59
+   0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x18,0x06,0x06,0x18,0x20,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 60
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 61
+   0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x0C,0x30,0x30,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 62
+   0x00,0x00,0x00,0x00,0x00,0x1E,0x30,0x20,0x10,0x0C,0x04,0x00,0x04,0x04,0x00,0x00,0x00,0x00, // Code for char num 63
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x0C,0x02,0xE4,0x04,0x92,0x04,0x92,0x04,0x8A,0x04,0x92,0x04,0x72,0x03,0x04,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 64
+   0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x24,0x24,0x7E,0x42,0x42,0x81,0x00,0x00,0x00,0x00, // Code for char num 65
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x3E,0x42,0x42,0x42,0x3E,0x00,0x00,0x00,0x00, // Code for char num 66
+   0x00,0x00,0x00,0x00,0x00,0xF8,0x04,0x02,0x02,0x02,0x02,0x02,0x04,0x78,0x00,0x00,0x00,0x00, // Code for char num 67
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x82,0x82,0x82,0x82,0x82,0x42,0x3E,0x00,0x00,0x00,0x00, // Code for char num 68
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x02,0x02,0x02,0x3E,0x02,0x02,0x02,0x3E,0x00,0x00,0x00,0x00, // Code for char num 69
+   0x00,0x00,0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x3E,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 70
+   0x00,0x00,0x00,0x00,0x00,0xF8,0x04,0x02,0x02,0xE2,0x82,0x82,0x84,0xF8,0x00,0x00,0x00,0x00, // Code for char num 71
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0xFE,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 72
+   0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 73
+   0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00,0x00, // Code for char num 74
+   0x00,0x00,0x00,0x00,0x00,0x42,0x22,0x12,0x1A,0x1E,0x12,0x22,0x42,0xC2,0x00,0x00,0x00,0x00, // Code for char num 75
+   0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x7E,0x00,0x00,0x00,0x00, // Code for char num 76
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x0E,0x05,0x0A,0x05,0x0A,0x05,0x92,0x04,0x92,0x04,0x72,0x04,0x62,0x04,0x62,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 77
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x01,0x0E,0x01,0x0A,0x01,0x12,0x01,0x32,0x01,0x22,0x01,0x42,0x01,0xC2,0x01,0x82,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 78
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x84,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 79
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x3E,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 80
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x84,0x00,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x84,0x00,0x78,0x00,0x40,0x00,0x80,0x00,0x00,0x00,0x00,0x00, // Code for char num 81
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x3E,0x22,0x22,0x42,0x42,0x00,0x00,0x00,0x00, // Code for char num 82
+   0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x06,0x1C,0x20,0x20,0x20,0x1E,0x00,0x00,0x00,0x00, // Code for char num 83
+   0x00,0x00,0x00,0x00,0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, // Code for char num 84
+   0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x3C,0x00,0x00,0x00,0x00, // Code for char num 85
+   0x00,0x00,0x00,0x00,0x00,0x81,0x42,0x42,0x66,0x24,0x24,0x3C,0x18,0x18,0x00,0x00,0x00,0x00, // Code for char num 86
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x08,0x62,0x04,0x62,0x04,0x92,0x04,0x96,0x04,0x94,0x02,0x0C,0x03,0x0C,0x03,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 87
+   0x00,0x00,0x00,0x00,0x00,0x42,0x66,0x24,0x18,0x18,0x38,0x24,0x42,0xC3,0x00,0x00,0x00,0x00, // Code for char num 88
+   0x00,0x00,0x00,0x00,0x00,0x41,0x22,0x22,0x14,0x1C,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, // Code for char num 89
+   0x00,0x00,0x00,0x00,0x00,0x3E,0x20,0x10,0x18,0x08,0x04,0x04,0x02,0x7F,0x00,0x00,0x00,0x00, // Code for char num 90
+   0x00,0x00,0x00,0x00,0x00,0x0E,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x0E,0x00,0x00, // Code for char num 91
+   0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x00,0x00,0x00,0x00, // Code for char num 92
+   0x00,0x00,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x07,0x00,0x00, // Code for char num 93
+   0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x14,0x22,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 94
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00, // Code for char num 95
+   0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 96
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x20,0x20,0x3C,0x22,0x22,0x3E,0x00,0x00,0x00,0x00, // Code for char num 97
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00,0x00, // Code for char num 98
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x02,0x02,0x02,0x1C,0x00,0x00,0x00,0x00, // Code for char num 99
+   0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x62,0x5C,0x00,0x00,0x00,0x00, // Code for char num 100
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x22,0x3E,0x02,0x02,0x3C,0x00,0x00,0x00,0x00, // Code for char num 101
+   0x00,0x00,0x00,0x00,0x1C,0x06,0x02,0x0F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 102
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x22,0x22,0x1E,0x02,0x02,0x3C,0x43,0x21,0x3E,0x00, // Code for char num 103
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, // Code for char num 104
+   0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 105
+   0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x00, // Code for char num 106
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x22,0x12,0x0A,0x0E,0x1A,0x32,0x22,0x00,0x00,0x00,0x00, // Code for char num 107
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 108
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBA,0x03,0x66,0x02,0x22,0x02,0x22,0x02,0x22,0x02,0x22,0x02,0x22,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 109 (m)
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3A,0x46,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, // Code for char num 110
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00, // Code for char num 111
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3A,0x46,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x02,0x00, // Code for char num 112
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x62,0x5C,0x40,0x40,0x40,0x00, // Code for char num 113
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1A,0x06,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, // Code for char num 114
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x02,0x02,0x0C,0x10,0x10,0x1E,0x00,0x00,0x00,0x00, // Code for char num 115
+   0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x1F,0x02,0x02,0x02,0x02,0x06,0x1C,0x00,0x00,0x00,0x00, // Code for char num 116
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x62,0x5C,0x00,0x00,0x00,0x00, // Code for char num 117
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x22,0x22,0x36,0x14,0x14,0x08,0x00,0x00,0x00,0x00, // Code for char num 118
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x32,0x01,0x32,0x01,0x4A,0x01,0x4A,0x01,0xCC,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 119
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x36,0x14,0x08,0x14,0x36,0x22,0x00,0x00,0x00,0x00, // Code for char num 120
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x22,0x22,0x36,0x14,0x14,0x08,0x08,0x04,0x07,0x00, // Code for char num 121
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x10,0x08,0x04,0x04,0x02,0x3E,0x00,0x00,0x00,0x00, // Code for char num 122
+   0x00,0x00,0x00,0x00,0x00,0x18,0x04,0x04,0x04,0x04,0x03,0x04,0x04,0x04,0x04,0x18,0x00,0x00, // Code for char num 123
+   0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, // Code for char num 124
+   0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x04,0x18,0x04,0x04,0x04,0x04,0x03,0x00,0x00, // Code for char num 125
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 126 (~)
+   0x00,0x00,0x00,0x07,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x07,0x00,0x00,0x00,0x00,0x00  // Code for char num 127
+        };
+
+/*  Max Width of Character  = 10px
+ *  Max Height of Character = 15px  */
+ const uint8_t OpenSans_10x15_Regular[] = {
+   0x00,
+   0x00,
+   0x20,0x00,
+   0x7F,0x00,
+   0x0F,
+   0x10,
+   0x02,0x88,0x01,0x00,
+   0x02,0x97,0x01,0x00,
+   0x03,0xA6,0x01,0x00,
+   0x07,0xB5,0x01,0x00,
+   0x06,0xC4,0x01,0x00, //$ Incremented Width +1
+   0x08,0xD3,0x01,0x00,
+   0x07,0xE2,0x01,0x00,
+   0x02,0xF1,0x01,0x00,
+   0x02,0x00,0x02,0x00,
+   0x03,0x0F,0x02,0x00,
+   0x06,0x1E,0x02,0x00,
+   0x06,0x2D,0x02,0x00,
+   0x02,0x3C,0x02,0x00,
+   0x03,0x4B,0x02,0x00,
+   0x02,0x5A,0x02,0x00,
+   0x04,0x69,0x02,0x00,
+   0x05,0x78,0x02,0x00,
+   0x04,0x87,0x02,0x00,
+   0x05,0x96,0x02,0x00,
+   0x05,0xA5,0x02,0x00,
+   0x06,0xB4,0x02,0x00,
+   0x05,0xC3,0x02,0x00,
+   0x05,0xD2,0x02,0x00,
+   0x05,0xE1,0x02,0x00,
+   0x05,0xF0,0x02,0x00,
+   0x05,0xFF,0x02,0x00,
+   0x02,0x0E,0x03,0x00,
+   0x02,0x1D,0x03,0x00,
+   0x05,0x2C,0x03,0x00,
+   0x05,0x3B,0x03,0x00,
+   0x05,0x4A,0x03,0x00,
+   0x05,0x59,0x03,0x00,
+   0x09,0x68,0x03,0x00,
+   0x07,0x86,0x03,0x00,
+   0x06,0x95,0x03,0x00,
+   0x07,0xA4,0x03,0x00,
+   0x07,0xB3,0x03,0x00,
+   0x05,0xC2,0x03,0x00,
+   0x06,0xD1,0x03,0x00,
+   0x07,0xE0,0x03,0x00,
+   0x07,0xEF,0x03,0x00,
+   0x02,0xFE,0x03,0x00,
+   0x02,0x0D,0x04,0x00,
+   0x07,0x1C,0x04,0x00,
+   0x06,0x2B,0x04,0x00,
+   0x09,0x3A,0x04,0x00,
+   0x07,0x58,0x04,0x00,
+   0x08,0x67,0x04,0x00,
+   0x06,0x76,0x04,0x00,
+   0x08,0x85,0x04,0x00,
+   0x06,0x94,0x04,0x00,
+   0x05,0xA3,0x04,0x00,
+   0x06,0xB2,0x04,0x00,
+   0x07,0xC1,0x04,0x00,
+   0x07,0xD0,0x04,0x00,
+   0x0A,0xDF,0x04,0x00,
+   0x06,0xFD,0x04,0x00,
+   0x06,0x0C,0x05,0x00,
+   0x06,0x1B,0x05,0x00,
+   0x04,0x2A,0x05,0x00,
+   0x04,0x39,0x05,0x00,
+   0x03,0x48,0x05,0x00,
+   0x06,0x57,0x05,0x00,
+   0x05,0x66,0x05,0x00,
+   0x04,0x75,0x05,0x00,
+   0x05,0x84,0x05,0x00,
+   0x06,0x93,0x05,0x00,
+   0x05,0xA2,0x05,0x00,
+   0x06,0xB1,0x05,0x00,
+   0x05,0xC0,0x05,0x00,
+   0x04,0xCF,0x05,0x00,
+   0x06,0xDE,0x05,0x00,
+   0x06,0xED,0x05,0x00,
+   0x02,0xFC,0x05,0x00,
+   0x02,0x0B,0x06,0x00,
+   0x05,0x1A,0x06,0x00,
+   0x02,0x29,0x06,0x00,
+   0x0A,0x38,0x06,0x00,
+   0x06,0x56,0x06,0x00,
+   0x06,0x65,0x06,0x00,
+   0x06,0x74,0x06,0x00,
+   0x06,0x83,0x06,0x00,
+   0x04,0x92,0x06,0x00,
+   0x05,0xA1,0x06,0x00,
+   0x04,0xB0,0x06,0x00,
+   0x06,0xBF,0x06,0x00,
+   0x06,0xCE,0x06,0x00,
+   0x09,0xDD,0x06,0x00,
+   0x05,0xFB,0x06,0x00,
+   0x06,0x0A,0x07,0x00,
+   0x05,0x19,0x07,0x00,
+   0x04,0x28,0x07,0x00,
+   0x04,0x37,0x07,0x00,
+   0x03,0x46,0x07,0x00,
+   0x05,0x55,0x07,0x00,
+   0x03,0x64,0x07,0x00,
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 32
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x00,0x00,0x00,      // Code for char num 33
+   0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 34
+   0x00,0x00,0x00,0x00,0x20,0x24,0x7E,0x14,0x14,0x3F,0x12,0x02,0x00,0x00,0x00,      // Code for char num 35
+   0x00,0x00,0x00,0x00,0x08,0x3C,0x0A,0x0A,0x1E,0x28,0x28,0x1E,0x00,0x00,0x00,      // Code for char num 36 ($)
+   0x00,0x00,0x00,0x00,0x46,0x2A,0x2A,0xDA,0xB6,0xA8,0xA8,0xC4,0x00,0x00,0x00,      // Code for char num 37
+   0x00,0x00,0x00,0x00,0x1C,0x12,0x12,0x0C,0x4A,0x52,0x22,0x5E,0x00,0x00,0x00,      // Code for char num 38
+   0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 39
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x00,      // Code for char num 40
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x04,0x04,0x04,0x04,0x02,0x02,0x02,0x00,      // Code for char num 41())
+   0x00,0x00,0x00,0x00,0x04,0x04,0x3F,0x0C,0x12,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 42
+   0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,0x00,0x00,      // Code for char num 43 (+)
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x00,      // Code for char num 44
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,      // Code for char num 45
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,      // Code for char num 46
+   0x00,0x00,0x00,0x00,0x08,0x04,0x04,0x04,0x02,0x02,0x02,0x01,0x00,0x00,0x00,      // Code for char num 47
+   0x00,0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x12,0x12,0x12,0x0C,0x00,0x00,0x00,      // Code for char num 48
+   0x00,0x00,0x00,0x00,0x0C,0x0A,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,      // Code for char num 49
+   0x00,0x00,0x00,0x00,0x0E,0x10,0x10,0x10,0x08,0x04,0x02,0x1E,0x00,0x00,0x00,      // Code for char num 50
+   0x00,0x00,0x00,0x00,0x1E,0x10,0x10,0x0C,0x10,0x10,0x11,0x0E,0x00,0x00,0x00,      // Code for char num 51
+   0x00,0x00,0x00,0x00,0x18,0x18,0x14,0x12,0x12,0x3F,0x10,0x10,0x00,0x00,0x00,      // Code for char num 52
+   0x00,0x00,0x00,0x00,0x1E,0x02,0x02,0x1E,0x10,0x10,0x10,0x0E,0x00,0x00,0x00,      // Code for char num 53
+   0x00,0x00,0x00,0x00,0x1C,0x02,0x02,0x1E,0x12,0x12,0x12,0x1C,0x00,0x00,0x00,      // Code for char num 54
+   0x00,0x00,0x00,0x00,0x1F,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x00,0x00,0x00,      // Code for char num 55
+   0x00,0x00,0x00,0x00,0x1E,0x12,0x12,0x0C,0x12,0x12,0x12,0x1E,0x00,0x00,0x00,      // Code for char num 56
+   0x00,0x00,0x00,0x00,0x0E,0x12,0x12,0x12,0x1E,0x10,0x10,0x0E,0x00,0x00,0x00,      // Code for char num 57
+   0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,      // Code for char num 58
+   0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x00,      // Code for char num 59
+   0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x06,0x02,0x0C,0x10,0x00,0x00,0x00,0x00,      // Code for char num 60
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,      // Code for char num 61
+   0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x18,0x10,0x0C,0x02,0x00,0x00,0x00,0x00,      // Code for char num 62 (>)
+   0x00,0x00,0x00,0x00,0x0F,0x10,0x10,0x08,0x04,0x00,0x00,0x06,0x00,0x00,0x00,      // Code for char num 63
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x04,0x01,0x72,0x01,0x4A,0x01,0x4A,0x01,0x4A,0x01,0xFA,0x01,0x02,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,// Code for char num 64
+   0x00,0x00,0x00,0x00,0x08,0x14,0x14,0x14,0x22,0x3E,0x22,0x41,0x00,0x00,0x00,      // Code for char num 65
+   0x00,0x00,0x00,0x00,0x3E,0x22,0x22,0x1E,0x22,0x22,0x22,0x3E,0x00,0x00,0x00,      // Code for char num 66
+   0x00,0x00,0x00,0x00,0x3C,0x06,0x02,0x02,0x02,0x02,0x06,0x3C,0x00,0x00,0x00,      // Code for char num 67 (C)
+   0x00,0x00,0x00,0x00,0x3E,0x62,0x42,0x42,0x42,0x42,0x62,0x3E,0x00,0x00,0x00,      // Code for char num 68
+   0x00,0x00,0x00,0x00,0x1E,0x02,0x02,0x1E,0x02,0x02,0x02,0x1E,0x00,0x00,0x00,      // Code for char num 69
+   0x00,0x00,0x00,0x00,0x3E,0x02,0x02,0x02,0x3E,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 70
+   0x00,0x00,0x00,0x00,0x78,0x06,0x02,0x02,0x62,0x42,0x46,0x7C,0x00,0x00,0x00,      // Code for char num 71
+   0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0x00,0x00,0x00,      // Code for char num 72
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 73
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00,      // Code for char num 74
+   0x00,0x00,0x00,0x00,0x22,0x12,0x1A,0x0E,0x0A,0x12,0x22,0x42,0x00,0x00,0x00,      // Code for char num 75
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x3E,0x00,0x00,0x00,      // Code for char num 76
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x01,0x86,0x01,0x86,0x01,0x4A,0x01,0x4A,0x01,0x32,0x01,0x32,0x01,0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 77
+   0x00,0x00,0x00,0x00,0x42,0x46,0x4A,0x4A,0x52,0x52,0x62,0x42,0x00,0x00,0x00,      // Code for char num 78
+   0x00,0x00,0x00,0x00,0x7C,0xC6,0x82,0x82,0x82,0x82,0xC6,0x7C,0x00,0x00,0x00,      // Code for char num 79
+   0x00,0x00,0x00,0x00,0x1E,0x22,0x22,0x22,0x1E,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 80
+   0x00,0x00,0x00,0x00,0x7C,0xC6,0x82,0x82,0x82,0x82,0xC6,0x7C,0x20,0x40,0x00,      // Code for char num 81
+   0x00,0x00,0x00,0x00,0x1E,0x22,0x22,0x22,0x1E,0x12,0x22,0x22,0x00,0x00,0x00,      // Code for char num 82
+   0x00,0x00,0x00,0x00,0x1C,0x02,0x02,0x06,0x18,0x10,0x10,0x0E,0x00,0x00,0x00,      // Code for char num 83 (S)
+   0x00,0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,      // Code for char num 84 (T)
+   0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00,      // Code for char num 85
+   0x00,0x00,0x00,0x00,0x41,0x22,0x22,0x22,0x14,0x14,0x14,0x08,0x00,0x00,0x00,      // Code for char num 86
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x31,0x01,0x32,0x01,0x4A,0x01,0x4A,0x01,0xCA,0x00,0xCC,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// Code for char num 87
+   0x00,0x00,0x00,0x00,0x21,0x12,0x0C,0x0C,0x0C,0x12,0x12,0x21,0x00,0x00,0x00,      // Code for char num 88
+   0x00,0x00,0x00,0x00,0x21,0x12,0x12,0x0C,0x0C,0x08,0x08,0x08,0x00,0x00,0x00,      // Code for char num 89 (Y)
+   0x00,0x00,0x00,0x00,0x1E,0x10,0x08,0x08,0x04,0x02,0x02,0x3F,0x00,0x00,0x00,      // Code for char num 90
+   0x00,0x00,0x00,0x00,0x0E,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x0E,0x00,      // Code for char num 91
+   0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x02,0x04,0x04,0x04,0x08,0x00,0x00,0x00,      // Code for char num 92
+   0x00,0x00,0x00,0x00,0x07,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x07,0x00,      // Code for char num 93
+   0x00,0x00,0x00,0x00,0x04,0x0C,0x12,0x12,0x21,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 94
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,      // Code for char num 95
+   0x00,0x00,0x00,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 96
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x10,0x1E,0x12,0x12,0x1E,0x00,0x00,0x00,      // Code for char num 97
+   0x00,0x00,0x00,0x00,0x02,0x02,0x1E,0x22,0x22,0x22,0x22,0x1E,0x00,0x00,0x00,      // Code for char num 98
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x02,0x02,0x02,0x02,0x1C,0x00,0x00,0x00,      // Code for char num 99
+   0x00,0x00,0x00,0x00,0x20,0x20,0x3C,0x22,0x22,0x22,0x22,0x3C,0x00,0x00,0x00,      // Code for char num 100
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x12,0x1E,0x02,0x02,0x1C,0x00,0x00,0x00,      // Code for char num 101
+   0x00,0x00,0x00,0x00,0x0C,0x02,0x0F,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 102
+   0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x12,0x12,0x0E,0x02,0x1E,0x21,0x31,0x1E,      // Code for char num 103
+   0x00,0x00,0x00,0x00,0x02,0x02,0x1E,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,      // Code for char num 104
+   0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 105
+   0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,      // Code for char num 106
+   0x00,0x00,0x00,0x00,0x02,0x02,0x12,0x0A,0x06,0x0A,0x12,0x12,0x00,0x00,0x00,      // Code for char num 107
+   0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 108
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDE,0x03,0x22,0x02,0x22,0x02,0x22,0x02,0x22,0x02,0x22,0x02,0x00,0x00,0x00,0x00,0x00, 0x00,   // code for 109 (m)
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,      // Code for char num 110
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x22,0x22,0x22,0x1C,0x00,0x00,0x00,      // Code for char num 111
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x22,0x22,0x22,0x1E,0x02,0x02,0x02,      // Code for char num 112
+   0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x22,0x22,0x22,0x22,0x3C,0x20,0x20,0x20,      // Code for char num 113
+   0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,      // Code for char num 114
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x02,0x04,0x08,0x10,0x0E,0x00,0x00,0x00,      // Code for char num 115 (s)
+   0x00,0x00,0x00,0x00,0x00,0x02,0x0F,0x02,0x02,0x02,0x02,0x0E,0x00,0x00,0x00,      // Code for char num 116
+   0x00,0x00,0x00,0x00,0x00,0x00,0x22,0x22,0x22,0x22,0x22,0x3E,0x00,0x00,0x00,      // Code for char num 117
+   0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x12,0x12,0x12,0x0C,0x0C,0x00,0x00,0x00,      // Code for char num 118
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0xAA,0x00,0xAA,0x00,0xAA,0x00,0xA6,0x00,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Code for char num 119
+   0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x12,0x0C,0x0C,0x12,0x12,0x00,0x00,0x00,      // Code for char num 120
+   0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x12,0x12,0x12,0x0C,0x0C,0x04,0x04,0x03,      // Code for char num 121
+   0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x08,0x04,0x04,0x02,0x1F,0x00,0x00,0x00,      // Code for char num 122
+   0x00,0x00,0x00,0x00,0x0C,0x04,0x04,0x04,0x02,0x02,0x04,0x04,0x04,0x0C,0x00,      // Code for char num 123
+   0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,      // Code for char num 124
+   0x00,0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x04,0x04,0x02,0x02,0x02,0x03,0x00,      // Code for char num 125
+   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x18,0x00,0x00,0x00,0x00,0x00,0x00,      // Code for char num 126
+   0x00,0x00,0x00,0x07,0x05,0x05,0x05,0x05,0x05,0x05,0x07,0x00,0x00,0x00,0x00       // Code for char num 127
+   };
+
+ 
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OpenSans_Font.h	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,25 @@
+/** OpenSans Font 
+ *  This file contains the Hexiwear optimized OpenSans font. 
+ *
+ *  For more information 
+ *  visit: https://github.com/google/fonts/tree/master/apache/opensans
+ * 
+ *  Font converted with MicroElektronika's Hexiwear Resource Collection Tool
+ *  visit: https://github.com/MikroElektronika/HEXIWEAR/tree/master/SW/ResourceCollectionTool
+ */
+
+#ifndef HG_OPENSANS_FONT
+#define HG_OPENSANS_FONT
+
+#include <stdint.h>
+
+/** Max Width of Character  = 12px
+ *  Max Height of Character = 18px */
+extern const uint8_t OpenSans_12x18_Regular[];
+
+/** Max Width of Character  = 10px
+ *  Max Height of Character = 15px */
+extern const uint8_t OpenSans_10x15_Regular[];
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/driver.cpp	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,240 @@
+#include "mbed.h"
+#include "pwm_tone.h"   /* Tone library for Buzzer Click */
+#include "Hexi_OLED_SSD1351.h" /* Header file for OLED Display */
+#include "string.h"
+#include "Hexi_KW40Z.h"   /* Driver for button presses and BLE */
+#include <math.h>       /* Used for ADC conversion algorithm */
+#include <iostream>   /* Used for debugging */
+
+/*****Function Prototypes*****/
+void readSensors();
+void ledColor();
+void led_out();
+void buzzer();
+void CalculatePPM();
+
+PwmOut Buzzer(PTA10);   /* Buzzer is attached to docking station port 1 */
+
+AnalogIn AQSensor(PTB3);   /* Air Quality sensor is attached to docking station port 2 */
+AnalogIn COSensor(PTB6);   /* Carbon Monoxide sensor is attached to docking station port 3 */
+
+BusOut led(PTC8, PTD0, PTC9);   /* RGB Port Configurations */
+
+const int green = 5,
+          red = 6,          /* LED Colors */
+          black = 7,
+          yellow = 4;
+          
+bool is_sounding = false;       /* Set to high if the buzzer is going off */
+          
+int led_color;      /* Variable to hold the current LED color */
+
+Ticker sensor_read,      /* Used for the read sensor subroutine call */
+       buzzer_sound,     /* Used for the sound buzzer subroutine call */
+       led_flash,        /* Used to determine the flash rate */
+       ledcolor,        /* Used to determine the LED color */
+       A2D_Convert;    /* Used to convert the analog signal to digital */
+
+float B_4 = 1000000/Ti4,    /* Tones that will play on the buzzer click */
+      B_5 = 1000000/Ti5;
+      
+char text[20];  /* Static Text Buffer for OLED Display */
+char AQ_level[20]; /* Dynamic Text Buffer for AQ total */
+char CO_level[20]; /* Dynamic Text Buffer for CO total */
+char average[20]; /* Dynamic Text Buffer for the Average total */
+char total_total[20]; /* Dynamic Text Buffer for the Total total */
+
+/* Either unit16_t or float */
+double   total,    /* Variable to store the total total */
+         aq_ppm,   /* Variable used to store the AQ PPM */
+         co_ppm,   /* Variable used to store the CO PPM */ 
+         avg;      /* Variable to store the average total */
+         
+uint16_t aq_total, /* Variable to store the AQ total */
+         co_total; /* Variable to store the CO total */          
+      
+int main(){
+
+    /* Instantiate the SSD1351 OLED Driver */ 
+    SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15);
+    
+    /* Get OLED Class Default Text Properties */
+    oled_text_properties_t textProperties = {0};
+    oled.GetTextProperties(&textProperties);
+    
+    /* Turns on the OLED Display*/
+    oled.PowerON();
+    
+    /* Fills the screen with solid black */         
+    oled.FillScreen(COLOR_BLACK);
+    
+    /* Display 'GAS LEVELS' at (x = 13,y = 0) */
+    strcpy((char *) text,"GAS LEVELS");
+    oled.Label((uint8_t *)text,13,0);
+    
+    /* Change font color to green for Air Quality */ 
+    textProperties.fontColor   = COLOR_GREEN;
+    oled.SetTextProperties(&textProperties);
+    
+    /* Display 'Air Quality: ' at (x = 0, y = 20) */ 
+    strcpy(text,"AQ: ");
+    oled.Label((uint8_t *)text,0,20);
+    
+    /* Change font color to red for Carbon Monoxide */
+    textProperties.fontColor   = COLOR_RED;
+    oled.SetTextProperties(&textProperties);
+    
+    /* Display 'CO: ' at (x = 0, y = 40) */
+    strcpy(text, "CO: ");
+    oled.Label((uint8_t *)text,0,40);
+    
+    /* Change font color to blue for Average and Total total */
+    textProperties.fontColor   = COLOR_BLUE;
+    oled.SetTextProperties(&textProperties);
+    
+    /* Display 'Average: ' at (x = 0, y = 60) */
+    strcpy(text, "Average: ");
+    oled.Label((uint8_t *)text, 0, 60);
+    
+    /* Display 'Total: ' at (x = 0, y = 80) */
+    strcpy(text, "Total: ");
+    oled.Label((uint8_t *)text,0,80);
+    
+    /* Set text properties to white and right aligned for the dynamic text */
+    textProperties.fontColor = COLOR_WHITE;
+    textProperties.alignParam = OLED_TEXT_ALIGN_RIGHT;
+    oled.SetTextProperties(&textProperties);
+    
+    /* Subroutine Calls */
+    sensor_read.attach(&readSensors, 1);   /* Read the sensor on a time interval (Currently 3s) */
+    A2D_Convert.attach(&CalculatePPM, 1);  /* Convert the values read from the sensors to 16 bit integers */
+    ledcolor.attach(&ledColor, 0.5);       /* Determine the LED color */
+    led_flash.attach(&led_out, 0.25);      /* Flash LED based on sensor data */
+    buzzer_sound.attach(&buzzer, 0.25);    /* Sensor values are sent to buzzer function */
+    
+    while (1) { /* Loop to process and display data */
+        
+        /*                                       */
+        /*                                       */
+        /*                                       */
+        /* Code to process sensor data goes here */
+        /*                                       */
+        /*                                       */
+        /*                                       */
+        
+        sprintf(AQ_level,"%.2f",aq_ppm);    /* Print the AQ PPM to the screen */
+        
+        /* Display time reading in 35px by 15px textbox at(x=55, y=40) */
+        oled.TextBox((uint8_t *)AQ_level,55,20,35,15); //Increase textbox for more digits
+        
+        sprintf(CO_level,"%.2f",co_ppm);    /* Print the CO PPM to the screen */
+        
+        oled.TextBox((uint8_t *)CO_level,55,40,35,15);
+        
+        sprintf(average, "%.2f", avg);      /* Print the average to the screen */
+        
+        oled.TextBox((uint8_t *)average,55,60,35,15);
+        
+        sprintf(total_total, "%.2f", total);   /* Print the total to the screen */
+        
+        oled.TextBox((uint8_t *)total_total,55,80,35,15);
+        
+    }
+    
+    return 0;
+}
+
+void readSensors(){  /* Function to read sensors */
+    
+    /* Grab the analog signal from the sensors as 16 bit unsigned integers */
+    aq_total = AQSensor.read_u16();
+    co_total = COSensor.read_u16();
+    /* Grab the analog signal from the sensors as floats */
+    //aq_total = AQSensor.read();
+    //co_total = AQSensor.read();
+  
+}
+
+void ledColor(){    /* Function to determine the LED color */
+    
+    if (total <= 10) {
+        led = green;
+        led_color = led;     /* Store the LED color for the flash function */
+    }
+    else if (total > 10 && total < 50) {
+        led = yellow;
+        led_color = led;     /* Store the LED color for the flash function */
+    }
+    else if (total >= 50) {
+        led = red;
+        led_color = led;     /* Store the LED color for the flash function */
+    }
+}
+
+void led_out() { /* Function to flash LEDs */
+
+    if (led == green) {return;}   /* If green, don't blink */
+    else if (led == black) {led = led_color;}
+    else {led = black;}
+     
+}
+
+void buzzer() { /* Function to handle the buzzer sound */
+
+    if (total <=25){            /* No buzzer sound if PPM is under 10 */
+        Buzzer.period_us(0);
+        is_sounding = false;  
+    }
+
+    else if (total > 25 and total < 50) {
+        if (is_sounding == false){      /* If the buzzer is not triggered, trigger */
+            Buzzer.period_us(B_4);      /* Period of B4 */
+            Buzzer.write(0.50f);        /* 50% Duty Cycle on the Tone */
+            is_sounding = true;         /* Signal that the buzzer is currently triggering */
+        }
+        else {   
+            Buzzer.period_us(0);        /* Turn off the buzzer (Period = 0us)*/
+            is_sounding = false;        /* Signal that the buzzer is no longer triggering */
+        }        
+    }
+    
+    else if (total >= 50){
+        if (is_sounding == false){
+            Buzzer.period_us(B_5);      /* Period of B5 */
+            Buzzer.write(0.50f);        /* 50% Duty Cycle on the Tone */
+            is_sounding = true;
+        }
+        else {   
+            Buzzer.period_us(0);        /* Turn off the buzzer */
+            is_sounding = false;
+        }
+    }   
+}
+
+void CalculatePPM(){ /* Function to convert the analog signals to digital based on 16 bit adc steps */
+    
+    const double AQ_Rl = 20000.0;               // AQ_Rl (20kOhm) - Load resistance for AQ sensor
+    const double CO_Rl = 18500.0;               // CO_Rl (18.5kOhm) - Load resistance for CO sensor
+    const double Vadc_33 = 0.0000503548;         // ADC step 3,3V/65535 0.00503mV (16bit ADC)
+    //const double Vadc_5 = 5.0/65535;          // ADC step 5.0V/2^16 (65535, 16bit ADC)
+    double Vrl;                                  // Output voltage
+    double Rs;                                   // Rs (Ohm) - Sensor resistance
+    double ratio;                                // Rs/Rl ratio
+    double lgPPM;
+
+    Vrl = (double)aq_total * Vadc_33;            // For 3.3V Vcc use Vadc_33
+    Rs = AQ_Rl * (3.3 - Vrl)/Vrl;                 // Calculate sensor resistance
+    ratio = Rs/AQ_Rl;                             // Calculate ratio
+    lgPPM = (log10(ratio) * -0.8) + 0.9;       // Calculate air quality ppm
+    aq_ppm = 6* pow(10,lgPPM);                 // Calculate air quality ppm
+    
+    Vrl = (double)co_total * Vadc_33;            // For 3.3V Vcc use Vadc_33
+    Rs = CO_Rl * (3.3 - Vrl)/Vrl;                 // Calculate sensor resistance
+    ratio = Rs/CO_Rl;                             // Calculate ratio
+    lgPPM = (log10(ratio) * -0.8) + 0.9;       // Calculate carbon monoxide ppm
+    co_ppm = 6* pow(10,lgPPM);                 // Calculate carbon monoxide ppm
+    
+    /* Calculate the average and total */
+    total = co_ppm + aq_ppm;    
+    avg = (total)/2;  
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0993ae540c5c4b5ce3004bead1aefc0c6d1b3ea0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pwm_tone.cpp	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,136 @@
+/* Includes ------------------------------------------------------------------*/
+#include "pwm_tone.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+
+/**
+   * @brief     Tune Function
+   * @param  name : Choose the PwmOut
+                    period : this param is tune value. (C_3...B_5)
+                    beat : this param is beat value. (1..16) 1 means 1/16 beat
+   * @retval    None
+   */
+void Tune(PwmOut name, int period, int beat)
+{  
+    int delay;
+    
+    delay = beat*63;
+    name.period_us(period);
+    name.write(0.50f); // 50% duty cycle
+    wait_ms(delay); // 1 beat
+    name.period_us(0); // Sound off
+}
+
+/**
+   * @brief     Auto tunes Function
+   * @param  name : Choose the PwmOut
+                    period : this param is tune value. (C_3...B_5)
+                    beat : this param is beat value. (1..16) 1 means 1/16 beat
+   * @retval    None
+   */
+void Auto_tunes(PwmOut name, int period, int beat)
+{    
+    int delay;
+    
+    delay = beat*63;
+    name.period_us(period);
+    name.write(0.50f); // 50% duty cycle
+    wait_ms(delay);
+}
+
+/**
+   * @brief     Stop tunes Function
+   * @param  name : Choose the PwmOut
+   * @retval    None
+   */
+void Stop_tunes(PwmOut name)
+{
+    name.period_us(0);
+}
+
+//void buzzer(PwmOut Buzzer, int ppm, float B_4, float B_5)
+//{
+    //int counter = 0;  /* Break condition to take another measurement */
+    //if (ppm >=10 and ppm <=25) {
+        //while (1) {
+            
+           // if (led_green == 0 && led_red == 1 && led_blue == 1){
+               // led_green = 0;
+               // led_red = 0;   /* Yellow LED */
+               // led_blue = 1;
+            //} 
+
+            //else if (led_green == 0 && led_red == 0 && led_blue == 1) {
+               //     led_green = 1;
+                 //   led_red = 1;   /* Blink LED off */
+                  //  led_blue = 1;
+            //}
+            //else {
+                  //  led_green = 0;
+                  //  led_red = 0;   /* Blink LED on */
+                  //  led_blue = 1;
+            //} 
+            //counter++;
+            //wait_ms(400);
+            //if (counter >= 5)
+                //return;   /* After 20 iterations of the alarm, break */
+        //}
+    //}
+    //else if (ppm > 25 and ppm < 100) {
+       // while (1) {
+            
+            //if (led_green == 0 && led_red == 1 && led_blue == 1){
+              //  led_green = 0;
+               // led_red = 0;   /* Yellow LED */
+               // led_blue = 1;
+            //}
+            
+           // else if (led_green == 0 && led_red == 0 && led_blue == 1) {
+                 //   led_green = 1;
+                   // led_red = 1;   /* Blink LED off */
+                  //  led_blue = 1;
+            //}
+            //else {
+              //      led_green = 0;
+                //    led_red = 0;   /* Blink LED on */
+                 //   led_blue = 1;
+            //}
+         //   Tune(Buzzer, B_4, 10);
+            //counter++; 
+           // wait_ms(250);
+            //if (counter >= 5)
+                //return;   /* After 20 iterations of the alarm, break */
+       // }
+    //}
+    
+    //else if (ppm >= 100) {
+        //while (1) {
+            
+            //if (led_green == 0 && led_red == 1 && led_blue ==1){
+            //led_green = 1;
+            //led_red = 0;   /* Red LED */
+            //led_blue = 1;
+            //}
+            
+            //else if (led_green == 1 && led_red == 0 && led_blue == 1) {
+              //      led_green = 1;
+               //     led_red = 1;   /* Blink LED off */
+               //     led_blue = 1;
+            //}
+            //else {
+              //      led_green = 1;
+                //    led_red = 0;   /* Blink LED on */
+                //    led_blue = 1;
+            //}
+           // Tune(Buzzer, B_5, 5); 
+            //counter++;
+           // wait_ms(100);
+            //if (counter >= 5)
+                //return;   /* After 20 iterations of the alarm, break */
+       // }
+   // }
+//}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pwm_tone.h	Wed Mar 15 19:14:55 2017 +0000
@@ -0,0 +1,50 @@
+/* Includes ------------------------------------------------------------------*/
+#include "mbed.h"
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+#define Do3  131 //C octave3
+#define Do3s 139 //C#
+#define Re3  147 //D
+#define Re3s 156 //D#
+#define Mi3  165 //E
+#define Fa3  175 //F
+#define Fa3s 185 //F#
+#define So3  196 //G
+#define So3s 208 //G#
+#define La3  220 //A
+#define La3s 233 //A#
+#define Ti3  247 //B
+#define Do4  262 //C octave4
+#define Do4s 277 //C#
+#define Re4  294 //D
+#define Re4s 311 //D#
+#define Mi4  330 //E
+#define Fa4  349 //F
+#define Fa4s 370 //F#
+#define So4  392 //G
+#define So4s 415 //G#
+#define La4  440 //A
+#define La4s 466 //A#
+#define Ti4  494 //B
+#define Do5  523 //C octave5
+#define Do5s 554 //C#
+#define Re5  587 //D
+#define Re5s 622 //D#
+#define Mi5  659 //E
+#define Fa5  699 //F
+#define Fa5s 740 //F#
+#define So5  784 //G
+#define So5s 831 //G#
+#define La5  880 //A
+#define La5s 932 //A#
+#define Ti5  988 //B
+
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+void Tune(PwmOut name, int period, int beat);
+void Auto_tunes(PwmOut name, int period, int beat);
+void Stop_tunes(PwmOut name);
+//void buzzer(PwmOut name, int ppm, float B_4, float B_5);
+        
+/* Private functions ---------------------------------------------------------*/