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.
Diff: ssd1306.h
- Revision:
- 1:1d58d378221c
- Parent:
- 0:21cb91208386
- Child:
- 2:e479b0296757
diff -r 21cb91208386 -r 1d58d378221c ssd1306.h
--- a/ssd1306.h Tue Feb 05 09:46:58 2013 +0000
+++ b/ssd1306.h Tue Feb 05 17:18:23 2013 +0000
@@ -6,9 +6,20 @@
#define FONT_DATA_OFFSET 2 /* Data starts at this position */
#define FONT_START ' ' /* First character value in the font table */
+/** SSD1306 Controller Driver
+ *
+ * Information taken from the datasheet at:
+ * http://www.adafruit.com/datasheets/SSD1306.pdf
+ */
class SSD1306
{
public:
+ /** Construct a new SSD1306 object.
+ * @param cs The connected C/S pin.
+ * @param rs The connected RS pin.
+ * @param dc The connected DC pin.
+ * @param clk The connected CLK pin.
+ * @param data The connected Data pin.
SSD1306(PinName cs, PinName rs, PinName dc, PinName clk, PinName data);
void initialise();
@@ -17,13 +28,15 @@
void off();
void on();
- void invert(int i);
-
+ // Sends the display to sleep, but leaves RAM intact
+ void sleep();
+
+ //
+ void wake();
+
void set_low_column(int value);
void set_high_column(int value);
- void set_start_line(int value);
-
- void set_display_offset(int value);
+ void set_start_line(int value);
void clear();
void set_pixel(int x, int y);
@@ -32,6 +45,15 @@
void draw_string(char *font, int x, int y, const char *string);
void draw_char(char *font, int x, int y, char c);
+
+ void set_contrast(unsigned char value); // 1-256
+ void set_inverse(unsigned char value); // 0 or 1
+ void set_display_start_line(unsigned char value); // 0-63
+ void set_horizontal_flip(unsigned char value); // 0 or 1
+ void set_display_offset(unsigned char value); // 0-63
+ void set_multiplex_ratio(unsigned char value); // 15-63 (value+1 mux)
+ void set_com_output_scan_direction(unsigned char value); // 0 or 1
+ void set_com_pins_hardware_configuration(unsigned char sequential, unsigned char lr_remap); // 0 or 1 for both parametrs
private:
SPI _spi;
@@ -40,8 +62,8 @@
int _cursor_x, _cursor_y;
- void _send_command(int code);
- void _send_data(int value);
+ void _send_command(unsigned char code);
+ void _send_data(unsigned char value);
};
#define SSD1306_LCDWIDTH 128