Subversion Repositories HomeAutomation

Rev

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

Rev 2213 Rev 2214
Line 23... Line 23...
23
//
23
//
24
// This code is distributed under the GNU Public License
24
// This code is distributed under the GNU Public License
25
//      which can be found at http://www.gnu.org/licenses/gpl.txt
25
//      which can be found at http://www.gnu.org/licenses/gpl.txt
26
//
26
//
27
//*****************************************************************************
27
//*****************************************************************************
28
#ifndef GRAPHICS_WIDTH
28
#ifndef dotmatrixSIZEX
29
#error GRAPHICS_WIDTH, GRAPHICS_HEIGHT must be defined
29
#error dotmatrixSIZEX, dotmatrixSIZEY must be defined
30
#endif
30
#endif
31
 
31
 
32
#define OUTPUT  0
32
#define OUTPUT  0
33
#define INPUT   1
33
#define INPUT   1
34
 
34
 
Line 59... Line 59...
59
void dotmatrixSetData(uint8_t Data)
59
void dotmatrixSetData(uint8_t Data)
60
{
60
{
61
    /* Which ledmodule */
61
    /* Which ledmodule */
62
    uint8_t module = GrLcdState.lcdXAddr;
62
    uint8_t module = GrLcdState.lcdXAddr;
63
    /* Which column in ledmodule */
63
    /* Which column in ledmodule */
64
    uint8_t column = GrLcdState.lcdYAddr/dotmatrixSIZEY;
64
    uint8_t column = GrLcdState.lcdYAddr/8;
65
    //uint8_t column = GrLcdState.lcdXAddr%8;
65
    //uint8_t column = GrLcdState.lcdXAddr%8;
66
    /* Which row */
66
    /* Which row */
67
//  uint8_t row = GrLcdState.lcdYAddr%8;
67
//  uint8_t row = GrLcdState.lcdYAddr%8;
68
 
68
 
69
    /* Check panel size */
69
    /* Check panel size */
Line 75... Line 75...
75
 
75
 
76
uint8_t dotmatrixGetData(void){
76
uint8_t dotmatrixGetData(void){
77
    /* Which ledmodule */
77
    /* Which ledmodule */
78
    uint8_t module = GrLcdState.lcdXAddr;
78
    uint8_t module = GrLcdState.lcdXAddr;
79
    /* Which column in ledmodule */
79
    /* Which column in ledmodule */
80
    uint8_t column = GrLcdState.lcdYAddr/dotmatrixSIZEY;
80
    uint8_t column = GrLcdState.lcdYAddr/8;
81
    /* Which row */
81
    /* Which row */
82
//  uint8_t row = GrLcdState.lcdYAddr%8;
82
//  uint8_t row = GrLcdState.lcdYAddr%8;
83
   
83
   
84
    /* Check panel size */
84
    /* Check panel size */
85
    if ((column < dotmatrixSIZEY/8) && (module < dotmatrixSIZEX))
85
    if ((column < dotmatrixSIZEY/8) && (module < dotmatrixSIZEX))
Line 106... Line 106...
106
      dotmatrixSetData(~data);
106
      dotmatrixSetData(~data);
107
    }
107
    }
108
   
108
   
109
    GrLcdState.lcdXAddr++;
109
    GrLcdState.lcdXAddr++;
110
 
110
 
111
    if (GrLcdState.lcdXAddr > GRAPHICS_WIDTH ){
111
    if (GrLcdState.lcdXAddr > dotmatrixSIZEX ){
112
        dotmatrixSetXY(0,GrLcdState.lcdYAddr+8);
112
        dotmatrixSetXY(0,GrLcdState.lcdYAddr+8);
113
    }
113
    }
114
}
114
}
115
 
115
 
116
void dotmatrixWriteDataTransparent(uint8_t inputdata, uint8_t color){
116
void dotmatrixWriteDataTransparent(uint8_t inputdata, uint8_t color){
Line 138... Line 138...
138
      dotmatrixSetData(~data);
138
      dotmatrixSetData(~data);
139
    }
139
    }
140
 
140
 
141
    GrLcdState.lcdXAddr++;
141
    GrLcdState.lcdXAddr++;
142
 
142
 
143
    if (GrLcdState.lcdXAddr > GRAPHICS_WIDTH ){
143
    if (GrLcdState.lcdXAddr > dotmatrixSIZEX ){
144
        dotmatrixSetXY(0,GrLcdState.lcdYAddr+8);
144
        dotmatrixSetXY(0,GrLcdState.lcdYAddr+8);
145
    }
145
    }
146
}
146
}
147
 
147
 
148
uint8_t dotmatrixReadData(void){
148
uint8_t dotmatrixReadData(void){
Line 169... Line 169...
169
    if (dotmatrixRowCounter++ == 8) {dotmatrixRowCounter = 0;}
169
    if (dotmatrixRowCounter++ == 8) {dotmatrixRowCounter = 0;}
170
 
170
 
171
 
171
 
172
    /* Write one column of frame buffer to shift registers */
172
    /* Write one column of frame buffer to shift registers */
173
    for (col = 0; col < (dotmatrixSIZEX/8*dotmatrixSIZEY/8); col++) {
173
    for (col = 0; col < (dotmatrixSIZEX/8*dotmatrixSIZEY/8); col++) {
174
        dotmatrixSPIWrite(dotmatrixFramebuf[0][col*8+dotmatrixRowCounter]);
174
        dotmatrixSPIWrite(dotmatrixFramebuf[(col*8+dotmatrixRowCounter)/dotmatrixSIZEX][(col*8+dotmatrixRowCounter)%dotmatrixSIZEX]);
175
    }
175
    }
176
 
176
 
177
    /* Disable all rows */
177
    /* Disable all rows */
178
    gpio_clr_pin(dotmatrixROW_IO1);
178
    gpio_clr_pin(dotmatrixROW_IO1);
179
    gpio_clr_pin(dotmatrixROW_IO2);
179
    gpio_clr_pin(dotmatrixROW_IO2);
Line 263... Line 263...
263
    GrLcdState.color = GLCD_COLOR_BLACK;
263
    GrLcdState.color = GLCD_COLOR_BLACK;
264
}
264
}
265
 
265
 
266
void dotmatrixClear(){
266
void dotmatrixClear(){
267
    /* Clear buffer memory */
267
    /* Clear buffer memory */
268
    for (uint8_t i=0; i<dotmatrixSIZEY; i++)
268
    for (uint8_t i=0; i<dotmatrixSIZEY/8; i++)
269
    {
269
    {
270
        for (uint8_t j=0; j<(dotmatrixSIZEX/8); j++)
270
        for (uint8_t j=0; j<(dotmatrixSIZEX); j++)
271
        {
271
        {
272
            dotmatrixFramebuf[i][j] = dotmatrixINITIAL_ROW;
272
            dotmatrixFramebuf[i][j] = dotmatrixINITIAL_ROW;
273
        }
273
        }
274
    }
274
    }
275
}
275
}