A C12832 LCD with generic interface

Dependents:   mbed_blinky HTTPClient_HelloWorld websocketandnode xbeerx ... more

Fork of C12832 by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
screamer
Date:
Mon Mar 17 19:47:39 2014 +0000
Parent:
16:7de323fa46fe
Child:
18:03069e3deaa4
Commit message:
Improved library documentation

Changed in this revision

C12832.h Show annotated file Show diff for this revision Revisions of this file
TextDisplay.h Show annotated file Show diff for this revision Revisions of this file
--- a/C12832.h	Wed Feb 05 14:25:16 2014 +0000
+++ b/C12832.h	Mon Mar 17 19:47:39 2014 +0000
@@ -19,9 +19,10 @@
 #include "GraphicsDisplay.h"
 
 
-/** optional Defines :
-  * #define debug_lcd  1  enable infos to PC_USB
-  */
+/**
+ * Optional Defines:
+ * #define debug_lcd  1  enable infos to PC_USB
+ */
 
 // some defines for the DMA use
 #define DMA_CHANNEL_ENABLE      1
@@ -35,184 +36,191 @@
 #define DMA_DEST_SSP1_TX        (2UL << 6)
 #define DMA_DEST_SSP0_TX        (0UL << 6)
 
-/** Draw mode
-  * NORMAl
-  * XOR set pixel by xor the screen
-  */
+/**
+ * Draw mode
+ * NORMAL
+ * XOR set pixel by xor the screen
+ */
 enum {NORMAL,XOR};
 
-/** Bitmap
+/**
+ * Bitmap
  */
 struct Bitmap{
     int xSize;
     int ySize;
     int Byte_in_Line;
     char* data;
-    };
+};
 
