Subversion Repositories HomeAutomation

Rev

Rev 188 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 188 Rev 191
1
#include <inttypes.h>
1
#include <inttypes.h>
2
 
2
 
3
 
3
 
4
#define LCD_DATA_PORT_DB0   PORTC
4
#define LCD_DATA_PORT_DB0   PORTC
5
#define LCD_DATA_PORT_DB1   PORTC
5
#define LCD_DATA_PORT_DB1   PORTC
6
#define LCD_DATA_PORT_DB2   PORTC
6
#define LCD_DATA_PORT_DB2   PORTC
7
#define LCD_DATA_PORT_DB3   PORTC
7
#define LCD_DATA_PORT_DB3   PORTC
8
#define LCD_DATA_PORT_DB4   PORTC
8
#define LCD_DATA_PORT_DB4   PORTC
9
#define LCD_DATA_PORT_DB5   PORTC
9
#define LCD_DATA_PORT_DB5   PORTC
10
#define LCD_DATA_PORT_DB6   PORTB
10
#define LCD_DATA_PORT_DB6   PORTB
11
#define LCD_DATA_PORT_DB7   PORTD
11
#define LCD_DATA_PORT_DB7   PORTD
12
 
12
 
13
#define LCD_DATA_PIN_DB0    0x00
13
#define LCD_DATA_PIN_DB0    0x00
14
#define LCD_DATA_PIN_DB1    0x01
14
#define LCD_DATA_PIN_DB1    0x01
15
#define LCD_DATA_PIN_DB2    0x02
15
#define LCD_DATA_PIN_DB2    0x02
16
#define LCD_DATA_PIN_DB3    0x03
16
#define LCD_DATA_PIN_DB3    0x03
17
#define LCD_DATA_PIN_DB4    0x04
17
#define LCD_DATA_PIN_DB4    0x04
18
#define LCD_DATA_PIN_DB5    0x05
18
#define LCD_DATA_PIN_DB5    0x05
19
#define LCD_DATA_PIN_DB6    0x00
19
#define LCD_DATA_PIN_DB6    0x00
20
#define LCD_DATA_PIN_DB7    0x00
20
#define LCD_DATA_PIN_DB7    0x00
21
 
21
 
22
#define LCD_CONTROL_PORT    PORTD
22
#define LCD_CONTROL_PORT    PORTD
23
 
23
 
24
#define LCD_CONTROL_PIN_RS  0x02
24
#define LCD_CONTROL_PIN_RS  0x02
25
#define LCD_CONTROL_PIN_RW  0x01
25
#define LCD_CONTROL_PIN_RW  0x01
26
#define LCD_CONTROL_PIN_E   0x04
26
#define LCD_CONTROL_PIN_E   0x04
27
#define LCD_CONTROL_PIN_CS1 0x05
27
#define LCD_CONTROL_PIN_CS1 0x05
28
#define LCD_CONTROL_PIN_CS2 0x06
28
#define LCD_CONTROL_PIN_CS2 0x06
29
 
29
 
30
 
30
 
31
//Här har vi någon slags tillståndsvariabel
31
//Här har vi någon slags tillståndsvariabel
32
typedef struct struct_GrLcdStateType
32
typedef struct struct_GrLcdStateType
33
{
33
{
34
    unsigned char lcdXAddr;
34
    unsigned char lcdXAddr;
35
    unsigned char lcdYAddr;
35
    unsigned char lcdYAddr;
36
} GrLcdStateType;
36
} GrLcdStateType;
37
 
37
 
38
 
38
 
39
//Alla funktioner
39
//Alla funktioner
40
void Disable(void);
40
void Disable(void);
41
 
41
 
42
void Delay(void);
42
void Delay(void);
43
 
43
 
44
void Enable(void);
44
void Enable(void);
45
 
45
 
46
void glcdWriteData(uint8_t data);
46
void glcdWriteData(uint8_t data);
47
 
47
 
48
void glcdWriteChar(unsigned char c);
48
void glcdWriteChar(unsigned char c);
49
 
49
 
50
void glcdPutStr(unsigned char *data);
50
void glcdPutStr(unsigned char *data);
51
 
51
 
52
void SetControls(uint8_t RS, uint8_t RW);
52
void SetControls(uint8_t RS, uint8_t RW);
53
 
53
 
54
void SetData(uint8_t Data);
54
void SetData(uint8_t Data);
55
 
55
 
56
void glcdSetXY(uint8_t x, uint8_t y);
56
void glcdSetXY(uint8_t x, uint8_t y);
57
 
57
 
58
void glcdPowerOn(void);
58
void glcdPowerOn(void);
-
 
59
 
-
 
60
void glcdClear(void);
59
 
-