]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A2F200_SoftConsole/MicroSemi_Code/drivers/OLED/oled.h
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / CORTEX_A2F200_SoftConsole / MicroSemi_Code / drivers / OLED / oled.h
1 /*****************************************************************************\r
2  * (c) Copyright 2009 Actel Corporation.  All rights reserved.\r
3  *\r
4  * Author : Actel Application Team\r
5  * Rev    : 1.0.0.0\r
6  * Description: Device driver for the on-board OLED for SmartFusion KITS\r
7  *  API of sample basic driver for OLED display found on Actel SmartFusion\r
8  *  development boards.\r
9  *  This code is intended as an example of using the SmartFusion I2C driver.\r
10  *\r
11  */\r
12 #ifndef OLED_H_\r
13 #define OLED_H_\r
14 \r
15 #include "i2c.h"\r
16 \r
17 #define OLED_HORIZ_SCROLL_ON    0x01\r
18 #define OLED_HORIZ_SCROLL_OFF   0x00\r
19 #define OLED_HORIZ_SCROLL_STEP  0x08\r
20 #define OLED_CONTRAST_VAL       0xFF\r
21 #define OLED_START_PAGE         0x01\r
22 #define OLED_HORIZ_SCROLL_TINVL 0x00\r
23 #define OLED_END_PAGE           0x05\r
24 /*-------------------------------------------------------------------------*/\r
25 /*  The oled_no_of_line type represents number of lines to be written on OLED.\r
26     FIRST LINE  : The OLED cursor is set to line number 1 and only 1 line is\r
27                   printed on OLED\r
28     SECOND_LINE : The OLED cursor is set to line number 2 and only 1 line is\r
29                   printed on OLED\r
30     BOTH_LINES  : The OLED cursor is set to line number 1 and line 1 and line 2\r
31                   are printed on OLED\r
32 */\r
33 typedef enum {\r
34     FIRST_LINE = 0,\r
35     SECOND_LINE,\r
36     BOTH_LINES\r
37 } oled_no_of_line;\r
38 \r
39 /*-------------------------------------------------------------------------*//**\r
40   oled_data\r
41   ------------------------------------------------------------------------------\r
42   There is one instance of this structure for OLED data. Instances of this\r
43   structure is used to provide the data to OLED. A pointer to an instance of\r
44   the oled_data structure is passed as the parameter OLED driver functions.\r
45  */\r
46 struct oled_data\r
47 {\r
48     /* Represents line number, where String 1 has to be printed */\r
49     uint8_t line1;\r
50     /* Represents character offset within the line1, from where String 1 has to be\r
51      * printed */\r
52     uint8_t char_offset1;\r
53     /* Represents line number, where String 2 has to be printed */\r
54     uint8_t line2;\r
55     /* Represents character offset within the line2, from where String 2 has to be\r
56      * printed */\r
57     uint8_t char_offset2;\r
58     /* String 1 holds the data to be displayed on line 1 of OLED, It has to be\r
59      * less that 49 characters*/\r
60     char    *string1;\r
61     /* String 1 holds the data to be displayed on line 2 of OLED, It has to be\r
62      * less that 49 characters*/\r
63     char    *string2;\r
64     /* Holds the contrast value to be set for String 1 and String 2 */\r
65     uint8_t contrast_val;\r
66     /* Represents ON or OFF for horizontal scrolling  */\r
67     uint8_t on_off;\r
68     /* Represents  number of coumns scrolls per step for horizontal scroll*/\r
69     unsigned char column_scrool_per_step;\r
70     /* Represents  start page for horizontal scroll*/\r
71     unsigned char start_page;\r
72     /* Represents  time interval for horizontal scroll*/\r
73     unsigned char time_intrval_btw_scroll_step;\r
74     /* Represents  end page for horizontal scroll*/\r
75     unsigned char end_page;\r
76 \r
77 };\r
78 /***************************************************************************//**\r
79   The following defines can be used as parameter to the OLED_set_cursor()\r
80   function.\r
81  */\r
82 \r
83 /***************************************************************************//**\r
84   The OLED_init function initializes the OLED display.\r
85  */\r
86 void vOLEDInit( void );\r
87 void OLED_init( void );\r
88 \r
89 /***************************************************************************//**\r
90   This function(OLED_clear_display) clears the content of the display RAM\r
91   based on the LINES input.\r
92   ------------------------------------------------------------------------------\r
93   @param oled_no_of_line:\r
94       The oled_no_of_line parameter enum that holds Number of lines.\r
95       If FIRST_LINE is passed as parameter to this function thnen, this functions\r
96       clears only First line that is 0\r
97       If SECOND_LINE is passed as parameter to this function thnen, this functions\r
98       clears only Second line that is 1\r
99       If BOTH_LINE is passed as parameter to this function thnen, this functions\r
100       clears entire OLED display.\r
101  */\r
102 void OLED_clear_display( oled_no_of_line LINES );\r
103 \r
104 /*-------------------------------------------------------------------------*//**\r
105   OLED Write data.\r
106   ------------------------------------------------------------------------------\r
107   This function (OLED_write_data ) writes the data to OLED basedon the\r
108   parameters passed to this function.\r
109   ------------------------------------------------------------------------------\r
110   @param data:\r
111       The data parameter is a pointer to an oled_data structure, that holds\r
112       different fields of data to be required for OLED (see the oled_data structure\r
113       definition).\r
114 \r
115   @param oled_no_of_line:\r
116       The oled_no_of_line parameter enum that holds Number of lines.\r
117       If FIRST_LINE is passed as parameter to this function thnen, this functions\r
118       wtites string 1 at FIRST LINE\r
119       If SECOND_LINE is passed as parameter to this function thnen, this functions\r
120       wtites string 1 at SECOND LINE\r
121       If BOTH_LINE is passed as parameter to this function thnen, this functions\r
122       wtites string 1 and string 2 at FIRST LINE and SECOND LINE respectively.\r
123 Example:\r
124   @code\r
125 #include "drivers/mss_watchdog/mss_watchdog.h"\r
126 #include "oled.h"\r
127 #define FIRST_CHARACTER 0\r
128 \r
129 int main()\r
130 {\r
131 \r
132     char *string1="SmartFusion";\r
133     char *string2="INNOVATIVE ";\r
134     struct oled_data write_data;\r
135 \r
136     write_data.line1 = FIRST_LINE;\r
137     write_data.char_offset1 = FIRST_CHARACTER;\r
138     write_data.string1 = string1;\r
139     write_data.line2 = SECOND_LINE;\r
140     write_data.char_offset2 = FIRST_CHARACTER;\r
141     write_data.string2 = string2;\r
142     write_data.contrast_val = 0x01;\r
143 \r
144     MSS_WD_disable();\r
145     OLED_init();\r
146     OLED_write_data(&write_data,BOTH_LINES);\r
147     return 0;\r
148 }\r
149   @endcode\r
150  */\r
151 \r
152 void OLED_write_data(struct oled_data * data, oled_no_of_line flag);\r
153 \r
154 /*-------------------------------------------------------------------------*//**\r
155   OLED Horizontal scrolling.\r
156   ------------------------------------------------------------------------------\r
157   This function (OLED_horizontal_scroll ) enbles the Horizontal scrolling.\r
158   ------------------------------------------------------------------------------\r
159   @param data:\r
160       The horiz_scroll parameter is a pointer to an oled_data structure, that holds\r
161       different fields of data to be required for OLED (see the oled_data structure\r
162       definition).\r
163 Example:\r
164   @code\r
165 \r
166 int main()\r
167 {\r
168 \r
169     char *string1="SmartFusion";\r
170     char *string2="INNOVATIVE     ";\r
171     struct oled_data write_data;\r
172 \r
173     write_data.line1 = FIRST_LINE;\r
174     write_data.char_offset1 = FIRST_CHARACTER;\r
175     write_data.string1 = string1;\r
176     write_data.line2 = SECOND_LINE;\r
177     write_data.char_offset2 = FIRST_CHARACTER;\r
178     write_data.string2 = string2;\r
179     write_data.contrast_val = 0x01;\r
180     write_data.on_off = 0x01;\r
181     write_data.column_scrool_per_step = 0x08;\r
182     write_data.start_page = 0x01;\r
183     write_data.time_intrval_btw_scroll_step = 0x00;\r
184     write_data.end_page = 0x05;\r
185 \r
186     MSS_WD_disable();\r
187     OLED_init();\r
188     OLED_write_data(&write_data,BOTH_LINES);\r
189     OLED_horizontal_scroll(&write_data);\r
190     return 0;\r
191 }\r
192   @endcode\r
193  */\r
194 \r
195 void OLED_horizontal_scroll(struct oled_data * horiz_scroll);\r
196 \r
197 /***************************************************************************//**\r
198   This function(OLED_contrast) sets ths conrtast to the data displayed on the\r
199   OLED.\r
200   ------------------------------------------------------------------------------\r
201   @param color_contrast:\r
202   The color_contrast parameter that holds contrast value.\r
203   The color_contrast values should be in the range of 1 to 256.\r
204  */\r
205 void OLED_contrast(uint8_t color_contrast);\r
206 \r
207 #endif\r
208 \r
209 \r
210 \r