+/**
+ * The C12832 class
+ */
 class C12832 : public GraphicsDisplay
 {
 public:
-    /** Create a C12832 object connected to SPI1
-      *
-      */
-
+    /**
+     * Create a C12832 object connected to SPI1
+     */
     C12832(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name = "LCD");
 
-
-    /** Get the width of the screen in pixel
-      *
-      * @param
-      * @returns width of screen in pixel
-      *
-      */
+    /**
+     * Get the width of the screen in pixel
+     *
+     * @returns width of screen in pixel
+     *
+     */
     virtual int width();
 
-    /** Get the height of the screen in pixel
+    /**
+     * Get the height of the screen in pixel
      *
      * @returns height of screen in pixel
-     *
      */
     virtual int height();
 
-    /** Draw a pixel at x,y black or white
+    /**
+     * Draw a pixel at x,y black or white
      *
      * @param x horizontal position
      * @param y vertical position
-     * @param colour ,1 set pixel ,0 erase pixel
+     * @param color - 1 set pixel, 0 erase pixel
      */
     virtual void pixel(int x, int y,int colour);
 
-    /** draw a circle
+     /**
+      * Draw a circle
       *
       * @param x0,y0 center
       * @param r radius
-      * @param colour ,1 set pixel ,0 erase pixel
-      *
+      * @param color - 1 set pixel, 0 erase pixel
       */
     void circle(int x, int y, int r, int colour);
 
-    /** draw a filled circle
+    /**
+     * Draw a filled circle
      *
      * @param x0,y0 center
      * @param r radius
-     * @param color ,1 set pixel ,0 erase pixel
+     * @param color - 1 set pixel, 0 erase pixel
      *
-     * use circle with different radius,
-     * can miss some pixel
+     * Use circle with different radius,
+     * Can miss some pixels
      */
     void fillcircle(int x, int y, int r, int colour);
 
-    /** draw a 1 pixel line
-      *
-      * @param x0,y0 start point
-      * @param x1,y1 stop point
-      * @param color ,1 set pixel ,0 erase pixel
-      *
-      */
+    /**
+     * Draw a 1 pixel line
+     *
+     * @param x0,y0 start point
+     * @param x1,y1 stop point
+     * @param color - 1 set pixel, 0 erase pixel
+     */
     void line(int x0, int y0, int x1, int y1, int colour);
 
-    /** draw a rect
-    *
-    * @param x0,y0 top left corner
-    * @param x1,y1 down right corner
-    * @param color 1 set pixel ,0 erase pixel
-    *                                                   *
-    */
+    /**
+     * Draw a rect
+     *
+     * @param x0,y0 top left corner
+     * @param x1,y1 down right corner
+     * @param color - 1 set pixel, 0 erase pixel
+     */
     void rect(int x0, int y0, int x1, int y1, int colour);
 
-    /** draw a filled rect
-      *
-      * @param x0,y0 top left corner
-      * @param x1,y1 down right corner
-      * @param color 1 set pixel ,0 erase pixel
-      *
-      */
+    /**
+     * Draw a filled rect
+     *
+     * @param x0,y0 top left corner
+     * @param x1,y1 down right corner
+     * @param color - 1 set pixel, 0 erase pixel
+     */
     void fillrect(int x0, int y0, int x1, int y1, int colour);
 
-    /** copy display buffer to lcd
-      *
-      */
-
+    /**
+     * Copy display buffer to LCD
+     */
     void copy_to_lcd(void);
 
-    /** set the orienation of the screen
-      *
-      */
-
+    /**
+     * Set the orienation of the screen
+     */
 
     void set_contrast(unsigned int o);
 
-    /** read the contrast level
-      *
-      */
+    /**
+     * Read the contrast level
+     */
     unsigned int get_contrast(void);
 
-
-    /** invert the screen
-      *
-      * @param o = 0 normal, 1 invert
-      */
+    /**
+     * Invert the screen
+     *
+     * @param o = 0 normal, 1 invert
+     */
     void invert(unsigned int o);
 
-    /** clear the screen
-       *
-       */
+    /**
+     * Clear the screen
+     */
     virtual void cls(void);
 
-    /** set the drawing mode
-      *
-      * @param mode NORMAl or XOR
-      */
-
+    /**
+     * Set the drawing mode
+     *
+     * @param mode NORMAl or XOR
+     */
     void setmode(int mode);
 
     virtual int columns(void);
 
-    /** calculate the max number of columns
+    /**
+     * Calculate the max number of columns.
+     * Depends on actual font size
      *
      * @returns max column
-     * depends on actual font size
-     *
      */
     virtual int rows(void);
 
-    /** put a char on the screen
+    /**
+     * Put a char on the screen
      *
      * @param value char to print
      * @returns printed char
-     *
      */
     virtual int _putc(int value);
 
-    /** draw a character on given position out of the active font to the LCD
+    /**
+     * Draw a character on given position out of the active font to the LCD
      *
      * @param x x-position of char (top left)
      * @param y y-position
      * @param c char to print
-     *
      */
     virtual void character(int x, int y, int c);
 
-    /** setup cursor position
+    /**
+     * Setup cursor position
      *
      * @param x x-position (top left)
      * @param y y-position
      */
     virtual void locate(int x, int y);
     
-    /** setup auto update of screen 
-      *
-      * @param up 1 = on , 0 = off
-      * if switched off the program has to call copy_to_lcd() 
-      * to update screen from framebuffer
-      */
+    /**
+     * Setup auto update of screen 
+     *
+     * @param up 1 = on , 0 = off
+     *
+     * if switched off the program has to call copy_to_lcd() 
+     * to update screen from framebuffer
+     */
     void set_auto_up(unsigned int up);
 
-    /** get status of the auto update function
-      *
-      *  @returns if auto update is on
-      */
+    /**
+     * Get status of the auto update function
+     *
+     * @returns if auto update is on
+     */
     unsigned int get_auto_up(void);
 
     /** Vars     */
@@ -224,69 +232,69 @@
     unsigned int draw_mode;
 
 
-    /** select the font to use
-      *
-      * @param f pointer to font array
-      *
-      *   font array can created with GLCD Font Creator from http://www.mikroe.com
-      *   you have to add 4 parameter at the beginning of the font array to use:
-      *   - the number of byte / char
-      *   - the vertial size in pixel
-      *   - the horizontal size in pixel
-      *   - the number of byte per vertical line
-      *   you also have to change the array to char[]
-      *
-      */
+    /**
+     * Select the font to use
+     *
+     * @param f pointer to font array
+     *
+     *   font array can created with GLCD Font Creator from http://www.mikroe.com
+     *   you have to add 4 parameter at the beginning of the font array to use:
+     *   - the number of byte / char
+     *   - the vertial size in pixel
+     *   - the horizontal size in pixel
+     *   - the number of byte per vertical line
+     *   you also have to change the array to char[]
+     */
     void set_font(unsigned char* f);
     
-    /** print bitmap to buffer
-      *
-      * @param bm Bitmap in flash
-      * @param x  x start
-      * @param y  y start 
-      *
-      */
-
+    /**
+     * Print bitmap to buffer
+     *
+     * @param bm Bitmap in flash
+     * @param x  x start
+     * @param y  y start
+     */
     void print_bm(Bitmap bm, int x, int y);
 
 protected:
 
-    /** draw a horizontal line
-      *
-      * @param x0 horizontal start
-      * @param x1 horizontal stop
-      * @param y vertical position
-      * @param ,1 set pixel ,0 erase pixel
-      *
-      */
+    /**
+     * Draw a horizontal line
+     *
+     * @param x0 horizontal start
+     * @param x1 horizontal stop
+     * @param y vertical position
+     * @param color - 1 set pixel, 0 erase pixel
+     */
     void hline(int x0, int x1, int y, int colour);
 
-    /** draw a vertical line
+    /**
+     * Draw a vertical line
      *
      * @param x horizontal position
      * @param y0 vertical start
      * @param y1 vertical stop
-     * @param ,1 set pixel ,0 erase pixel
+     * @param color - 1 set pixel, 0 erase pixel
      */
     void vline(int y0, int y1, int x, int colour);
 
-    /** Init the C12832 LCD controller
-     *
+    /**
+     * Init the C12832 LCD controller
      */
     void lcd_reset();
 
-    /** Write data to the LCD controller
+    /**
+     * Write data to the LCD controller
      *
      * @param dat data written to LCD controller
-     *
      */
     void wr_dat(unsigned char value);
 
-    /** Write a command the LCD controller
-      *
-      * @param cmd: command to be written
-      *
-      */
+    /**
+     * Write a command the LCD controller
+     *
+     * @param cmd: command to be written
+     */
     void wr_cmd(unsigned char value);
 
     void wr_cnt(unsigned char cmd);
--- a/TextDisplay.h	Wed Feb 05 14:25:16 2014 +0000
+++ b/TextDisplay.h	Mon Mar 17 19:47:39 2014 +0000
@@ -18,17 +18,21 @@
 
 #include "mbed.h"
 
+/**
+ * TextDisplay interface
+ */
 class TextDisplay : public Stream {
 public:
 
-  // functions needing implementation in derived implementation class
-  /** Create a TextDisplay interface
+    /**
+     * Create a TextDisplay interface
      *
      * @param name The name used in the path to access the strean through the filesystem
      */
     TextDisplay(const char *name = NULL);
 
-    /** output a character at the given position
+    /**
+     * Output a character at the given position
      *
      * @param column column where charater must be written
      * @param  row where character must be written
@@ -36,27 +40,39 @@
      */
     virtual void character(int column, int row, int c) = 0;
 
-    /** return number if rows on TextDisplay
-     * @result number of rows
+    /**
+     * Return number of rows on TextDisplay
+     *
+     * @results number of rows
      */
     virtual int rows() = 0;
 
-    /** return number if columns on TextDisplay
-    * @result number of rows
-    */
+    /**
+     * Return number if columns on TextDisplay\
+     *
+     * @results number of rows
+     */
     virtual int columns() = 0;
     
     // functions that come for free, but can be overwritten
 
-    /** redirect output from a stream (stoud, sterr) to  display
-    * @param stream stream that shall be redirected to the TextDisplay
-    */
+    /**
+     * Redirect output from a stream (stoud, sterr) to  display
+     *
+     * @param stream stream that shall be redirected to the TextDisplay
+     */
     virtual bool claim (FILE *stream);
 
-    /** clear screen
-    */
+    /**
+     * Clear screen
+     */
     virtual void cls();
+    
+    /**
+     * Change the cursor position to column, row (in pixels)
+     */
     virtual void locate(int column, int row);
+    
     virtual void foreground(uint16_t colour);
     virtual void background(uint16_t colour);
     // putc (from Stream)