Hexiwear OLED Display Driver
Dependents: Hexi_OLED_TextImage_Example Hexi_OLED_Text_Example Hexi_OLED_Image_Example security-console-app ... more
Diff: Hexi_OLED_SSD1351.h
- Revision:
- 3:4121d3cd9f60
- Parent:
- 2:fc06b5b5bf6a
- Child:
- 5:a5b4b36a1aed
--- a/Hexi_OLED_SSD1351.h Fri Aug 19 23:05:58 2016 +0000
+++ b/Hexi_OLED_SSD1351.h Fri Aug 26 15:21:54 2016 +0000
@@ -1,8 +1,5 @@
-/**
- * \file Hexi_OLED_SSD1351.h
- * \version 1.00
- * \brief this file contains OLED driver functionality for
- * drawing images and text
+/** 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:
@@ -36,27 +33,39 @@
* Project HEXIWEAR, 2015
*/
-#ifndef HG_OLED_DRIVER
-#define HG_OLED_DRIVER
+#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
+ */
+ SSD1351(PinName mosiPin,PinName sclkPin,PinName pwrPin, PinName csPin,PinName rstPin, PinName dcPin);
- SSD1351(PinName mosi,PinName sclk,PinName pwr, PinName cs,PinName rst, PinName dc);
-
+ /**
+ * Destroy the Hexiwear instance
+ */
~SSD1351();
/**
* Send the command to OLED
- * @param self OLED handle
* @param cmd OLED command from the datasheet
* @param isFirst designate if this is the first byte in the command
*/
@@ -182,10 +191,10 @@
/**
* Add text to the main screen buffer at position x,y.
- * @param text text to add
+ * @param text text to add
* @param xCrd x-coordinate for the given text
* @param yCrd y-coordinate for the given text
- * @return status flag
+ * @return status flag
*/
oled_status_t AddText( const uint8_t* text,uint8_t xCrd, uint8_t yCrd );
/**
@@ -194,21 +203,10 @@
* @return status flag
*/
oled_status_t AddText( const uint8_t* text);
-
+
/**
- * Write text on OLED at position x,y.
- * @param text desired text
- * @param xCrd x-coordinate for the given text
- * @param yCrd y-coordinate for the given text
- */
-
- oled_status_t DrawText ( const uint8_t* text,uint8_t xCrd, uint8_t yCrd );
-
- /**
* Write text on OLED at position set in Dynamic Area Field. Used with SetDynamicArea() Function.
* @param text desired text
- * @param x x-coordinate for the given text, set through dynamicArea_t variable
- * @param y y-coordinate for the given text, set through dynamicArea_t variable
*
*/
oled_status_t DrawText ( const uint8_t* text);
@@ -221,8 +219,6 @@
*/
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
@@ -233,21 +229,23 @@
/**
* 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, uint8_t xCrd, uint8_t yCrd );
/**
- * Draw image, i.e. send image to OLED GRAM.Used with SetDynamicArea() Function.
+ * Send image to OLED GRAM.Used with SetDynamicArea() Function for positioning image.
* @param image desired image
- * @param transition desired transition style for the new image
* @return status flag
*/
oled_status_t DrawImage ( const uint8_t* image );
/**
- * Draw image, i.e. send image to OLED GRAM at position x,y.
+ * Send image to OLED GRAM at position x,y.
* @param image desired image
- * @param transition desired transition style for the new image
+ * @param xCrd image x-coordinate
+ * @param yCrd image y-coordinate
* @return status flag
*/
oled_status_t DrawImage ( const uint8_t* image, uint8_t xCrd, uint8_t yCrd );
@@ -304,6 +302,33 @@
);
+ /**
+ * 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,
+ uint8_t xCrd,
+ uint8_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,
+ uint8_t xCrd,
+ uint8_t yCrd,
+ uint8_t width,
+ uint8_t height);
+
private: