/PIC Stuff/Cerebot_32MX7_LED_Cube/CUBE.c |
---|
4,6 → 4,7 |
#include "CUBE.h" |
#include "SPI1.h" |
#include "glcdfont.h" |
#include "UART1.h" |
static CUBE_DATA *cube_data_ptr; |
758,6 → 759,10 |
} |
// Process data |
switch (cube_data_ptr->frame_state) { |
case IDLE: |
// Reflect the character back to the transmitter |
UART1_Write(&c, 1); |
break; |
case READ_LENGTH_MSB: // Save MSB of length |
cube_data_ptr->frame_length |= (c << 8); |
cube_data_ptr->frame_state = READ_LENGTH_LSB; |
775,17 → 780,17 |
cube_data_ptr->frame_checksum += c; |
cube_data_ptr->frame_buffer[cube_data_ptr->frame_index] = c; |
cube_data_ptr->frame_index++; |
if (cube_data_ptr->frame_index == cube_data_ptr->frame_length) |
if (cube_data_ptr->frame_index == cube_data_ptr->frame_length - 1) |
cube_data_ptr->frame_state = READ_CHECKSUM; |
break; |
case READ_CHECKSUM: // Process frame if checksum is valid |
if (0xFF - (cube_data_ptr->frame_checksum && 0xFF) == c) |
cube_data_ptr->frame_checksum = 0xFF - cube_data_ptr->frame_checksum; |
if (cube_data_ptr->frame_checksum == c) { |
Cube_Data_In_Process_Frame(); |
} |
cube_data_ptr->frame_state = IDLE; |
break; |
case IDLE: |
default: |
// Do nothing |
break; |
} |
} |
/PIC Stuff/Cerebot_32MX7_LED_Cube/CUBE.h |
---|
76,7 → 76,7 |
// Variables for input frame data |
PROCESS_STATE frame_state; |
unsigned char frame_buffer[CUBE_FRAME_BUFFER_SIZE]; |
int frame_checksum; |
char frame_checksum; |
int frame_length; |
int frame_index; |
int frame_command; |
/PIC Stuff/Cerebot_32MX7_LED_Cube/main.c |
---|
126,13 → 126,13 |
// Cube_Set_All(BLUE); |
// Delay_MS(6000); |
char start_text[] = "uC Started"; |
UART1_Write(start_text, 10); |
char start_text[] = "Cube Initialized\r\n"; |
UART1_Write(start_text, 18); |
// Set the overlay text |
char text_string[] = "Welcome to the CCM Lab "; |
Cube_Text_Init(text_string, 26, 0xFF, 0xFF, 0xFF); |
TIMER4_Start(); |
// char text_string[] = "Welcome to the CCM Lab "; |
// Cube_Text_Init(text_string, 26, 0xFF, 0xFF, 0xFF); |
// TIMER4_Start(); |
// Loop through some preset animations |
while(1) { |
140,10 → 140,10 |
// Animation_Layer_Alternate(2,300); |
// Animation_Pixel_Alternate(1,200); |
// Animation_Full_Color_Sweep(2,1000); |
Animation_Row_Column_Sweep(2,40); |
Animation_Cube_In_Cube(4,300); |
Animation_Double_Rotation(2,40); |
Animation_Pseudo_Random_Colors(10,300); |
// Animation_Row_Column_Sweep(2,40); |
// Animation_Cube_In_Cube(4,300); |
// Animation_Double_Rotation(2,40); |
// Animation_Pseudo_Random_Colors(10,300); |
// Animation_Random_Colors(10,300); |
} |
} |
/PIC Stuff/Cerebot_32MX7_LED_Cube/nbproject/Makefile-genesis.properties |
---|
1,5 → 1,5 |
# |
#Wed Aug 07 15:16:19 EDT 2013 |
#Wed Aug 07 21:27:20 EDT 2013 |
default.com-microchip-mplab-nbide-toolchainXC32-XC32LanguageToolchain.md5=6b4fa04caf3910c7c3a4666b1aea8c5c |
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc32\\v1.20\\bin |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=415494acd195d89b2f6d7a36797a5ab4 |