summaryrefslogtreecommitdiffstats
path: root/apps/status.c
blob: 781fa9084256ba430e5b1503bcf066b9b2ad1d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2002 by Linus Nielsen Feltzing
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#include "lcd.h"
#include "debug.h"
#include "kernel.h"
#include "power.h"
#include "thread.h"
#include "settings.h"
#include "status.h"

static enum playmode current_mode;

void status_init(void)
{
    status_set_playmode(STATUS_STOP);
}

void status_set_playmode(enum playmode mode)
{
    current_mode = mode;
}

void status_draw(void)
{
    int battlevel = battery_level();
    
#ifdef HAVE_LCD_CHARCELLS
    lcd_icon(ICON_BATTERY, true);
    if(battlevel > 25)
	lcd_icon(ICON_BATTERY_1, true);
    else
	lcd_icon(ICON_BATTERY_1, false);
    if(battlevel > 50)
	lcd_icon(ICON_BATTERY_2, true);
    else
	lcd_icon(ICON_BATTERY_2, false);
    if(battlevel > 75)
	lcd_icon(ICON_BATTERY_3, true);
    else
	lcd_icon(ICON_BATTERY_3, false);


    lcd_icon(ICON_VOLUME, true);
    if(global_settings.volume > 10)
	lcd_icon(ICON_VOLUME_1, true);
    else
	lcd_icon(ICON_VOLUME_1, false);
    if(global_settings.volume > 30)
	lcd_icon(ICON_VOLUME_2, true);
    else
	lcd_icon(ICON_VOLUME_2, false);
    if(global_settings.volume > 50)
	lcd_icon(ICON_VOLUME_3, true);
    else
	lcd_icon(ICON_VOLUME_3, false);
    if(global_settings.volume > 70)
	lcd_icon(ICON_VOLUME_4, true);
    else
	lcd_icon(ICON_VOLUME_4, false);
    if(global_settings.volume > 90)
	lcd_icon(ICON_VOLUME_5, true);
    else
	lcd_icon(ICON_VOLUME_5, false);

    switch(current_mode)
    {
    case STATUS_PLAY:
	lcd_icon(ICON_PLAY, true);
	lcd_icon(ICON_PAUSE, false);
	break;
	
    case STATUS_STOP:
	lcd_icon(ICON_PLAY, false);
	lcd_icon(ICON_PAUSE, false);
	break;
	
    case STATUS_PAUSE:
	lcd_icon(ICON_PLAY, false);
	lcd_icon(ICON_PAUSE, true);
	break;
    }
#endif
}