3,6 → 3,7 |
#include "SPI1.h" |
#include "glcdfont.h" |
#include "UART1.h" |
#include "ETHERNET.h" |
|
static CUBE_DATA *cube_data_ptr; |
|
843,4 → 844,34 |
|
void Cube_Data_Direct_Write_All(uint8_t *buffer) { |
memcpy(cube_data_ptr->GCS, buffer, CUBE_LAYER_COUNT * GCS_LAYER_SIZE); |
} |
|
void Cube_Ethernet_Frame_In(void) { |
uint8_t i,j,k; |
uint8_t buffer[2048]; |
uint16_t length; |
uint16_t index = 1; |
|
// Read and process the ethernet packet |
if (ETH_Read_Packet(buffer, &length)) { |
// Check the first byte to determine what to do |
if (buffer[0] == 0x1) { |
Reset_Board(BOARD_MODE_ETHERNET); |
} |
if (buffer[0] == 0x2) { |
Reset_Board(BOARD_MODE_IDLE); |
} |
if (buffer[0] == 0xA) { |
ClearWDT(); |
// Update the cube |
for (i = 0; i < CUBE_LAYER_COUNT; i++) { |
for (j = 0; j < CUBE_COLUMN_COUNT; j++) { |
for (k = 0; k < CUBE_ROW_COUNT; k++) { |
Cube_Set_Pixel(i, k, j, buffer[index], buffer[index+1], buffer[index+2]); |
index += 3; |
} |
} |
} |
} |
} |
} |