Subversion Repositories group.electronics

Rev

Rev 184 | Rev 186 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 184 Rev 185
Line 56... Line 56...
56
            this.i2c = i2c;
56
            this.i2c = i2c;
57
 
57
 
58
            
58
            
59
            for (int i = 0; i < (LCD_WIDTH * LCD_HEIGHT / 8); i++) {
59
            for (int i = 0; i < (LCD_WIDTH * LCD_HEIGHT / 8); i++) {
60
                buffer[i] = new byte();
60
                buffer[i] = new byte();
61
                buffer[i] = 0x00;
61
                buffer[i] = 0xff;
62
            }
62
            }
63
        }
63
        }
64
 
64
 
65
        public void init() {
65
        public void init() {
66
            // Init sequence
66
            // Init sequence
Line 118... Line 118...
118
 
118
 
119
            oled_command(PAGEADDR);
119
            oled_command(PAGEADDR);
120
            oled_command(0x00); // Page start address
120
            oled_command(0x00); // Page start address
121
            oled_command(7);    // Page end address (7 for 64 pixels)
121
            oled_command(7);    // Page end address (7 for 64 pixels)
122
 
122
 
-
 
123
            const int BYTES_TO_SEND = 1024;
-
 
124
 
123
            for (int i = 0; i < (LCD_WIDTH * LCD_HEIGHT / 8); i++) {
125
            for (int i = 0; i < (LCD_WIDTH * LCD_HEIGHT / 8); i++) {
124
                byte[] data = new byte[16];
126
                byte[] data = new byte[BYTES_TO_SEND + 1];
-
 
127
                data[0] = 0x40;
125
                for (int j = 0; j < 16; j++) {
128
                for (int j = 1; j < BYTES_TO_SEND + 1; j++) {
126
                    data[j] = buffer[i];
129
                    data[j] = buffer[i];
127
                    i++;
130
                    i++;
128
                }
131
                }
129
                i--;
132
                i--;
130
                i2c.WriteI2cData(i2cUtils.addressToWrite(this.i2caddr), data, 16);
133
                i2c.WriteI2cData(i2cUtils.addressToWrite(this.i2caddr), data, BYTES_TO_SEND + 1);
131
            }
134
            }
132
        }
135
        }
133
 
136
 
134
        public int oled_command(byte c) {
137
        public int oled_command(byte c) {
135
            byte[] data = { 0x00, c };            
138
            byte[] data = { 0x00, c };