Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of PsiSwarm-BeaconDemo_Bluetooth by
display.h
00001 /* University of York Robotics Laboratory PsiSwarm Library: Display Driver Header File 00002 * 00003 * File: display.h 00004 * 00005 * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York 00006 * 00007 * PsiSwarm Library Version: 0.3 00008 * Display Driver Version: 0.2 00009 * 00010 * October 2015 00011 * 00012 * Driver for the Midas 16x2 I2C LCD Display (MCCOG21605x6W) LCD 00013 * 00014 * Farnell part 2218942 or 2063206 00015 * 00016 */ 00017 00018 00019 #ifndef DISPLAY_H 00020 #define DISPLAY_H 00021 00022 #define PAGE_TIME 0.4 00023 #define CLEAR_TIME 0.8 00024 00025 class Display : public Stream { 00026 00027 // Public Functions 00028 00029 public: 00030 00031 /** Create the LCD Display object connected to the default pins 00032 * 00033 * @param sda pin - default is p28 00034 * @param scl pin - default is p27 00035 * @param reset pin - default is p29 00036 * @param backlight pin - default is p30 00037 */ 00038 00039 Display(); 00040 00041 /** Create the LCD Display object connected to specific pins 00042 * 00043 */ 00044 Display(PinName sda, PinName scl, PinName reset, PinName backlight); 00045 00046 //Print string message 00047 void write_string(char * message); 00048 00049 //Print string message of given length 00050 void write_string(char * message, char length); 00051 00052 //Set the row and column of cursor position 00053 void set_position(char row, char column); 00054 00055 // Enable or disable cursor 00056 void set_cursor(char enable); 00057 00058 // Enable or disable cursor blink 00059 void set_blink(char enable); 00060 00061 // Enable or disable display 00062 void set_display(char enable); 00063 00064 // Set the brightness of the backlight 00065 void set_backlight_brightness(float brightness); 00066 00067 // Special function for when debug messages are sent to display 00068 void debug_page(char * message, char length); 00069 00070 void IF_restore_page(void); 00071 00072 void IF_debug_multipage(void); 00073 00074 void IF_backlight_toggle(void); 00075 00076 //Parts of initialisation routine 00077 void post_init(void); 00078 void post_post_init(void); 00079 00080 00081 // Clear display 00082 void clear_display(); 00083 00084 //Set cursor to home position 00085 void home(); 00086 00087 // Send a 1-byte control message to the display 00088 int i2c_message(char byte); 00089 00090 // Default initialisation sequence for the display 00091 void init_display(char mode); 00092 00093 int disp_putc(int c); 00094 00095 00096 private : 00097 00098 I2C _i2c; 00099 DigitalOut _reset; 00100 DigitalOut _backlight; 00101 00102 char display_on; 00103 char cursor_on; 00104 char blink_on; 00105 00106 void _set_display(); 00107 00108 virtual int _putc(int c); 00109 virtual int _getc(); 00110 00111 }; 00112 00113 #endif // DISPLAY_H
Generated on Thu Jul 14 2022 08:02:39 by
1.7.2
