510efa97390d7d00bcc1c1c46e978970edbba9ce
[hackover2013-badge-firmware.git] / drivers / lcd / bitmap / ssd1306 / ssd1306.h
1 /**************************************************************************/
2 /*!
3 @file ssd1306.h
4 @author K. Townsend (microBuilder.eu)
5 @date 22 March 2010
6 @version 0.10
7
8 @section LICENSE
9
10 Software License Agreement (BSD License)
11
12 Copyright (c) 2010, microBuilder SARL
13 All rights reserved.
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22 3. Neither the name of the copyright holders nor the
23 names of its contributors may be used to endorse or promote products
24 derived from this software without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
27 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
30 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37 /**************************************************************************/
38 #ifndef __SSD1306_H__
39 #define __SSD1306_H__
40
41 #include "projectconfig.h"
42
43 #include "drivers/lcd/smallfonts.h"
44
45 // Pin Definitions
46 #define SSD1306_DC_PORT (2) // Data/Command
47 #define SSD1306_DC_PIN (1)
48 #define SSD1306_RST_PORT (2) // Reset
49 #define SSD1306_RST_PIN (2)
50 #define SSD1306_CS_PORT (2) // Select
51 #define SSD1306_CS_PIN (3)
52 #define SSD1306_SCLK_PORT (2) // Serial Clock
53 #define SSD1306_SCLK_PIN (5)
54 #define SSD1306_SDAT_PORT (2) // Serial Data
55 #define SSD1306_SDAT_PIN (6)
56
57 #define SSD1306_LCDWIDTH 128
58 #define SSD1306_LCDHEIGHT 64
59
60 // Commands
61 #define SSD1306_SETCONTRAST 0x81
62 #define SSD1306_DISPLAYALLON_RESUME 0xA4
63 #define SSD1306_DISPLAYALLON 0xA5
64 #define SSD1306_NORMALDISPLAY 0xA6
65 #define SSD1306_INVERTDISPLAY 0xA7
66 #define SSD1306_DISPLAYOFF 0xAE
67 #define SSD1306_DISPLAYON 0xAF
68 #define SSD1306_SETDISPLAYOFFSET 0xD3
69 #define SSD1306_SETCOMPINS 0xDA
70 #define SSD1306_SETVCOMDETECT 0xDB
71 #define SSD1306_SETDISPLAYCLOCKDIV 0xD5
72 #define SSD1306_SETPRECHARGE 0xD9
73 #define SSD1306_SETMULTIPLEX 0xA8
74 #define SSD1306_SETLOWCOLUMN 0x00
75 #define SSD1306_SETHIGHCOLUMN 0x10
76 #define SSD1306_SETSTARTLINE 0x40
77 #define SSD1306_MEMORYMODE 0x20
78 #define SSD1306_COMSCANINC 0xC0
79 #define SSD1306_COMSCANDEC 0xC8
80 #define SSD1306_SEGREMAP 0xA0
81 #define SSD1306_CHARGEPUMP 0x8D
82 #define SSD1306_EXTERNALVCC 0x1
83 #define SSD1306_SWITCHCAPVCC 0x2
84
85 // Initialisation/Config Prototypes
86 void ssd1306Init ( uint8_t vccstate );
87 void ssd1306DrawPixel ( uint8_t x, uint8_t y );
88 void ssd1306ClearPixel ( uint8_t x, uint8_t y );
89 uint8_t ssd1306GetPixel ( uint8_t x, uint8_t y );
90 void ssd1306ClearScreen ( void );
91 void ssd1306Refresh ( void );
92 void ssd1306DrawString( uint16_t x, uint16_t y, char* text, struct FONT_DEF font );
93 void ssd1306ShiftFrameBuffer( uint8_t height );
94
95 #endif
This page took 0.037673 seconds and 3 git commands to generate.