Subversion Repositories idreammicro-avr

Rev

Rev 36 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
35 jlesech 1
/**************************************************************************//**
2
 * \brief Deuligne library - Demonstration program
3
 * \author Copyright (C) 2011  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
 * \file deuligne__demo.c
25
 ******************************************************************************/
26
 
27
/******************************************************************************
28
 * Header file inclusions.
29
 ******************************************************************************/
30
 
31
#include <deuligne/deuligne.h>
32
 
33
#include <util/delay.h>
34
 
35
#include <stdio.h>
36
 
37
/******************************************************************************
38
 * Public function definitions.
39
 ******************************************************************************/
40
 
41
/**************************************************************************//**
42
 * \fn int main(void)
43
 *
44
 * \brief Main function.
45
 ******************************************************************************/
46
int
47
main
48
(
49
    void
50
){
51
    // Initialize Deuligne and configure display.
52
    deuligne__initialize();
53
    deuligne__set_display(true, false, false);
54
 
55
    // Switch on backlight.
56
    deuligne__switch_on_backlight();
57
 
58
    // Say "Hello world!"
59
    deuligne__write_string("Hello world!");
60
 
61
    // Infinite loop.
62
    for(;;)
63
    {
64
        // Set cursor position.
65
        deuligne__set_cursor_position(DEULIGNE__DISPLAY_LINE_2, 0);
66
 
67
        // Get key.
68
        deuligne__key_t key = deuligne__get_key();
69
 
70
        // Display key.
71
        switch (key)
72
        {
73
            case DEULIGNE__KEY__UP:
74
                deuligne__write_string("Up    ");
75
                break;
76
 
77
            case DEULIGNE__KEY__DOWN:
78
                deuligne__write_string("Down  ");
79
                break;
80
 
81
            case DEULIGNE__KEY__LEFT:
82
                deuligne__write_string("Left  ");
83
                break;
84
 
85
            case DEULIGNE__KEY__RIGHT:
86
                deuligne__write_string("Right ");
87
                break;
88
 
89
            case DEULIGNE__KEY__SELECT:
90
                deuligne__write_string("Select");
91
                break;
92
 
93
            case DEULIGNE__KEY__NONE:
94
                deuligne__write_string("None  ");
95
                break;
96
        }
97
 
98
        _delay_ms(250);
99
    }
100
 
101
    return 0;
102
}