Subversion Repositories HomeAutomation

Rev

Rev 2213 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1793 arune 1
#include <inttypes.h>
2
#include <config.h>
3
#include <drivers/mcu/gpio.h>
4
 
5
#define GLCD_COLOR_BLACK 0
6
#define GLCD_COLOR_WHITE 1
7
#define GLCD_COLOR_SET   0
8
#define GLCD_COLOR_CLEAR 1
9
 
1808 arune 10
#ifndef dotmatrixLATCHCLOCK_IO
11
 
1796 arune 12
#define dotmatrixROW_IO1 EXP_P
13
#define dotmatrixROW_IO2 EXP_B
14
#define dotmatrixROW_IO3 EXP_C
15
#define dotmatrixROW_IO4 EXP_D
16
#define dotmatrixROW_IO5 EXP_E
17
#define dotmatrixROW_IO6 EXP_F
18
#define dotmatrixROW_IO7 EXP_A
19
#define dotmatrixROW_IO8 EXP_O
20
 
21
#define dotmatrixLATCHCLOCK_IO EXP_I
22
 
1808 arune 23
#endif
24
 
25
#define dotmatrixSIZEX GRAPHICS_WIDTH
26
#define dotmatrixSIZEY GRAPHICS_HEIGHT
2214 linlun 27
#if dotmatrixSIZEY % 8 !=0
28
#error Dotmatrix display only supports screen sizes of multiples of 8 in Y direction
29
#endif
30
#if dotmatrixSIZEX % 32 !=0
31
#error Dotmatrix display only supports screen sizes of multiples of 32 in X direction
32
#endif
1808 arune 33
 
1805 arune 34
#define dotmatrixINITIAL_ROW 0x0
1796 arune 35
 
36
#define USART_SPI_CS_DDR    DDRC
37
#define USART_SPI_CS        PC0
38
#define USART_SPI_XCK_DDR   DDRD
39
#define USART_SPI_XCK       PD4
40
#define waitspi() while(!(UCSR0A&(1<<RXC0)))
41
 
1793 arune 42
/* State variable */
43
typedef struct struct_GrLcdStateType
44
{
45
    unsigned char lcdXAddr;
46
    unsigned char lcdYAddr;
47
    uint8_t color;
48
} GrLcdStateType;
49
 
50
 
51
/* Internal functions */
52
 
1796 arune 53
void dotmatrixSPIWrite(uint8_t data);
1793 arune 54
 
55
/* Public functions */
56
 
57
void dotmatrixWriteData(uint8_t data, uint8_t color);
58
 
59
void dotmatrixWriteDataTransparent(uint8_t inputdata, uint8_t color);
60
 
61
uint8_t dotmatrixReadData(void);
62
 
63
void dotmatrixSetXY(uint8_t x, uint8_t y);
64
 
65
uint8_t dotmatrixGetX(void);
66
 
67
uint8_t dotmatrixGetY(void);
68
 
1794 arune 69
void dotmatrixRefresh(void);
70
 
1793 arune 71
void dotmatrixInit(void);
72
 
73
void dotmatrixClear(void);
74
 
75
void dotmatrixSetColor(uint8_t color);
76
 
77
uint8_t dotmatrixGetColor(void);
78
 
79