Subversion Repositories Code-Repo

Rev

Rev 234 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 234 Rev 235
Line 147... Line 147...
147
    uint8_t buffer1[2];
147
    uint8_t buffer1[2];
148
    uint8_t buffer2[2];
148
    uint8_t buffer2[2];
149
    uint8_t result, length;
149
    uint8_t result, length;
150
    
150
    
151
    while(1) {
151
    while(1) {
152
//        I2C1_Master_Restart(0x24, 0xA, 1);
152
        I2C1_Master_Restart(0x24, 0xA, 1);
153
//        do {
153
        do {
154
//            result = I2C1_Get_Status();
154
            result = I2C1_Get_Status();
155
//        } while (!result);
155
        } while (!result);
-
 
156
        if (result == I2C1_RECV_OK) {
-
 
157
            LED1_LAT = 1;
156
//        length = I2C1_Read_Buffer(buffer1);
158
            length = I2C1_Read_Buffer(buffer1);
157
//        buffer1[0] = ~buffer1[0];
159
            buffer1[1] = ~buffer1[0];
158
//
-
 
159
//
-
 
160
//        buffer1[1] = buffer1[0];
160
            buffer1[0] = 0xB;
161
//        buffer1[0] = 0xB;
161
        } else {
162
//        I2C1_Master_Send(0x24, buffer1, 2);
162
            LED1_LAT = 0;
163
//        do {
163
        }
164
//            result = I2C1_Get_Status();
-
 
165
//        } while (!result);
164
        
166
 
165
 
167
        I2C1_Master_Restart(0x25, 0xA, 1);
166
        I2C1_Master_Restart(0x25, 0xA, 1);
168
        do {
167
        do {
169
            result = I2C1_Get_Status();
168
            result = I2C1_Get_Status();
170
        } while (!result);
169
        } while (!result);
-
 
170
        if (result == I2C1_RECV_OK) {
-
 
171
            LED2_LAT = 1;
171
        length = I2C1_Read_Buffer(buffer2);
172
            length = I2C1_Read_Buffer(buffer2);
172
        buffer2[0] = ~buffer2[0];
173
            buffer2[1] = ~buffer2[0];
173
 
-
 
174
        buffer2[1] = buffer2[0];
174
            buffer2[0] = 0xB;
-
 
175
        } else {
175
        buffer2[0] = 0xB;
176
            LED2_LAT = 0;
-
 
177
        }
-
 
178
        
-
 
179
        I2C1_Master_Send(0x24, buffer1, 2);
-
 
180
        do {
-
 
181
            result = I2C1_Get_Status();
-
 
182
        } while (!result);
-
 
183
        
176
        I2C1_Master_Send(0x25, buffer2, 2);
184
        I2C1_Master_Send(0x25, buffer2, 2);
-
 
185
        do {
-
 
186
            result = I2C1_Get_Status();
-
 
187
        } while (!result);
177
 
188
 
178
        Delay_MS(1);
189
        Delay_MS(1);
179
 
-
 
180
//        do {
-
 
181
//            result = I2C1_Get_Status();
-
 
182
//        } while (!result);
-
 
183
//        length = I2C1_Read_Buffer(buffer);
-
 
184
        
190
        
185
//        Animation_Solid_Colors(2,300);
191
//        Animation_Solid_Colors(2,300);
186
//        Animation_Layer_Alternate(2,300);
192
//        Animation_Layer_Alternate(2,300);
187
//        Animation_Pixel_Alternate(1,200);
193
//        Animation_Pixel_Alternate(1,200);
188
//        Animation_Full_Color_Sweep(2,1000);
194
//        Animation_Full_Color_Sweep(2,1000);