Subversion Repositories HomeAutomation

Rev

Rev 1789 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1789 Rev 1793
Line 1... Line -...
1
#include "ks0108.h"
-
 
2
#include "graphics.h"
1
#include "graphics.h"
3
#include "font.h"
2
#include "font.h"
4
#include <avr/io.h>
3
#include <avr/io.h>
5
#include <stdio.h>
4
#include <stdio.h>
6
#include <stdlib.h>
5
#include <stdlib.h>
7
 
6
 
8
#include <avr/pgmspace.h>
7
#include <avr/pgmspace.h>
-
 
8
 
-
 
9
#ifndef GRAPHICSDRIVER
-
 
10
#define GRAPHICSDRIVER KS0108
-
 
11
#warning Please define GRAPHICSDRIVER in your config.inc
-
 
12
#endif
-
 
13
 
-
 
14
#if GRAPHICSDRIVER==KS0108
-
 
15
#include "ks0108.h"
-
 
16
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
17
#include "dotmatrix.h"
-
 
18
#else
-
 
19
#error Non supported graphics driver
-
 
20
#endif
-
 
21
 
9
 
22
 
10
//Some parts of the code is from proycon avrlib written by Pascal Stang:
23
//Some parts of the code is from proycon avrlib written by Pascal Stang:
11
//*****************************************************************************
24
//*****************************************************************************
12
//
25
//
13
// File Name    : 'glcd.c'
26
// File Name    : 'glcd.c'
Line 27... Line 40...
27
//      which can be found at http://www.gnu.org/licenses/gpl.txt
40
//      which can be found at http://www.gnu.org/licenses/gpl.txt
28
//
41
//
29
//*****************************************************************************
42
//*****************************************************************************
30
 
43
 
31
void glcdSetColor(uint8_t color){
44
void glcdSetColor(uint8_t color){
-
 
45
#if GRAPHICSDRIVER==KS0108
32
  ks0108SetColor(color);
46
  ks0108SetColor(color);
-
 
47
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
48
  dotmatrixSetColor(color);
-
 
49
#endif
33
}
50
}
34
 
51
 
35
uint8_t glcdGetColor(void){
52
uint8_t glcdGetColor(void){
-
 
53
#if GRAPHICSDRIVER==KS0108
36
  return ks0108GetColor();
54
  return ks0108GetColor();
-
 
55
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
56
  return dotmatrixGetColor();
-
 
57
#endif
37
}
58
}
38
 
59
 
39
void glcdWriteData(uint8_t data, uint8_t color){
60
void glcdWriteData(uint8_t data, uint8_t color){
-
 
61
#if GRAPHICSDRIVER==KS0108
40
    ks0108WriteData(data, color);
62
    ks0108WriteData(data, color);
-
 
63
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
64
    dotmatrixWriteData(data, color);
-
 
65
#endif
41
}
66
}
42
 
67
 
43
void glcdWriteDataTransparent(uint8_t inputdata, uint8_t color){
68
void glcdWriteDataTransparent(uint8_t inputdata, uint8_t color){
-
 
69
#if GRAPHICSDRIVER==KS0108
44
    ks0108WriteDataTransparent(inputdata, color);
70
    ks0108WriteDataTransparent(inputdata, color);
-
 
71
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
72
    dotmatrixWriteDataTransparent(inputdata, color);
-
 
73
#endif
45
}
74
}
46
 
75
 
47
uint8_t glcdReadData(void){
76
uint8_t glcdReadData(void){
-
 
77
#if GRAPHICSDRIVER==KS0108
48
    return ks0108ReadData();
78
    return ks0108ReadData();
-
 
79
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
80
    return dotmatrixReadData();
-
 
81
#endif
49
}
82
}
50
 
83
 
51
void glcdClear(){
84
void glcdClear(){
-
 
85
#if GRAPHICSDRIVER==KS0108
52
    ks0108Clear();
86
    ks0108Clear();
-
 
87
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
88
    dotmatrixClear();
-
 
89
#endif
53
}
90
}
54
 
91
 
55
void glcdSetXY(uint8_t x, uint8_t y){
92
void glcdSetXY(uint8_t x, uint8_t y){
-
 
93
#if GRAPHICSDRIVER==KS0108
56
    ks0108SetXY(x, y);
94
    ks0108SetXY(x, y);
-
 
95
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
96
    dotmatrixSetXY(x, y);
-
 
97
#endif
57
}
98
}
58
 
99
 
59
uint8_t glcdGetX(void){
100
uint8_t glcdGetX(void){
-
 
101
#if GRAPHICSDRIVER==KS0108
60
    return ks0108GetX();
102
    return ks0108GetX();
-
 
103
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
104
    return dotmatrixGetX();
-
 
105
#endif
61
}
106
}
62
 
107
 
63
uint8_t glcdGetY(void){
108
uint8_t glcdGetY(void){
-
 
109
#if GRAPHICSDRIVER==KS0108
64
    return ks0108GetY();
110
    return ks0108GetY();
-
 
111
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
112
    return dotmatrixGetY();
-
 
113
#endif
65
}
114
}
66
 
115
 
67
void glcdInit(void)
116
void glcdInit(void)
68
{
117
{
-
 
118
#if GRAPHICSDRIVER==KS0108
69
    ks0108Init();
119
    ks0108Init();
-
 
120
#elif GRAPHICSDRIVER==DOTMATRIX
-
 
121
    dotmatrixInit();
-
 
122
#endif
70
}
123
}
71
 
124
 
72
void glcdWriteChar(char c, uint8_t color)
125
void glcdWriteChar(char c, uint8_t color)
73
{
126
{
74
    uint8_t i = 0;
127
    uint8_t i = 0;