149,38 → 149,44 |
uint8_t result, length; |
|
while(1) { |
// I2C1_Master_Restart(0x24, 0xA, 1); |
// do { |
// result = I2C1_Get_Status(); |
// } while (!result); |
// length = I2C1_Read_Buffer(buffer1); |
// buffer1[0] = ~buffer1[0]; |
// |
// |
// buffer1[1] = buffer1[0]; |
// buffer1[0] = 0xB; |
// I2C1_Master_Send(0x24, buffer1, 2); |
// do { |
// result = I2C1_Get_Status(); |
// } while (!result); |
I2C1_Master_Restart(0x24, 0xA, 1); |
do { |
result = I2C1_Get_Status(); |
} while (!result); |
if (result == I2C1_RECV_OK) { |
LED1_LAT = 1; |
length = I2C1_Read_Buffer(buffer1); |
buffer1[1] = ~buffer1[0]; |
buffer1[0] = 0xB; |
} else { |
LED1_LAT = 0; |
} |
|
|
I2C1_Master_Restart(0x25, 0xA, 1); |
do { |
result = I2C1_Get_Status(); |
} while (!result); |
length = I2C1_Read_Buffer(buffer2); |
buffer2[0] = ~buffer2[0]; |
|
buffer2[1] = buffer2[0]; |
buffer2[0] = 0xB; |
if (result == I2C1_RECV_OK) { |
LED2_LAT = 1; |
length = I2C1_Read_Buffer(buffer2); |
buffer2[1] = ~buffer2[0]; |
buffer2[0] = 0xB; |
} else { |
LED2_LAT = 0; |
} |
|
I2C1_Master_Send(0x24, buffer1, 2); |
do { |
result = I2C1_Get_Status(); |
} while (!result); |
|
I2C1_Master_Send(0x25, buffer2, 2); |
do { |
result = I2C1_Get_Status(); |
} while (!result); |
|
Delay_MS(1); |
|
// do { |
// result = I2C1_Get_Status(); |
// } while (!result); |
// length = I2C1_Read_Buffer(buffer); |
|
// Animation_Solid_Colors(2,300); |
// Animation_Layer_Alternate(2,300); |