SSD1306 Driver for TivaC
SSD1306 i2c driver for use with Texas Instrument TivaC
ssd1306_info.h
Go to the documentation of this file.
1 
11 #ifndef _SSD1306_INFO_H
12 #define _SSD1306_INFO_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <assert.h>
19 #include <stdbool.h>
20 #include <stdint.h>
21 #include <stdio.h>
22 #include <string.h>
23 
24 #include "inc/hw_i2c.h"
25 
26 #include "inc/hw_ints.h"
27 
28 #include "inc/hw_memmap.h"
29 
30 #include "inc/hw_types.h"
31 
32 #include "driverlib/gpio.h"
33 
34 #include "driverlib/i2c.h"
35 
36 #include "driverlib/interrupt.h"
37 
38 #include "driverlib/pin_map.h"
39 
40 #include "driverlib/sysctl.h"
41 
42 #include "driverlib/uart.h"
43 
44 #include "bit_manipulation.h"
45 
46 // I2C hardware info
47 #define SSD1306_I2C_PERIPH SYSCTL_PERIPH_I2C0
48 #define SSD1306_I2C_BASE I2C0_BASE
49 
50 // I2C Register List and Physical info
51 
52 #define SSD1306_ADDR 0x3C
53 
54 #define SSD1306_CONTRAST_CMD 0x81
55 #define SSD1306_DISPLAY_ON_OFF 0xAE
56 #define SSD1306_ENTIRE_DISPLAY_CMD 0xA4
57 
58 #define SSD1306_SETCONTRAST 0x81
59 #define SSD1306_DISPLAYALLON_RESUME 0xA4
60 #define SSD1306_DISPLAYALLON 0xA5
61 #define SSD1306_NORMALDISPLAY 0xA6
62 #define SSD1306_INVERTDISPLAY 0xA7
63 #define SSD1306_DISPLAYOFF 0xAE
64 #define SSD1306_DISPLAYON 0xAF
65 
66 #define SSD1306_SETDISPLAYOFFSET 0xD3
67 #define SSD1306_SETCOMPINS 0xDA
68 
69 #define SSD1306_SETVCOMDETECT 0xDB
70 
71 #define SSD1306_SETDISPLAYCLOCKDIV 0xD5
72 #define SSD1306_SETPRECHARGE 0xD9
73 
74 #define SSD1306_SETMULTIPLEX 0xA8
75 
76 #define SSD1306_SETLOWCOLUMN 0x00
77 #define SSD1306_SETHIGHCOLUMN 0x10
78 
79 #define SSD1306_SETSTARTLINE 0x40
80 
81 #define SSD1306_MEMORYMODE 0x20
82 #define SSD1306_MEMORY_VERTICAL_MODE 0b01
83 #define SSD1306_MEMORY_HORIZONTAL_MODE 0b00
84 
85 #define SSD1306_COLUMNADDR 0x21
86 #define SSD1306_PAGEADDR 0x22
87 
88 #define SSD1306_COMSCANINC 0xC0
89 #define SSD1306_COMSCANDEC 0xC8
90 
91 #define SSD1306_SEGREMAP 0xA0
92 
93 #define SSD1306_CHARGEPUMP 0x8D
94 
95 #define SSD1306_EXTERNALVCC 0x1
96 #define SSD1306_SWITCHCAPVCC 0x2
97 
98 #define SSD1306_ACTIVATE_SCROLL 0x2F
99 #define SSD1306_DEACTIVATE_SCROLL 0x2E
100 #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
101 #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
102 #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
103 #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
104 #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
105 
106 #define SSD1306_LCDWIDTH 128
107 #define SSD1306_LCDHEIGHT 32
108 #define SSD1306_LCDPAGE (SSD1306_LCDHEIGHT / 8)
109 #define SSD1306_TOTAL_WRITE 512
110 
111 #define SSD1306_CONTINUATION_BIT 0x80
112 
113 #define SSD1306_BIT_PER_CHAR 8
114 #define SSD1306_MAX_CHAR_PER_LINE (SSD1306_LCDWIDTH / SSD1306_BIT_PER_CHAR)
115 #define SSD1306_MAX_LINE 1 // max linenum is 1, starting from 0
116 
117 // SSD1306 settings
118 
119 #define SSD1306_CHAR_SPACING 1 // how many columns are each consecutive character separated
120 #define SSD1306_WARM_UP_TIME_MS 2
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 #endif