Subversion Repositories idreammicro-avr

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
34 jlesech 1
/**************************************************************************//**
2
 * \brief Snootlab Deuligne library
3
 * \author Copyright (C) 2012  Julien Le Sech - www.idreammicro.com
4
 * \version 1.0
5
 * \date 20121026
6
 *
7
 * This file is part of the iDreamMicro library.
8
 *
9
 * This library is free software: you can redistribute it and/or modify it under
10
 * the terms of the GNU Lesser General Public License as published by the Free
11
 * Software Foundation, either version 3 of the License, or (at your option) any
12
 * later version.
13
 *
14
 * This library is distributed in the hope that it will be useful, but WITHOUT
15
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17
 * details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with this program. If not, see http://www.gnu.org/licenses/
21
 ******************************************************************************/
22
 
23
/**************************************************************************//**
24
 * \headerfile deuligne.h
25
 ******************************************************************************/
26
 
27
#ifndef H__IDREAMMICRO__DEULIGNE__H
28
#define H__IDREAMMICRO__DEULIGNE__H
29
 
30
#ifdef _cplusplus
31
extern "C"{
32
#endif
33
 
34
/******************************************************************************
35
 * Header file inclusions.
36
 ******************************************************************************/
37
 
38
#include <stdbool.h>
39
#include <stdint.h>
40
 
41
/******************************************************************************
42
 * Public types.
43
 ******************************************************************************/
44
 
45
/**************************************************************************//**
46
 * \enum    deuligne__keys
47
 * \brief   Available keys.
48
 *
49
 * \typedef deuligne__key_t
50
 * \brief   Key.
51
 ******************************************************************************/
52
typedef enum deuligne__keys
53
{
54
    DEULIGNE__KEY__RIGHT,
55
    DEULIGNE__KEY__UP,
56
    DEULIGNE__KEY__DOWN,
57
    DEULIGNE__KEY__LEFT,
58
    DEULIGNE__KEY__SELECT,
59
    DEULIGNE__KEY__NONE
60
} deuligne__key_t;
61
 
62
/**************************************************************************//**
63
 * \enum    deuligne__display_lines
64
 * \brief   LCD display lines.
65
 *
66
 * \typedef deuligne__display_line_t
67
 * \brief   LCD display line.
68
 ******************************************************************************/
69
typedef enum deuligne__display_lines
70
{
71
    DEULIGNE__DISPLAY_LINE_1,    /*!<  One line display. */
72
    DEULIGNE__DISPLAY_LINE_2     /*!<  Two lines or more display. */
73
} deuligne__display_line_t;
74
 
75
/**************************************************************************//**
76
 * \enum lcd__character_fonts
77
 * \brief LCD character fonts.
78
 *
79
 * \typedef lcd__character_font_t
80
 * \brief LCD character font.
81
 ******************************************************************************/
82
typedef enum deuligne__character_fonts
83
{
84
    DEULIGNE__CHARACTER_FONT_5x8_DOTS,   /*!<  5x8 character font. */
85
    DEULIGNE__CHARACTER_FONT_5x10_DOTS   /*!<  5x10 character font. */
86
} deuligne__character_font_t;
87
 
88
/**************************************************************************//**
89
 * \enum lcd__address_modes
90
 * \brief LCD address modes.
91
 *
92
 * \typedef lcd__address_mode_t
93
 * \brief LCD address mode.
94
 ******************************************************************************/
95
typedef enum deuligne__address_modes
96
{
97
    DEULIGNE__INCREMENT_ADDRESS, /*!<  Increment address. */
98
    DEULIGNE__DECREMENT_ADDRESS  /*!<  Decrement address. */
99
} deuligne__address_mode_t;
100
 
101
/**************************************************************************//**
102
 * \enum lcd__display_shifts
103
 * \brief LCD display shift types.
104
 *
105
 * \typedef lcd__display_shift_t
106
 * \brief LCD display shift type.
107
 ******************************************************************************/
108
typedef enum deuligne__display_shifts
109
{
110
    DEULIGNE__DISPLAY_SHIFT_DISABLED,    /*!<  Display shift disabled. */
111
    DEULIGNE__DISPLAY_SHIFT_RIGHT,       /*!<  Display shift to right. */
112
    DEULIGNE__DISPLAY_SHIFT_LEFT         /*!<  Display shift to left */
113
} deuligne__display_shift_t;
114
 
115
/**************************************************************************//**
116
 * \enum lcd__shift_directions
117
 * \brief LCD shift directions.
118
 *
119
 * \typedef lcd__shift_direction_t
120
 * \brief LCD shift direction.
121
 ******************************************************************************/
122
typedef enum deuligne__shift_directions
123
{
124
    DEULIGNE__SHIFT_DIRECTION_RIGHT, /*!<  Shift to right. */
125
    DEULIGNE__SHIFT_DIRECTION_LEFT   /*!<  Shift to left. */
126
} deuligne__shift_direction_t;
127
 
128
/**************************************************************************//**
129
 * \enum lcd__lines
130
 * \brief LCD lines.
131
 *
132
 * \typedef lcd__line_t
133
 * \brief LCD line.
134
 ******************************************************************************/
135
typedef enum deuligne__lines
136
{
137
    DEULIGNE__LINE_1,    /*!<  Line 1. */
138
    DEULIGNE__LINE_2,    /*!<  Line 2. */
139
    DEULIGNE__LINE_3,    /*!<  Line 3. */
140
    DEULIGNE__LINE_4     /*!<  Line 4. */
141
} deuligne__line_t;
142
 
143
/******************************************************************************
144
 * Public function prototypes.
145
 ******************************************************************************/
146
 
147
/**************************************************************************//**
148
 * \fn void deuligne__initialize(void)
149
 *
150
 * \brief Initialize Deuligne.
151
 ******************************************************************************/
152
void
153
deuligne__initialize
154
(
155
    void
156
);
157
 
158
/**************************************************************************//**
159
 * \fn void deuligne__set_function(
160
 * deuligne__display_line_t     display_line,
161
 * deuligne__character_font_t   character_font)
162
 *
163
 * \brief Set the number of lines available on LCD display and the character font.
164
 *
165
 * \param display_line number of lines
166
 * \param character_font character font
167
 ******************************************************************************/
168
void
169
deuligne__set_function
170
(
171
    deuligne__display_line_t    display_line,
172
    deuligne__character_font_t  character_font
173
);
174
 
175
/**************************************************************************//**
176
 * \fn void deuligne__set_entry_mode(
177
 * deuligne__address_mode_t     address_mode,
178
 * deuligne__display_shift_t    display_shift)
179
 *
180
 * \brief Set LCD display entry mode.
181
 *
182
 * \param address_mode specify if DDRAM address is incremented or decremented
183
 * when a character code is written
184
 * \param display_shift set the display shift when a character code is written
185
 ******************************************************************************/
186
void
187
deuligne__set_entry_mode
188
(
189
    deuligne__address_mode_t    address_mode,
190
    deuligne__display_shift_t   display_shift
191
);
192
 
193
/**************************************************************************//**
194
 * \fn void deuligne__set_display(
195
 * bool enable_display,
196
 * bool enable_cursor_display,
197
 * bool enable_cursor_blink)
198
 *
199
 * \brief Set LCD display.
200
 * Enable or disable display, cursor display and cursor blink.
201
 *
202
 * \param enable_display true to enable display or false in contrary case
203
 * \param enable_cursor_display true to enable cursor display or false in
204
 * contrary case
205
 * \param enable_cursor_blink true to enable cursor blink or false in contrary
206
 * case
207
 ******************************************************************************/
208
void
209
deuligne__set_display
210
(
211
    bool enable_display,
212
    bool enable_cursor_display,
213
    bool enable_cursor_blink
214
);
215
 
216
/**************************************************************************//**
217
 * \fn void deuligne__clear_display(void)
218
 *
219
 * \brief Clear LCD display.
220
 ******************************************************************************/
221
void
222
deuligne__clear_display
223
(
224
    void
225
);
226
 
227
/**************************************************************************//**
228
 * \fn void deuligne__return_home(void)
229
 *
230
 * \brief Set cursor on the first column of the first line.
231
 ******************************************************************************/
232
void
233
deuligne__return_home
234
(
235
    void
236
);
237
 
238
/**************************************************************************//**
239
 *\fn void deuligne__set_cursor_position(deuligne__line_t line, uint8_t column)
240
 *
241
 * \brief Set cursor position.
242
 *
243
 * \param line destination line
244
 * \param column destination column
245
 ******************************************************************************/
246
void
247
deuligne__set_cursor_position
248
(
249
    deuligne__line_t    line,
250
    uint8_t             column
251
);
252
 
253
/**************************************************************************//**
254
 * \fn void deuligne__shift_display(deuligne__shift_direction_t shift_direction)
255
 *
256
 * \brief Shift the display on the right or on the left.
257
 *
258
 * \param shift_direction display shift direction
259
 ******************************************************************************/
260
void
261
deuligne__shift_display
262
(
263
    deuligne__shift_direction_t shift_direction
264
);
265
 
266
/**************************************************************************//**
267
 * \fn void deuligne__shift_cursor(deuligne__shift_direction_t shift_direction)
268
 *
269
 * \brief Shift the cursor on the right or on the left.
270
 *
271
 * \param shift_direction cursor shift direction
272
 ******************************************************************************/
273
void
274
deuligne__shift_cursor
275
(
276
    deuligne__shift_direction_t shift_direction
277
);
278
 
279
/**************************************************************************//**
280
 * \fn void deuligne__switch_on_backlight(void)
281
 *
282
 * \brief Switch on LCD backlight.
283
 ******************************************************************************/
284
void
285
deuligne__switch_on_backlight
286
(
287
    void
288
);
289
 
290
/**************************************************************************//**
291
 * \fn void deuligne__switch_off(voif)
292
 *
293
 * \brief Switch off backlight.
294
 ******************************************************************************/
295
void
296
deuligne__switch_off_backlight
297
(
298
    void
299
);
300
 
301
/**************************************************************************//**
302
 * \fn void deuligne__write_char(char data)
303
 *
304
 * \brief Write a character on LCD.
305
 *
306
 * \param data  Character to write.
307
 ******************************************************************************/
308
void
309
deuligne__write_char
310
(
311
    char data
312
);
313
 
314
/**************************************************************************//**
315
 * \fn void deuligne__write_string(const char* string_to_write)
316
 *
317
 * \brief Write a string on LCD display from current cursor position.
318
 *
319
 * \param string_to_write string to write
320
 ******************************************************************************/
321
void
322
deuligne__write_string
323
(
324
    const char* string_to_write
325
);
326
 
327
/**************************************************************************//**
328
 * \fn void deuligne__get_key(void)
329
 *
330
 * \brief Get key.
331
 *
332
 * \return Key.
333
 ******************************************************************************/
334
deuligne__key_t
335
deuligne__get_key
336
(
337
    void
338
);
339
 
340
#ifdef _cplusplus
341
}
342
#endif
343
 
344
#endif /* H__IDREAMMICRO__DEULIGNE__H */