int bsp_init(void) { init_heap((size_t)stack,configTOTAL_HEAP_SIZE); #if 0 // Config System Clock P_Int_Ctrl = 0x0000; P_Int_Status = 0xFFFF; P_System_Clock = 0x0098; // Config IOB as Output Port P_IOB_Data->data = 0x0000; P_IOB_Attrib->data = 0xFFFF; P_IOB_Dir->data = 0xFFFF; #endif System_Initial(); // System initial return 0; }
/* * ======== main ======== */ int main(int argc, char *argv[]) { CSL_init(); // Activate Grace-generated configuration delay(); // System_Initial(); // initialize system. delay(); // delay and wait the first conversion. _enable_interrupt(); // enable interrupt while(1) { // half a second interrupt. if(flag & BIT7) { half_second(); } // read ADC result if(flag & BIT4) //Read ADC result { ADC_display(); } // one second interrupt to display time if (flag & BIT3) { time_display(); } if(flag & BIT1) // if SW1 is pushed, threshold temperature { // state machine will be changed flag &= ~ BIT1; // flag is reset time_state = 0; //when threshold temperature is setting, //setting time is disable. if(!customThreshold) { meatSelect(); //Enter meat select menu if not setting custom } if(Thr_state >= 3) // if in state 3, change to state 0; { Thr_state = 0; Thr_temp = set_temp; // assign threshold temperature LCD_display_number(0,4,Thr_temp); // display threshold temperature customThreshold = 0; //Reset custom threshold flag } else //else, Thr_state is changed to next state { Thr_state ++; } } if((flag & BIT2) && (!Thr_state)) // if SW2 is pushed, and Thr_state = 0, { // time setting state machine will be changed flag &= ~ BIT2; // flag is reset if(!(P1IN & BIT3)) { flag ^= BIT9; // S2 and SW2 are pushed together to change input flag ^= BIT8; if(flag & BIT9) // Display external temp LCD_display_string(1," Ext :"); else //Display probe temp LCD_display_string(1," Probe :"); } else { if(time_state >= 4) // if in state 4, change to state 0; { time_state = 0; time = set_time; // assign actual time set_time = 0; LCD_display_time(0,8,time); // display setting time } else { time_state ++; } } } if(flag & BIT0) // P1.3 service, set the Threshold temp or Time. { flag &= ~ BIT0; // flag is reset if(Thr_state != 0) { set_Thrtemp(); // set threshold temperature. } else if(time_state != 0) { set_Time(); // set timer. } else flag ^= BIT8; // display temperature in Fahrenheit } else __no_operation(); } }